Support » Fixing WordPress » Change Newly registered users “display name publically as” default?

  • When new users create accounts, the display name defaults to their username, not their “firstname lastname” as I’d prefer. I don’t expect my users will be saavy enough to make the change.

    How do I change the default display name?

    Thanks in advance
    Michael

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’ll second this request!!
    I want to make “First Name && Last Name” the default display name…

    Thanks
    ~Levi

    And along with us…

    http://wordpress.org/support/topic/148622
    http://wordpress.org/support/topic/151108
    http://wordpress.org/support/topic/199672

    Possible solution for the more tech savvy (still think this should be an admin panel option):
    http://wordpress.org/support/topic/188168

    Good luck

    Scratch that “possible solution”… It’s not! 😐

    Someone please help? 🙁

    Ok, a fix for this:

    1. Change registration.php (/wp-includes).
    BEFORE

    if ( empty($display_name) )
    		$display_name = $display_name;
    	$display_name = apply_filters('pre_user_display_name', $display_name);

    AFTER

    if ( empty($display_name) )
    		$display_name = $first_name.' '.$last_name;
    	$display_name = apply_filters('pre_user_display_name', $display_name);

    This change will make the default write to the DB on a user creation be “Firstname Lastname” instead of their login ID. But this isn’t enough…

    2. By default, on the profile edit page, the first line of the drop-down menu (and the default therefore) is, again, user login id. So when a user changes something on that page, it will write it back to the display name.
    To solve this, we edit user-edit.php (/wp-admin) and move the line:

    $public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;

    to be the first line, right under:

    $public_display = array();

    BTW, not sure if this last chance is absolutely crucial, but at least this way it shows up correctly on the user edit page. 🙂

    Hope this helps someone else.
    Have fun guys! 🙂

    Hi levifig, this did help.

    Other members – where can I suggest this as a core feature, or a plugin idea ?

    Tal

    Levifig,
    But, what if the first and last names are empty?
    It could happen that the person who registered the new user didn’t enter these values in, so you could add a little check like this:

    if ( empty($display_name) ) {
    		if ( !empty($first_name) && empty($last_name))
    			$display_name = $first_name;
    		if ( !empty($last_name) && empty($first_name))
    			$display_name = $last_name;
    		if ( !empty($first_name) && !empty($last_name))
    			$display_name = $first_name.' '.$last_name;
    		}
    	if ( empty($display_name) )
    		$display_name = $user_login;
    	$display_name = apply_filters('pre_user_display_name', $display_name);
    		}
    	if ( empty($display_name) )
    		$display_name = $user_login;
    	$display_name = apply_filters('pre_user_display_name', $display_name);

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change Newly registered users “display name publically as” default?’ is closed to new replies.