Skip to:
Content
Pages
Categories
Search
Top
Bottom

author avatar inside the post

  • Profile photo of Johnny Two Hands
    Johnny Two Hands
    Member

    @johnny-two-hands

    I’m looking to see the author’s avatar inside the post (single.php)

    I have tried:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <?php bp_wire_post_author_name() ?>

    but it does not work.. you see the same avatar for all authors :(

    I guess there may be some problem with the loop

    any help would be appreciated, thx

Viewing 8 replies - 1 through 8 (of 8 total)
  • Profile photo of Johnny Two Hands
    Johnny Two Hands
    Member

    @johnny-two-hands

    any help… :/

    Profile photo of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

    Get the latest trunk first.

    <?php bp_post_author_avatar() ?>

    <?php bp_comment_author_avatar() ?>

    Profile photo of Johnny Two Hands
    Johnny Two Hands
    Member

    @johnny-two-hands

    i looked function u’ve done and now im using this:

    <?php echo bp_core_get_avatar( $post->post_author, 1 );?>

    because <?php bp_post_author_avatar() ?> doesn’t work at all, u can see here:

    http://img34.picoodle.com/img/img34/3/12/5/f_bppostauthom_266aa82.gif

    thanks :)

    Profile photo of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

    That will also work, it’s just a little more difficult. The function I mentioned before should work now, I left some debug code in there.

    I got my avatar to show up in the single post using <?php bp_post_author_avatar() ?>

    but what code would i need to add to make it click into the authors profile in buddypress?

    Thanks for your help!

    Also, amazing work on buddypress Andy!

    Profile photo of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    <div class="item-avatar">
    <a href="<?php echo bp_core_get_userlink( $user->user_id, false, true ) ?>">
    <?php echo bp_core_get_avatar( $user->user_id, 1 ) ?></a>
    </div>

    The above is from bp-core-directory-members.php. You’ll have to put `$post->post_author in there.

    thanks burtadsit!!!

    Profile photo of yu
    yu
    Participant

    @gerbilo

    I use such code for post author url for BP:

    <a href='/members/<?php the_author(); ?>'><?php the_author(); ?></a>

    But i can’t get post authors username used in BP, not default login name from WP..

    For example i have WP the_author = admin, but BP post_author = yu. My question is how to get bp_post_author name?

    I got this func, but can’t get it work for me:

    function bp_post_author( $echo = true ) {
    global $posts_template;

    if ( $echo )
    echo apply_filters( 'bp_post_author', bp_core_get_userlink( $posts_template->post->post_author ) );
    else
    return apply_filters( 'bp_post_author', bp_core_get_userlink( $posts_template->post->post_author ) );
    }

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘author avatar inside the post’ is closed to new replies.
Skip to toolbar