Exploring the registration success path

Now let's look at the success path, where we don't have any errors, by looking at the remaining sections of the register_user function:

    if ( empty( $errors ) ) {       $user_pass  = wp_generate_password();       $user_id    = wp_insert_user( array('user_login' =>      $sanitized_user_login,         'user_email' => $user_email,         'role' => $user_type,         'user_pass' => $user_pass)       );       if ( !$user_id ) {         array_push( $errors, __('Registration failed.','wpwaf') );         $wpwaf_registration_params['errors'] = $errors;       } else {         $activation_code = $this->random_string();         update_user_meta( $user_id, 'wpwaf_activation_code',      $activation_code );         update_user_meta( $user_id, 'wpwaf_activation_status', 'inactive'          );  if($user_type == 'wpwaf_premium_member'){ ...

Get Wordpress Web Application Development - Third Edition 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.