Skip to:
Content
Pages
Categories
Search
Top
Bottom

username function

Viewing 5 replies - 1 through 5 (of 5 total)
  • @tomdebruin

    Participant

    Have a look at bb-includes/functions.bb-template.php you’ll see the functions function get_post_author( $post_id = 0 ) and function post_author_link( $post_id = 0 ).

    You’ll need to recreate those in a plugin or in your functions file to use $user->user_login instead of $user->display_name.

    Have a look at profile.php in your theme to see how it is generated there. But remember that on post.php you’ll have to pass in the ID of the post to get the username otherwise you’ll be fetching details on the logged in user rather post author.

    I hope that helps, good luck.

    An easier way would be to take away the ability to allow change of display name. Then it will default to username anyway. Have a look at topic/help-with-basic-command-to-add-new-profile-fields if that’s the avenue you want to take. If you do, don’t forget to set everyones ‘nicename’ back to what their username is.

    @arturo84

    Participant

    in profile.php i’ve found this <?php echo get_user_name( $user->ID ); ?> but in post.php don’t print nothing… i don’t know bbpress very good to recreate the function :(

    any idea for a simplest way?

    thanks!

    @nightgunner5

    Member
    <?php
    $user = bb_get_user( get_post_author_id() );
    echo $user->user_login;
    ?>

    @arturo84

    Participant

    u”re the best! thanks Ben!

    @tomdebruin

    Participant

    oh yeah. Doh! Cheers, Ben L.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar