Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Display @mention name in activity comments meta

  • @colin101

    Participant

    Hi,
    So I’ve been looking for this for a little while now, and although I did find snippets of code that seemed close enough, I haven’t been able to adapt them to do what I want.

    To be quite clear, I want to be able to display the name to be used to @mention a user in the activity comment meta, next to the avatar, so users can just copy and paste it to mention someone. A bit like Twitter has the @mentionname next to the display name.

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

    Moderator

    Try <?php echo bp_core_get_username( bp_displayed_user_id() ); ?>

    @colin101

    Participant

    Thanks for you reply, but that doesn’t seem to work. It doesn’t display anything.

    I find this quite tricky, actually: I’ve tried a number of variations of the same flavor, but nothing seems to work. It’s easy enough to get the display name, but the user_login or nicename is… challenging. In comments meta, at least.

    If I were smarter, I could probably put the info included at the link to good use, but I am what I am…
    https://buddypress.org/support/topic/how-to-get-user-profile-data/

    @henrywright

    Moderator

    Try this instead:

    <?php echo bp_core_get_username( bp_get_activity_comment_user_id() ); ?>

    That should work. The problem was my use of bp_displayed_user_id().

    @colin101

    Participant

    Yes! That’s the winner! I’m going to frame it and hang it on my wall.

    Thanks a whole bunch!

    @henrywright

    Moderator

    @colin101 hehe! Glad you got it working in the end.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Display @mention name in activity comments meta’ is closed to new replies.
Skip to toolbar