How to get username/display name in Buddypress?

一曲冷凌霜 提交于 2019-12-10 05:10:35

问题


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.


回答1:


You have Display name use below function:

bp_get_displayed_user_fullname()

OR

Display User Name:

bp_core_get_username($user_id)



回答2:


Display name for logged in user:

echo bp_core_get_user_displayname( bp_loggedin_user_id() );



回答3:


What about using bp_activity_user_link() ?



来源:https://stackoverflow.com/questions/11037220/how-to-get-username-display-name-in-buddypress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!