pyronaur
pyronaur

Reputation: 3545

How to get username/display name in Buddypress?

In buddypress default tempalte, username who has posted a certain activity is displayed like this: bp_activity_action(); But that brings much more than just the username. Is there a simpler way to get the user object/name ?

Wordpess get userdata function doesn't work, as it displays the page author, not the comment or activity author name.

Upvotes: 5

Views: 19817

Answers (3)

Ünsal Korkmaz
Ünsal Korkmaz

Reputation: 224

Display name for logged in user:

echo bp_core_get_user_displayname( bp_loggedin_user_id() );

Upvotes: 3

Chirag Patel
Chirag Patel

Reputation: 506

You have Display name use below function:

bp_get_displayed_user_fullname()

OR

Display User Name:

bp_core_get_username($user_id)

Upvotes: 7

Ben Poulson
Ben Poulson

Reputation: 3525

What about using bp_activity_user_link() ?

Upvotes: 0

Related Questions