Skip to:
Content
Pages
Categories
Search
Top
Bottom

Please help – Use WordPress Avatars not BuddyPress?

  • Avatar of Martin Waller
    Martin Waller
    Participant

    @multimartin

    Hello all,

    I currently have a wordpress multisite installation which I use for a school. We have integrated Google Apps for Education with WordPress and manage avatar pictures through Google Apps. We have a plug-in which pulls the profile pictures from GApps into WordPress.

    I have just installed BuddyPress onto one of our sites and notice that BuddyPress has overridden the WordPress avatars with the ‘Mystery Man’ logo. Is there any way in which you can switch off BuddyPress avatars and use the WordPress ones? I have tried disabling things like Extended Profiles and ‘allow users to upload avatars’ but this has not worked.

    Could anyone possibly help?

    Many thanks,
    Martin

Viewing 13 replies - 1 through 13 (of 13 total)
  • Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    Hi @multimartin

    I just tried searching the WP plugin repo and came across an old plugin that may be of some help. Take a look at Remove Avatars

    Avatar of Martin Waller
    Martin Waller
    Participant

    @multimartin

    Hi @henrywright

    Thanks for the reply. I checked out that plug-in and it just removes the avatar from displaying on the BuddyPress profile – it still actually retains the ‘Mystery Man’ style avatar as opposed to using the one set in WordPress.

    Martin

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    Humm.. not helpful then. In that case we might have to try doing it manually. Perhaps try disabling the filter which replaces the WP avatars with BP avatars. For example, add this to your theme’s functions.php file:

    remove_filter( 'get_avatar', 'bp_core_fetch_avatar_filter', 10, 5 );

    I think you can disable the Gravatar fallback as well with this:

    add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' );

    If that doesn’t work, you may need to replace all occurrences of bp_core_fetch_avatar() with get_avatar() in your templates. But cross that bridge when you come to it.

    Ref: http://codex.wordpress.org/Function_Reference/get_avatar

    Avatar of Martin Waller
    Martin Waller
    Participant

    @multimartin

    Hi @henrywright

    Sadly this hasn’t worked either. I added both lines to the functions.php of the child theme and it still displays the ‘Mystery Man’ :(

    Avatar of Martin Waller
    Martin Waller
    Participant

    @multimartin

    In the back-end it’s also displaying the avatars as Mystery Men too.

    Avatar of Martin Waller
    Martin Waller
    Participant

    @multimartin

    Actually scratch that last post – it’s now displaying the avatars as the WordPress avatars in the back-end but not the front end!

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    Actually scratch that last post – it’s now displaying the avatars as the WordPress avatars in the back-end but not the front end

    In that case, I think we’ve just crossed that bridge hehe. i.e the next step will be to replace all instances of bp_core_fetch_avatar() in your front-end templates with get_avatar()

    Avatar of Martin Waller
    Martin Waller
    Participant

    @multimartin

    Thanks @henrywright

    I’m not entirely sure that my front-end template actually references bp_core_fetch_avatar() as it is not a BuddyPress theme but rather a regular WordPress theme (Responsive Pro).

    Martin

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    It will do, sort of indirectly, actually. For more info on how it works, check out the Template Hierarchy article.

    Avatar of Martin Waller
    Martin Waller
    Participant

    @multimartin

    So I’m checking the theme files and not the BuddyPress files? How would it be referenced in the theme files. Sorry – bit of a beginner with this and appreciate your help :)

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    If your theme doesn’t explicitly use BuddyPress templates then the default templates will be used. For a quick look at the templates check out the GitHub repo.

    I’m guessing your theme doesn’t explicitly use the templates so what you’d have to do is create them yourself. The general idea is to create a folder called buddypress inside your theme and then add the templates you’d like to customise to that folder. So for example, you’d end up with /wp-content/themes/your-theme/buddypress/. Everything goes inside there.

    Avatar of Martin Waller
    Martin Waller
    Participant

    @multimartin

    Okay, so searching that GitHub repo there is only one file under the bp-themes/bp-legacy/buddypress folders which mentions bp_core_fetch_avatar() (but lots within the core BuddyPress code. So I just need to replace the reference in that one file and add it to by child theme under a BuddyPress folder and it should work?

    Avatar of henrywright
    henrywright
    Moderator

    @henrywright

    There might actually be more things you’d need to do. For example, the bp_get_message_thread_avatar() function uses bp_core_fetch_avatar() so you would need to filter that using bp_get_message_thread_avatar etc.

    Unless someone else knows of an easier way, it seems as though it’ll be a big task of going through everything. You’d also need to be comfortable with PHP.

    Alternatively, you could try disabling avatars by adding this to your bp-custom.php file

    define( 'BP_SHOW_AVATARS', false );

    Note: I’ve not tested that, I’m just going on what I see at the beginning of the bp_core_fetch_avatar() function. i.e:

    // If avatars are disabled for the root site, obey that request and bail
    if ( ! buddypress()->avatar->show_avatars )
       return;
Viewing 13 replies - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.