Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How to get topic starter’s username?


r-a-y
Keymaster

@r-a-y

Add the following to your theme’s functions.php:

`function bp_get_the_topic_post_poster_username() {
global $topic_template;

if ( !$link = bp_core_get_user_domain( $topic_template->post->poster_id, $topic_template->post->poster_nicename, $topic_template->post->poster_login ) )
return __( ‘Deleted User’, ‘buddypress’ );

return apply_filters( ‘bp_get_the_topic_post_poster_username’, ‘post->poster_login . ‘”>’ . $topic_template->post->poster_login . ‘‘ );
}`

Then use the following in your template:

`if ( function_exists( ‘bp_get_the_topic_post_poster_username’ ) ) echo bp_get_the_topic_post_poster_username();`

This will only work in a forum topic loop.

Skip to toolbar