Sending the activation email
In this section, we are going to look at the code in steps 2, 3, and 4. We started this process by implementing a callback function on the user_register action. This is a core WordPress action executed after creating the user through the registration process. The ID of the registered user is passed as a parameter to this function. Inside the function, we get the activation status of the user from the wp_usermeta table, using wpccp_user_activation_status as the key. This is a custom key used for our plugin. Initially, the value will be empty, and hence the if condition will be matched.
Inside the conditional check, we get the details of the user by passing the user ID to the get_userdata function. Then, we generate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access