Skip to:

BBpress "post_author_link" problem?

  • Korhan Ekinci


    Using 1.0.3 bp, wpmu 2.8.1 and 1.0.1 bbpress.

    I have deep integration bbpress and bp and all working ok. Just realized today that there are problems with forum “post_author_links”:

    username is “nbsmrt” and his name is “murat” and his member page is at:

    I am confused here, maybe lack of sleep past 10 days! As you see in the forum page below the avatars are “names” of the people and linked to their member page through usernames, then why is this one has no link and his username is displayed instead of his name linked to member page through username???

    post.php of bbpress is


    <?php post_author_link(); ?>

    <small><?php post_author_title(); ?></small>


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

  • Greg


    The thing is that bbPress doesn’t know that the user “nbsmrt” has BP Name “murat”.

    UPDATE: Scratch that – your display names should actually be working, and in fact I see that they are for users other than “nbsmrt”. The bit I put below is necessary if you want the author link to go back to their BP profile instead of the bbPress profile page.

    I wanted the name to be consistent everywhere, so I have a bit of common code that displays the user’s details in forum posts, blog comments, etc. Note that it requires deep integration because I am accessing BP variables inside bbPress.

    For example, here is what I do in the forum…

    First, in post.php I get the author’s details like so:

    $author_id = get_post_author_id( $post_id );
    $author = get_userdata( $author_id );
    $author_loginname = $author->user_login;
    $author_displayname = get_post_author();

    Then I call a function to display the user link, avatar and other things. Part of this function does the following:

    $author_url = _profile_url( $author_loginname );

    <div class="username">
    <a href="<?php echo $author_url ?>"><?php echo $author_displayname ?></a>

    And here is the code for the _profile_url() function:

    function _profile_url( $login_name=0 ) {
    global $bp;

    /* if no login name is specified, use logged in user */
    if ($login_name) {
    $url = $bp->root_domain . '/members/' . $login_name . '/profile';
    } else {
    $url = $bp->loggedin_user->domain . 'profile';

    return $url;

    So the user’s BP Name is always used, and it always links to their BP profile.

    My one concern about all this is that get_userdata() does a SQL query, adding one query for each author in a topic thread.

    Korhan Ekinci


    Thank you sooooo muchhh Reboot Now!

    One thing is that, still I have “nbsmrt” (username and not the name) linking to his profile (which is perfect) after your coding. How can it be solved that the name “murat” is shown and not the username.

    Thanks again for the help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘BBpress "post_author_link" problem?’ is closed to new replies.
Skip to toolbar