I was given the following code a while ago to make sure that my members would not have their real names show up. It worked on our old server, but I have changed servers now and for some reason it is not working, and I have some very unhappy members.
Can you please correct this code to make it work.
// Begin - Force Display Username
function force_pretty_displaynames($user_login, $user) {
$outcome = trim(get_user_meta($user->ID, 'user_login', true) );
if (!empty($outcome) && ($user->data->display_name!=$outcome)) {
wp_update_user( array ('ID' => $user->ID, 'display_name' => $outcome));
}
}
add_action('wp_login','force_pretty_displaynames',10,2);
// End - Force Display Username
Support Access is granted.
Thank you.