How to do it...

Take the following steps to implement email activation for new user account registrations:

  1. Open the wpcookbookchapter5.php file of the WPCookbook Chapter 5 plugin in the code editor.
  2. Add the following code block to implement the user_register action with a callback function:
add_action( 'user_register', 'wpccp_chapter5_add_registration_data', 10, 1 );function wpccp_chapter5_add_registration_data( $user_id ) {  // Step 3 code }
  1. Add the following code block inside the function to check the user activation status of the registered users:
  $activation_status = get_user_meta($user_id, 'wpccp_user_activation_status',true);  if( trim($activation_status) == '' ){     // Step 4 code  }
  1. Add the following code inside the if statement ...

Get WordPress 5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.