Skip to:
Content
Pages
Categories
Search
Top
Bottom

logged in user’s avatar


  • Erwin Gerrits
    Participant

    @egerrits

    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)

  • Erwin Gerrits
    Participant

    @egerrits

    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?


    Erwin Gerrits
    Participant

    @egerrits

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


    Sgrunt
    Participant

    @sgrunt

    maybe you are looking for this:

    <?php bp_loggedinuser_avatar_thumbnail() ?>


    Erwin Gerrits
    Participant

    @egerrits

    @sgrunt

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


    nicolagreco
    Participant

    @nicolagreco

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

    ;)


    Erwin Gerrits
    Participant

    @egerrits

    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