-
Notifications
You must be signed in to change notification settings - Fork 11
Examples
Jay Hoffmann edited this page Jan 3, 2017
·
4 revisions
function register_user_password_reset() {
register_batch_process( array(
'name' => 'Reset all passwords',
'type' => 'user',
'callback' => 'reset_user_password',
'args' => array(
'offset' => 0
)
) );
}
add_action( 'locomotive_init', 'register_user_password_reset' );
function reset_user_password( $user ) {
// Ensure that current user is not included.
if( $user->ID !== get_current_user_id() ) {
// Turn off reset password admin emails.
add_filter( 'send_password_change_email', '__return_false' );
$newpass = wp_generate_password();
wp_update_user( array( 'ID' => $user->ID, 'user_pass' => $newpass ) );
}
}
add_action( 'init', 'reset_user_password' );