Reputation: 583
I currently have a Wordpress site that requires an admin to approve a user after registration. However, when the admin is notified that someone has signed up and goes to assign them a password in the Users section, the user gets notified their password has changed before the confirmation email with the new password is set.
In order to prevent this from happening I was hoping to automatically have an assigned password for all new Wordpress users (either approved or waiting to be approved).
A more secure way might be preventing that confirmation email from going out before I initially assigning the user a password. But I have a feeling this might be tricky.
Is it possible for me to assign all new approved users the same password without having to change it in the database?
Upvotes: 0
Views: 1977
Reputation: 1
you can use this filter to set the default password for each new user
add_filter( 'wp_pre_insert_user_data', function ($data, $update) {
if ($update) return $data;
$data['user_pass'] = 'defaultpass';
return $data;
}, 99, 2);
reference: https://core.trac.wordpress.org/browser/tags/5.0.3/src//wp-includes/user.php#L1700
https://developer.wordpress.org/reference/hooks/wp_pre_insert_user_data/
Upvotes: 0