BuddyDev

Search

Buddypress – Hiding or removing the username

  • Participant
    Level: Initiated
    Posts: 1
    Tina on #3526

    I have people testing my Buddypress social network and they are complaining that the double names displaying across the site is very confusing and annoying.
    I also don’t like the idea of members username that is used to login, can be seen. It also means that people can see my admin name used to login into WordPress.
    The ability to change display names results in members possibly sharing the same names. Not really appropriate for a social network.

    Is it possible to do any of the following?

    1.Set BP to only show a member’s display name across the entire site including the @name on profile and @mention.

    2.Change the username field on the registration form and login form to say User Login instead. So that I may have a user login field (used to login) and a username field (the display name)

    3.Stop members from having the same name by having an error appear when a display name is already taken.

    Any help would be much appreciated and thanks in advance.

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #3531

    Hi Tina,
    Welcome to BuddyDev.

    I may not have understood your requirement completely, but here is what you can do. Please put the following code in bp-custom.php

    1. Change @ name to display name for logged in/displayed user

    
    
    function buddydev_show_fullname_for_displayed_user( $username ) {
    	return bp_get_displayed_user_fullname();
    }
    add_filter( 'bp_get_displayed_user_username', 'buddydev_show_fullname_for_displayed_user' );
    
    function buddydev_show_fullname_for_loggedin_user( $username ) {
    	return bp_loggedin_user_fullname();
    }
    add_filter( 'bp_get_loggedin_user_username', 'buddydev_show_fullname_for_loggedin_user' );
    
    

    2. Change the label username to User Login

    
    //this is a bad idea, use translation instead
    function buddydev_change_login_labels( $translated_text, $text, $domain ) {
    	
    	if ( $text =='Username' ) {
    		$translated_text = 'User Login';
    	}
    	
    	return $translated_text;
    }
    add_filter( 'gettext', 'buddydev_change_login_labels', 20, 3 );
    
    

    For your 3rd step, I believe that is not required. Any number of people can have same name and will use it for display name. So, I don’t think that is a good idea.

    Hope that helps.
    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    Tina on #3702

    Apologies for not explaining more clearly.

    My site will not be using members real names, members will be allowed to choose a nickname (Smiley101, for example) hence the reason I need to implement something to stop them from using the same display name (the name that they are allowed to change in their profile).

    I only want to display their nickname across the entire site, because using both the username ( used to log into site/wordpress} and display name /nickname is confusing my members.

    My original idea was have members use the username to login and have the display name/ nickname display across the entire site.

    I tried both of the code you suggested, they are returning an error (Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home…)

    Thank you for taking the time to help me.

You must be logged in to reply to this topic.

This topic is: not resolved