[Resolved] Changing the default mystery man avatar
-
I have read a million threads on how to change the default mystery man avatar but none of the solutions work.
Is there a solution that works with the current version of BP (1.7.2)?
-
define ( 'BP_AVATAR_DEFAULT', $img_url );
I use the “add new default avatar” plugin and workd.
https://downloads.wordpress.org/plugin/add-new-default-avatar.1.3.1.zip@modemlooper have you tested this recently? It used to work for me but not right now. Very puzzling!
@tbermudas thanks for the idea, i used to have it working (without the need for a plugin). Thinking using a plugin for this is like using a sledgehammer to crack a nut.
@henrywright-1
I have to disagree, a plugin coded well is no different than a function in a themes functions.php if a plugin introduces bugs then that can be nut cracking. On the other hand if you introduce code with syntax errors, and clashing functions then you have essentially cracked your own nuts. No pun intended! 🙂@bphelp haha!
you’re right i suppose, it does depend a lot on the plugin. After all, a plugin can be a few lines of code in a single file or a huge folder full of badly written buggy spaghetti code.
I’m trying to get this to work purely for my own satisfaction now as I had it working at some point in the past.
it totally works.
I used this:
define ( 'BP_AVATAR_DEFAULT', 'http://www.petfinder.com/wp-content/uploads/2012/11/101418789-cat-panleukopenia-fact-sheet-632x475.jpg' );
view it here:
http://demo.taptappress.com/membersJust plopped the code into bp-custom.php
That plugin you link to takes a silly path using javascript to switch avatar.
Thanks for the tip! I will try it!
@henrywright-1
Hey thanks for being a good sport. Sorry I felt inclined to show my sense of humor but I could not pass up the opportunity. On a serious note though, and I am sure you know that plugins are just functions with hooks that has required commented info at the top of the php file. That is really the only difference between a plugin and a function. I try to keep my custom functions in one file that I can deploy in most situations. I of course comment all the functions in case of hook changes etc., and if a hook changes then I comment out the function until I narrow down what needs to be recoded in regards to a hook. Not saying you don’t know this already or practice it, but maybe it will benefit others as we all go about harnessing the power of WordPress and BuddyPress. 🙂
Cheers!@modemlooper popping this into my bp-custom doesn’t work for me
define ( 'BP_AVATAR_DEFAULT', 'http://www.petfinder.com/wp-content/uploads/2012/11/101418789-cat-panleukopenia-fact-sheet-632x475.jpg' );
It could well be my install (i have heavily used functions.php). Mind you, i’ve not used many plugins. I’ll try on a fresh install and report back.
Sometimes a little humour is needed! especially as i’ve been pulling my hair out over the past 2 days trying to get this blasted code to work :}
the way you comment your code sounds like good practice to me. That way you can write code once, reuse on new websites you’re working on, let people understand what you’ve written, easily go back to old code and so on.
I stripped my bp-custom.php down so that it is almost empty. @modemlooper’s code works great now. Must have been something in there causing a conflict.
Thanks guys
Here is another way of doing it. In your setting >>> discussion >> default avatar them choose mystry man and the following code will go into functions.php
//Custom avatar for no avatar user function myavatar_add_default_avatar( $url ){ return get_stylesheet_directory_uri() .'/_inc/images/user-nopic2.png'; } add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' );
Naijaping
Thanks @naijaping
The way I achieve this is by using wordpress blank avatar and css.
In wordpress dashboard Settings -> Discussion, change default avatar to Blank.
In your css file add this (after uploading the image you want to use ->.avatar {background:url(image/custom_avatar.png) 0 0px no-repeat!important;background-size:100%, 100%!important;}
Hi,
maybe it some solution for this problem?
Connecting with gravatar.com slows page load.
Please look in my speed test: http://s30.postimg.org/dc9fdyua9/image.jpgPlease help.
- The topic ‘[Resolved] Changing the default mystery man avatar’ is closed to new replies.