I have a multi-site install with buddypress on the main site. In the buddypress theme I've been able to override the default 'mystery-man' avatar using my custom buddypress theme. I simply have an images folder containing a replacement 'mystery-man.jpg' avatar.

However, for the other wordpress sites on the network this technique doesn't work. I've looked into the solutions proposed here:

Set default avatar network-wide

But these answers don't seem to work with buddypress enabled on the main site. It seems buddypress somehow interferes with the way the non-buddypress sites get their avatars, because the html returned looks like this:

<img src="http://www.gravatar.com/avatar/ba60ca5beed202054f393b040bfd7ac3?d=http://subsite.example.com/wp-content/plugins/buddypress/bp-core/images/mystery-man.jpg&amp;s=50&amp;r=G" alt="Avatar Image" class="avatar user-16-avatar" width="50" height="50">

...regardless of the functions and filters I've applied from the previous solution.

Is there a way to get it to look to see if the subsites theme has an 'images/mystery-man.jpg' and use that before using the buddypress default?


Following feedback I realise 'BuddyPress' is network enabled on my site, which interferes with the normal solution. I've tried enabling this on just the main site, but this crashes all the subsites. I think this might be because I've attempted to add BuddyPress activity comments to the replies in the subsite blogs, so I actually WANT the subsites to know Buddypress is active.

  • If you don't have BuddyPress enabled on the other sites, it can't interfere (as it won't even run) - is this definitely the case? (i.e. not network-activated) – TheDeadMedic Dec 8 '12 at 13:26
  • @TheDeadMedic You are right. It seems buddypress IS network activated. Is it safe to deactivate it and then reactivate on just the main site, or will this result in loss of activity/group data? – AntonChanning Dec 8 '12 at 13:28
  • I'd like to say you'd be fine, but I don't know enough about BP to guarantee it. – TheDeadMedic Dec 8 '12 at 13:31
  • Well, it turns out I need to have buddypress network enabled or else all of the subsites return nothing but a blank white screen. I must have a buddypress dependency somewhere in another network enabled plugin I guess... – AntonChanning Dec 8 '12 at 14:09

The following code needs to placed in the functions.php file of any theme that has a replacement mystery man avatar. Adding it to bp-custom.php will not work in this instance.

// Use a differnt image than default mystery man
function bp_custom_set_avatar_constants() {
    define( 'BP_AVATAR_DEFAULT', get_stylesheet_directory_uri() . '/images/mystery-man.jpg' );
    define( 'BP_AVATAR_DEFAULT_THUMB', get_stylesheet_directory_uri() . '/images/mystery-man-50.jpg' );
add_action( 'bp_init', 'bp_custom_set_avatar_constants', 2 );

You then need to create an images folder in your theme containing two jpg images of your replacement images, matching the names you define in the code above. The one for BP_AVATAR_DEFAULT_THUMB should be 50px x 50px. The other should be 150px x 150px.

Not the answer you're looking for? Browse other questions tagged or ask your own question.