Skip to:
Content
Pages
Categories
Search
Top
Bottom

logged in user’s avatar

  • @egerrits

    Participant

    I need to get the src for the bp->loggedin_user’s avatars. I am working on Birthdays for Events and I’d like to assign the user’s avatar to the birthday event by default.

    All core template tags seem to return an entire <img> tag, and the $bp->loggedin_user doesn’t seem to have avatar field.

    What am I missing?

Viewing 6 replies - 1 through 6 (of 6 total)
  • @egerrits

    Participant

    I got it using this:

    $avatar_file = get_usermeta( $bp->loggedin_user->id, “bp_core_avatar_v1” );

    $url = $bp->root_domain . ‘/’ . $avatar_file;

    but is there a more elegant way?

    @egerrits

    Participant

    OK, the above code works *sometimes*… but not other times… hmm…

    @sgrunt

    Participant

    maybe you are looking for this:

    <?php bp_loggedinuser_avatar_thumbnail() ?>

    @egerrits

    Participant

    @sgrunt

    No, that functions *outputs* the image, I need its source.

    @nicolagreco

    Participant

    bp_core_get_avatar( $bp->loggedin_user->id, 1, null, null, true )

    ;)

    @egerrits

    Participant

    That did the trick!

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘logged in user’s avatar’ is closed to new replies.
Skip to toolbar