I wondered if someone here might be able to help.
Basically, I’ve created a custom registration form that when validated, inserts a user to the user table.
function _new_user($data) {
// Separate Data
$default_newuser = array(
'user_pass' => wp_hash_password( $data['user_pass']),
'user_login' => $data['user_login'],
'user_email' => $data['user_email'],
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'role' => 'pending'
);
wp_insert_user($default_newuser);
}
Now, what I need it to do is rather than sent the confirmation e-mail which I know I can do with the following code.
wp_new_user_notification($user_id, $data['user_pass']);
I want to send a user activation e-mail instead. I’ve tried a few things but I cant seem to be able to find anything concrete. Hoping someone might have had this problem before.
To accomplish user activation process you need to do following steps:
Add custom field and send email:
Check user activation on login:
Activation page:
This is your starting point, go ahead and adjust it for your needs.
Two options to choose from:
Use a plugin, for example User activation email or New User Approve
Code this yourself.
Some functions that should get you started:
You can get the user_id by doing this while authentication: