WordPress.org

Support

Support » Plugins and Hacks » change default display-name

change default display-name

  • hi,
    in version 3.0.1, the default display-name of new users is the login-name.
    I’m searching for a solution to display by default their firstname and lastname.
    I tried already some suggestions from other forums but nothing worked for me.

    anybody a suggestion?
    thanks

Viewing 15 replies - 1 through 15 (of 23 total)
  • Well…I was about to ask the same thing…I would like to have the full name both for posts and comments.

    Which files are we supposed to modify?

    Thank you

    katemgilbert

    @katemgilbert

    I am also searching for a solution to this. It seems there are a couple open threads but no viable answers.

    I tried re-ordering the drop-down list in /wp-admin/user-edit.php as suggested in another thread, but it didn’t work…

    Tevya

    @thefiddler

    I would like to do this as well. There is this thread (closed): http://wordpress.org/support/topic/change-newly-registered-users-display-name-publically-as-default?replies=7 that has what seems to be a good fix, but may need to be updated if the latest version of WP changed any of the files you have to alter to implement the fix. I’d really really like to see a plugin that does this so you don’t have to modify WP itself and risk loosing the functionality in an update to the core.

    Seems I’m not the only one by looking at this thread, that one, and all the ones linked to in that one.

    I’ll pledge a $15 donation to the dev that puts together a plugin. If a few people join me, I’m sure it would be worth somebody’s time.

    I am also lookig for the same solution. I want the new users display name set to their first plus last name and not the username. Also, I don’t want user’s the ability to change this.

    It would be wonderful if somebody can do this.

    @geoffcrow I agree, an option to disable it from the user profile would be nice too.

    Based on all the other threads over the past couple years, thought a lot more people would post showing support for this and that we could get 5-10 people pledging $10-$20 to make it happen. Maybe free is the only currency around here?

    If so, is there something else we could do to make this happen?

    I am willing to pay but I guess there not that much interest in such a functionality.

    In the mean time I have included this as Rule for my users to register their First and Last name as their username. They can add numbers or dash only.

    I’m also interested in being able to force new users publicly displayed name into being “Firstname Lastname”.

    esmi

    @esmi

    Forum Moderator

    This is not the place to discuss paid work.

    Well, if someone makes a plug in for it and who is using the plug in is willing to make a donation, there is nothing wrong….

    esmi

    @esmi

    Forum Moderator

    If you want to make a donation for specific work, please contact the plugin developer privately. This is not the place to discuss it.

    I have this in my header file. Simply checks if that current user’s display name is set to teh way I want it and if not changes it:

    <?php
    $showName = $current_user->first_name . " " . $current_user->last_name;
    echo "s: " . $showname . " d: " . $current_user->display_name;
    if ($current_user->display_name != $showName) {
    update_user_meta($current_user->ID, 'display_name', $showName);
    }?>

    I have it in a member section, so you may want to validate that the user is logged in first.

    Great work joseffb!

    But don’t forget that if you run this code in functions.php or within a plugin you’ll probably have to fetch the current_user as an object first.

    Also, since the select in the profile form will break by forcing the setting it might be a good idea to hide that option entirely.

    Revised example (place the following in functions.php or in a plugin):

    //force display-name of users to Firstname Lastname
    add_action('admin_head','force_pretty_displaynames');
    function force_pretty_displaynames() {
    	if (is_admin()) {
    	   $current_user = wp_get_current_user();
    	   if ($current_user->display_name != $current_user->first_name." ".$current_user->last_name) update_user_meta($current_user->ID, 'display_name', $current_user->first_name." ".$current_user->last_name);
    	   echo '<style type="text/css">form#your-profile label[for="display_name"], form#your-profile select#display_name   { display:none;}</style>';
    	}
    }

    If anyone got a better solution for filtering the profile-form rather than hiding stuff with CSS please contribute!

    @carlthome Help me understand this (I’m not a programmer, but can sorta read code).

    Will this work with all existing users? Or will it only force new users to this setting? Also, when you say it will break the profile form if it is forced, does that mean if the user selects something else for their display name?

    As for hiding the option with CSS, that’s not too difficult with the plugin Adminimize, you can see how I did it here: http://awesomescreenshot.com/015aofbc8

    Does anyone else find it super annoying that topics on this forum get closed after a time, and also that there is no way to directly message another user?

    I found this thread, that seems to have a solution (again I’m not a programmer, so I don’t completely understand it all).

    But its closed, so there’s no way to ask further questions. And since there’s no way to directly message users, I can’t ask the authors of those posts. So my question to all of you is: can their solution be put into a plugin or something? So we’re not modifying the WP files.

    Also, with a plugin like Register Plus Redux, you can force users to put in First and Last names at registration (though the last post has a solution if you don’t want to do that).

    It will work for all existing users provided they log in at least once. Same goes for new users: change goes in effect upon log in.

    The profile form will work as before apart from the “Display Name”-setting. The reason being that when a user attempts to select a different Display Name, upon sending the form it will revert to the forced setting.

    I’ve already included a CSS-hiding solution in my example so there should be no worries.

    However, I’d much prefer a proper removal of the drop-list from the form rather than hiding it with CSS. Any suggestions?

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘change default display-name’ is closed to new replies.
Skip to toolbar