How to override buddypress avatars using “bp_core_fetch_avatar”?

Im using a custom WP plugin (ProUser) to upload user avatars. The avatars work perfectly everywhere on my wordpress site except for buddypress. I have been doing a lot of searching and it seems buddypress handles avatars in its own (fairly ruthless) way! Does anyone know how to override the buddypress user avatars (but not group avatars), so that these are the same as elsewhere in the instillation (eg as found on bbpress, dashboard, etc…).

As far as my reading has got me this will probably involve overriding or rewriting “bp_core_fetch_avatar” to use “get_avatar” in buddypres. I have been trying to do this but im not great with php and not getting very far. Any help would be really appreciated.

Read More

Thanks.

Related posts

Leave a Reply

3 comments

  1. As far as my reading has got me this will probably involve overriding
    or rewriting “bp_core_fetch_avatar” to use “get_avatar” in buddypres

    You would have to replace all instances of bp_core_fetch_avatar() in your templates with get_avatar(). To my knowledge, this would be the only (and best) way of doing it.

  2. Not sure if this will answer your question exactly (i’ve no experience with pro user or group avatars) but here we go..

    In bp-custom.php add..

    add_filter('bp_core_fetch_avatar_no_grav', '__return_true');
    

    This tells buddypress to ignore ‘gravatars’ and use the avatars uploaded to wordpress.

    Better explained here by the person who came up with this solution..

    https://stackoverflow.com/a/34560419/3377049

  3. Start by unhooking bp_core_fetch_avatar from the bp_get_activity_avatar calls via

    remove_filter( 'bp_get_activity_avatar', 'bp_core_fetch_avatar');
    

    and then writing & adding your own filter to bp_get_activity_avatar that leverages get_avatar.