Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to access Buddypress avatar not on profile page

  • Avatar of DUNKYMONKEY
    Conor "DUNKYMONKEY"
    Participant

    @dunkymonkey

    Hi I am developing a new site for a client. I’m trying to crate a sidebar for logged in users with their avatar, username, notifications and the Buddypress pages. I’m trying to add the avatar with the code below:

    <?php
    $userid = bp_loggedin_user_id();
    $avatarurl = bp_core_fetch_avatar( array( ‘item_id’ => $userid, ‘html’ => false ) );
    echo $avatarurl;
    ?>

    This works on Buddypress profile page but no other page, is there anything I need to include in the header. This is a personal theme not the Buddypress default. I’m using WordPress 3.8.1 and Buddypress 1.9.2. The site is beta.hyperjake.com

    Thanks for your help
    Conor

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of henrywright
    henrywright
    Participant

    @henrywright

    Hi

    Try:

    echo bp_core_fetch_avatar( array( 
        'alt' => 'Profile picture of ' . bp_get_loggedin_user_fullname(),
        'class' => 'avatar', 
        'width' => 50, 
        'height' => 50, 
        'item_id' => bp_loggedin_user_id(), 
        'type' => 'full', 
        'title'=> bp_get_loggedin_user_fullname()
    ) );
    Avatar of DUNKYMONKEY
    Conor "DUNKYMONKEY"
    Participant

    @dunkymonkey

    Great that worked.

    Thank you so much :)

    Conor

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

You must be logged in to reply to this topic.