Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to definitively display Buddypress avatars in BBPress???

  • I know there have been a million and one posts/questions about this. The trouble is, there is a lot of conflicting instructions… and it is scattered all over the place. I feel like I am very close, but cannot for the life of me get this to work…

    So far, I’ve successfully done the WordPress “deep integration.” I tested this by putting some random Buddypress tags in BBpress template files. They worked fine. Here’s where I’m running into some trouble:

    I am trying to display the exact same avatar that appears in Buddypress for a particular user in BBPress as well. I tested the following template tags on my profile.php (in my BBpress theme):

    bp_member_avatar(); no result (blank)
    bp_core_fetch_avatar(userid); -> no result (blank)
    bp_core_get_avatar(userid); -> function undefined
    get_avatar(userid); -> this shows the wordpress avatar, not the buddypress one

    Help. Which is the correct tag to use? I need to be able to display an avatar based on user id. That is all. Surely that’s not impossible?

    If there are no existing tags that will do this, can someone just tell me how to do a database query? I found this post http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/where-are-the-avatars/ but don’t know where to go from there…

    Thanks in advance!

    Running: WP MU 2.9.2, Buddypress 1.2.3, and BBPress 1.0.2

Viewing 5 replies - 26 through 30 (of 30 total)
  • Hello,

    i am writing my own plugin which needs avatars from BuddyPress. Plugin is pulling members IDs and some other info they’ve putted in their profiles from the database, but can’t figure out how to echo avatar based on the user’s ID. Any help with this?

    Thanks

    Ok, i’ve managed to do it with:
    global $bp;
    bp_core_fetch_avatar( array( ‘item_id’ => $id, ‘type’ => ‘full’, ‘width’ => ’75’, ‘height’ => ’75’, ‘html’ => ‘false’ ) )

    If somebody needs the same thing he can try this lines, maybe it will help. :)


    chicoi
    Participant

    @chicoi

    hm… Thanks ray for the code.. I have used the one that is placed on the functions.php.

    But i have a little problem.. When i resized the image.. it is pixelated.. when i inspect the element.. It is fetching the bpthumb..
    I also want to change the Avatar in the profile.php using the same avatar as the buddypress too…
    Can anyone help me fix this please? thanks a lot!


    julesmoretti
    Member

    @julesmoretti

    @r-a-y

    Love your script for bbpress. It worked great for the post authors, but does not seem to work so well for the topic author, would you know why by any chance?

    The current code line for the topic author avatar is as such:
    topic_poster), 48, ‘identicon’ ); ?>

    You can check out the site at gradiduncut.com

    And everything under the avatar admin setting is set to on.

    Thank you for your help, so far its been a huge help.

    Best


    TesterGP
    Participant

    @testergp

    Hi,

    I have WP 3.6.1., BuddyPress 1.9.1., bbPress 2.5.2., Cubepoints 3.2.1. and CubePoints Buddypress Integration 1.9.8.9..
    I want to display the avatars in the CubePoint Top Users Widget.
    I tried many found solutions on several forums, just to mention some of them:
    1) adding code to cp_hooks.php
    $y[‘avatar’] = get_avatar($user->ID,$size = ’30’);
    $string = str_replace(‘%avatar%’, $y[‘avatar’], $string);
    And add %avatar% in the text field of the widget. Empty Avatars appears of the top users while they all have avatars uploaded in their profile.
    2) I tried the solution of r-a-y
    Added functions.php to the template/default folder of bbPress. But it is still not working (settings>discussions is well set up). BUT I noticed that all avatars have a path like /wp-content/uploads/avatars/#/’. $author_id. Between /avatars/ and the author_id there is a number that is different from one member to another. How can I adadpt the path to fit it?
    3) I mixed solution 1 with bp code and added in cp_hooks.php
    $y[‘avatar’] = get_avatar( bbp_get_current_user_id(), ’30’ );
    This display of course the same avatar for all top users in the widget, naimly the avatar of the logged in user.
    4) is a mixed of 1) and r-a-y solution
    added in cp_hooks.php $y[‘avatar’] = get_avatar(bb_bp_avatar($user->ID), ’30’ );
    and added functions.php to the my-template folder of bbPress, but it is not working.

    Anny help appreciated.
    T.

Viewing 5 replies - 26 through 30 (of 30 total)
  • The topic ‘How to definitively display Buddypress avatars in BBPress???’ is closed to new replies.
Skip to toolbar