Enhancement suggestion for action "user_registration_check_token_complete"

Home Forums User Registration Enhancement suggestion for action "user_registration_check_token_complete"

This topic contains 2 replies, has 2 voices, and was last updated by  erichk4 1 year, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2191

    erichk4
    Participant

    Hi,
    first of all thank you for this great plugin!

    my suggestion:

    add the $user_id and a new variable $user_reg_successfull as arguments to the action “user_registration_check_token_complete“, (\includes\class-ur-email-confirmation.php ~#120), my changes are marked with //ERICH

    public function check_token_before_authenticate()
    	{
                $user_reg_successfull = false; //ERICH		
    
                add_action( 'login_enqueue_scripts', array( $this, 'ur_enqueue_script' ), 1 );
    		
    		if( isset( $_GET['ur_resend_id'] ) && $_GET['ur_resend_token'] == 'true') {
    			
    			$user_id = $this->my_simple_crypt( $_GET['ur_resend_id'], 'd' );
    
    			$user = get_user_by( 'id', $user_id );
    
    			if( $user ) {
    
    				$this->getToken( $user_id );
    
    				$this->set_email_status( array(), '', $user_id );
    
    				UR_Emailer::send_mail_to_user( $user->user_email, $user->user_login, $user_id, '' );
    				
    				add_filter('login_message', array( $this,'custom_resend_email_token_message' ) );
    				add_filter('user_registration_login_form_before_notice', array( $this,'custom_resend_email_token_message' ) );
    			} else {
    
    				add_filter('login_message', array( $this,'custom_resend_email_token_error_message' ) );
    				add_filter('user_registration_login_form_before_notice', array( $this,'custom_resend_email_token_error_message' ) );
    				;
    			}			
    
    		}	
    
    		if( ! isset( $_GET['ur_token'] ) ) {
    			return;
    		}
    		else
    		{
                           $output = str_split( $_GET['ur_token'], 50 );
    
    			$user_id = $this->my_simple_crypt( $output[1], 'd');
    			
    			$user_token = get_user_meta( $user_id, 'ur_confirm_email_token', true );
    			
    			if( $user_token == $_GET['ur_token'] )
    			{
                                $user_reg_successfull = true; //ERICH
    
    			    update_user_meta( $user_id, 'ur_confirm_email', 1 );
    				delete_user_meta( $user_id, 'ur_confirm_email_token');
    
    				add_filter('login_message', array( $this,'custom_registration_message' ) );
    				add_filter('user_registration_login_form_before_notice', array( $this,'custom_registration_message' ) );
    			}
    			else
    			{
    				add_filter('login_message', array( $this,'custom_registration_error_message' ) );
    				add_filter('user_registration_login_form_before_notice', array( $this,'custom_registration_error_message' ) );
    				;
    			}
    		}
    
            do_action('user_registration_check_token_complete', $user_id, $user_reg_successfull ); // ERICH added $user_id and $user_reg_successfull
    
    	}

    would be useful for developers to check the status on user verification

    thanks
    Erich

    #2201

    sanjeev3
    Member

    Hello @erichk4,

    Thank you for your suggestion. We will implement it. However, you too can contribute, please fork the repository and open a pull request. We will review and merge the pull request. https://github.com/wpeverest/user-registration. Also follow the basic git guidelines.

    Regards,
    WPEverest Support

    #2224

    erichk4
    Participant

    Thank you!

    Pull request created!

    greetings
    Erich

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.