As administrator, if I make a new user, I can choose to email my new users a link which they click to go to wp-login.php where they are invited to set their password for the first time. (WordPress used to email out a password, but I can see why they changed that!)
Users arrive at wp-login which records the username in a hidden field, and shows a suggested password which they can customise.
Some of my more easily boggled users are confused by this. They find the generated password incomprehensible, and do not understand that they can click on the suggested password in the box and change it to something they can remember. I would like to add some help text and maybe automatically select the suggested password too at this point.
I am not sure which hooks will allow me to do stuff that only appears to users setting their password, and not to anyone else who is logging in.
How can I do that?
2 Answers
You can add an extra help message box, on the reset password screen:
with the following:
/**
* Display an extra help message box on the 'reset password' screen
*
* @link http://wordpress.stackexchange.com/a/204429/26350
*/
add_action( 'validate_password_reset', function( $errors )
{
add_action( 'login_message', function( $message )
{
// Modify this help message box to your needs:
$mybox = sprintf(
'<br/><p class="message reset-pass">%s</p>',
__( 'Some help text here!' )
);
return $message . $mybox;
} );
} );
Here we add the extra message box by using the login_message
filter. It should only show up on the reset password screen, because we hook it into the validate_password_reset
action.