ysiggen (@ysiggen)

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • In reply to: Fetch different avatar

    ysiggen
    Participant

    @ysiggen

    Too late to edit my reply, I’d like to point out the fact that I was looking in the wrong area for replacing the wp avatar (with the bp one) as obviously in a forum, the avatar of each reply is attached to the… reply!

    That way I added a filter on the bbp_get_reply_author_avatar method instead of the bbp_get_current_user_avatar one.

    Personally, I’m not done as I am going to track down every part of my website where the wrong avatar gets displayed (which obviously means going through the wordpress code), but that’s not a bbpress concern anymore.

    (I don’t know if there is like a “resolved” mark to give or something, but I’m all done with this topic 🙂 )

    In reply to: Fetch different avatar

    ysiggen
    Participant

    @ysiggen

    Okay so I am coming back here as I resolved it (it was quite easy actually, I am just very new to wordpress and also php programming).

    I just had to use the bp_core_fetch_avatar() function instead of the get_avatar() one.
    So, I had to call the correct function at the correct location and that’s all. Here is what I put in my function.php :

    //Make bbpress use the buddypress avatar instead of the wp one
    function bbp_get_bp_reply_author_avatar( $reply_id = 0, $size = 40 ) {
                    $reply_id = bbp_get_reply_id( $reply_id );
                    if ( !empty( $reply_id ) ) {
                            // Check for anonymous user
                            if ( !bbp_is_reply_anonymous( $reply_id ) ) {
                                    //Below is the old line
                                    //$author_avatar = get_avatar( bbp_get_reply_author_id( $reply_id ), $size );
                                    //Below is the new line
                                    $author_avatar = bp_core_fetch_avatar( array( 'item_id' => bbp_get_reply_author_id( $reply_id) ) );
                            } else {
                                   // $author_avatar = get_avatar( get_post_meta( $reply_id, '_bbp_anonymous_email', true ), $size );
                                    $author_avatar = bp_core_fetch_avatar( array( 'item_id' => get_post_meta( $reply_id, '_bbp_anonymous_email') ) );
    
                             }
                    } else {
                            $author_avatar = '';
                    }
    
                    return $author_avatar;
            }
    add_filter('bbp_get_reply_author_avatar', 'bbp_get_bp_reply_author_avatar');
    In reply to: Fetch different avatar

    ysiggen
    Participant

    @ysiggen

    Now that you state the obvious I didn’t even think of looking around that. Yes, BP’s profile gets displayed when someone clicks on a member while browsing the bbpress forums.

    The thing is, I guess, that the wp profile image stays the default and “true” one. Ideally, either wp should sync its avatar with BP or the other way around (BP fetches wp avatar and uses that one).

    Now as I’d like to keep it as it’s built, since it is quite good looking already, I mean I’d like to fully use the BP profile (that bbpress redirects to, as you pointed out), I’m not too sure of what would be the fastest or/and easiest:

    • Do the wp profile images gets synced with the BP profile image (since it has one on its own)
    • Tell bbpress to go fetch the BP profile image, since my users only have access to their BP profile

    I looked for plugins that do either, already, I didn’t quite find my fit yet. And I was hoping someone would have done something similar or knows enough to talk me roughly through what I need to do in order to achieve what I want to do.

    Either way, if anyone has some clue, that would be nice.

    If there is no luck at it, I guess I’ll be trying to do it by myself, but as I am no php expert and don’t really know much about either wp, bbpress or BP, I’ll have to get going with more reading first.

    Thank’s for your reply Setphen, it lit a bulb on my side.

Viewing 3 replies - 1 through 3 (of 3 total)