Title: Error at registration
Last modified: June 21, 2021

---

# Error at registration

 *  Resolved [glashkoff](https://wordpress.org/support/users/glashkoff/)
 * (@glashkoff)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-at-registration/)
 * Hi. I found the error. Please correct the registration logic.
    In \include\controller.
   php on line 303, an attempt is made to access the $user variable: `do_action('
   clean_login_register', $user);` But $user is created inside the if condition {}:
 *     ```
       else{
       $user_id = ( $cleanlogin_has_verified_nonce ) ? wp_create_user( $username, $pass1, $email ) : new WP_Error( 'invalid_nonce', __( 'Invalid NONCE, please try again.', 'clean-login' ) );
       if ( is_wp_error( $user_id ) )
       $url = esc_url( add_query_arg( 'created', 'failed', $url ) );
       else {
       $successful_registration = true;
       $user = new WP_User( $user_id );
       ```
   
 * …some code…
 *     ```
       }
       do_action( 'clean_login_register', $user);
       ```
   
 * Therefore, the $user variable at 303 line cannot be accessed.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Javier Carazo](https://wordpress.org/support/users/carazo/)
 * (@carazo)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-at-registration/#post-14599666)
 * Thanks for your message!!
 * I have just initiated this var to 0 in order to make possible to handle out of
   if with the correct value (once the user has been initiated).
 * You have it available in next version.

Viewing 1 replies (of 1 total)

The topic ‘Error at registration’ is closed to new replies.

 * ![](https://ps.w.org/clean-login/assets/icon-256x256.png?rev=1602118)
 * [Clean Login](https://wordpress.org/plugins/clean-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/clean-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/clean-login/)
 * [Active Topics](https://wordpress.org/support/plugin/clean-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/clean-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/clean-login/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Javier Carazo](https://wordpress.org/support/users/carazo/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/error-at-registration/#post-14599666)
 * Status: resolved