Allowing registration with the email as username
-
For a customer I need to enable the registration with only the email address provided, so it acts as username too.
I tried to hook in to the registration steps in this way:
function email_as_username ($user_login="", $user_email="", $errors=""){ $user_login = $user_email; return $user_login; }
add_action ( 'register_post', 'email_as_username', 10, 3);
but the $user_login variable isn’t returned to the calling wp-login.php script even if I try to set $user_login as global variable inside the function.
Another problem is that the “register_post” action hooks in wp_login.php AFTER that wp added to the $errors object the “empty username” error.
So in the same “email_as_username” function I need to unset that error code, but the WP_Error class doesn’t seems to provide such a “remove” method.Any hint or suggestion? Other way to go?
TIA
Stefano
- The topic ‘Allowing registration with the email as username’ is closed to new replies.