Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to display @username in bbPress?

  • I wish to display the @username next to the name of the creator of the post. Trying several different combinations but not coming up with anything. How would I call and display the @username of the creator of the post in bbPress?

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

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    Something similar to:

    $user = get_userdata( $user_id );
    if ( !empty( $user->user_nicename ) ) {
        $user_nicename = $user->user_nicename;
    }

    …should do it. You’ll need to sort out the context of how to get the $user_id though.

    First of all, thank you for your help.

    Now, I came up with…

    $user = get_userdata( bbp_reply_author_id() ); 
    

    if ( !empty( $user->user_nicename ) ) {
    $user_nicename = $user->user_nicename;
    }

    … but it returns the user ID number, not the nicename. Any further thoughts?

    • This reply was modified 12 years, 3 months ago by Good in Today.
    • This reply was modified 12 years, 3 months ago by Good in Today.
    • This reply was modified 12 years, 3 months ago by Good in Today.
    • This reply was modified 12 years, 3 months ago by Good in Today.
    • This reply was modified 12 years, 3 months ago by Good in Today.
    • This reply was modified 12 years, 3 months ago by Good in Today.

    Geesh, sorry for all the edits but I guess I don’t get your insert code thing. Anyway I used bbp reply author id to pull the id but this all together returns just that, the author id number. Any further ideas?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Because bbp_reply_author_id() does not return, it echo’s.

    Use bbp_get_reply_author_id() instead. It will return a value.

    get functions always return, their counterparts always echo. 🙂

    Thank you, John. I swapped those and it returned nothing. But when I added an echo to actually display the value it works as I wished for it too, so thank you for your help! 🙂


    Sambora5150
    Participant

    @sambora5150

    Hello Foks


    @goodintoday
    or somebody else can tell me exactly the code and where to apply it to show the  @username with the creator of the post


    RiGoRmOrTiS_UK
    Participant

    @rigormortis_uk

    I would really like to get the @username displayed under a person’s name next to the avatar; the same as these forums; some of my forum users have changed their display names and its making it less user friendly when people try to use @username to get someone’s attention through mentions.

    I have read all the info from @johnjamesjacoby above; but it kinda went over my head; ideally I’d love to know exactly what php file to edit and what code to insert and at what specific line/area of said PHP file 🙂 if possible!

    Hope someone can help! thanks!


    daivdwhite
    Participant

    @daivdwhite

    Have the same problem,I was attracted by the title!
    http://www.facebook.com


    palmdoc
    Participant

    @palmdoc

    Any solution? Thanks


    Marcos
    Participant

    @piskorz

    Hi, in the bbpress forum works.
    Some way to add this option in bbpress next release?

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