Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to Link to Member Profile in Comments


  • Henry
    Participant

    @henrybaum

    A former thread is listed as resolved and it’s not exactly. I’m trying to link to members profiles on comments when they’re logged in. It was suggested to use:

    <?php echo bp_core_get_userlink( $comment->user_id, false, true ) ?>

    But not sure which php file to use – and where in the file. Not working with what I’ve done in single.php or comments.php.

    Site is: http://www.selfpublishingreview.com.

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

  • Xevo
    Participant

    @xevo

    The latest buddypress 1.2 default theme has this built in, it uses a custom wp_list_comments template callback. It’s really easy to do. Just google if you want to know more.

    bp_core_get_userlink( $comment->user_id );

    Use that in your comment template and you’ll get a link including anchors to your buddypress profile.


    Henry
    Participant

    @henrybaum

    What do I add to my theme from this?

    https://svn.buddypress.org/trunk/bp-themes/bp-default/comments.php

    That code doesn’t show up there.


    Henry
    Participant

    @henrybaum

    Anyone? Googling just comes up with threads here with people asking how to do this.


    joshmac
    Participant

    @parkstreet

    You may need to turn this:

    <div id="respond">

    <div class="comment-avatar-box">
    <div class="avb">
    <?php if ( bp_loggedin_user_id() ) : ?>
    <a href="<?php echo bp_loggedin_user_domain() ?>">
    <?php echo get_avatar( bp_loggedin_user_id(), 50 ); ?>
    </a>
    <?php else : ?>
    <?php echo get_avatar( 0, 50 ); ?>
    <?php endif; ?>
    </div>
    </div>

    into this

    <div id="respond">

    <div class="comment-avatar-box">
    <div class="avb">
    <?php if ( bp_loggedin_user_id() ) : ?>
    <a href="<?php echo bp_core_get_userlink( $comment->user_id ); ?>">
    <?php echo get_avatar( bp_loggedin_user_id(), 50 ); ?>
    </a>
    <?php else : ?>
    <?php echo get_avatar( 0, 50 ); ?>
    <?php endif; ?>
    </div>
    </div>

    You can try that out to see if that works for you.


    Henry
    Participant

    @henrybaum

    Thanks, but it didn’t do it. That left some stray code beneath the comment box. I don’t actually have <div class=”comment-avatar-box”> in my theme.

    This just puts an unlinked http:// for the member beneath the comments:

    <?php echo bp_core_get_userlink( $comment->user_id, false, true ) ?>

    Anything else to add to that without the avatar code?


    joshmac
    Participant

    @parkstreet

    Yes, try this instead. You may need to tweak it a little, but I believe it will give you the link you are looking for. You will need to add the beginning bracket “<” and the ending one “>”.

    a href="<?php echo bloginfo('home'); ?>/<?php echo BP_MEMBERS_SLUG ?>/<?php the_author(); ?>"><?php bp_post_author_avatar(); ?></a

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to Link to Member Profile in Comments’ is closed to new replies.
Skip to toolbar