Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show username instead of full name / display name


  • thomaslindvig
    Participant

    @thomaslindvig

    I want my users in the forum to appear semi-anonymously, so they only appear with their usernames, not their real names (full name / display name), how do I change that? I don’t mind coding snippets.

    Tantraforum.dk forside


    WP 5.2.4
    bbpress 2.5.14
    theme Spacious by themegrill 1.6.6

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

  • Robin W
    Moderator

    @robin-w

    untested, but this might do it

    add_filter( 'bbp_get_reply_author_display_name' , 'rew_reply_change_to_login', 10 , 2 ) ;
    
    function rew_reply_change_to_login ($author_name, $reply_id) {
    	// Get the author ID
    	$author_id = bbp_get_reply_author_id( $reply_id );
    	$author_name = get_the_author_meta( 'user_login', $author_id );
    return $author_name ;
    }
    
    add_filter( 'bbp_get_topic_author_display_name' , 'rew_topic_change_to_login', 10 , 2 ) ;
    
    function rew_topic_change_to_login ($author_name, $topic_id) {
    	// Get the author ID
    	$author_id = bbp_get_topic_author_id( $topic_id );
    	$author_name = get_the_author_meta( 'user_login', $author_id );
    return $author_name ;
    }

    let me know


    thomaslindvig
    Participant

    @thomaslindvig

    Very thanks!
    So far it works


    Robin W
    Moderator

    @robin-w

    great!

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