• Resolved anaskambal

    (@anaskambal)


    Hello all,

    I just want to know if it is possible to change the default message that appears to users after registration, as I want to inform them to check their SPAM folder for activation

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Abdul Wahab

    (@abdulwahab610)

    Hello, @anaskambal

    Please use the following snippet in your child theme’s functions.php to show a message after a user registers to your liking

    add_filter( 'wp_login_errors', 'filter_wp_login_errors', 10, 2 );
    
    function filter_wp_login_errors( $errors, $redirect_to ) {
    
      // make the changes to register message
      $errors->add( 'registered', sprintf( __( '<br> Please check your Spam box if email is 
      not to be found in inbox.' ), wp_login_url() ), 'message' );
      return $errors;
    }

    Here is how your message will look like https://d.pr/i/bslMB8

    Thank you.

    @abdulwahab610 Thank you very much.

    Your code appends a message to the register message. Is there a way I can change the default registration message altogether

    And another problem is new message is appearing on the login page too.

    Plugin Contributor Abdul Wahab

    (@abdulwahab610)

    Hey, @sumon1068

    You can use the following snippet to remove the default error message and add new.

    * Change the Register password fields not match error message
    * @param WP_Error $wp_error The WP_Error object.
    * @param string Redirect destination URL.
    *
    * @return WP_Error $wp_error The WP_Error object.
    */
    add_filter( 'registration_errors', 'filter_wp_login_errors', 10, 2 );
    
    function filter_wp_login_errors( $errors, $redirect_to ) {
    
     if( strpos($_SERVER['REQUEST_URI'],'action=register') !== false ) {
      $errors->remove( 'password_mismatch');
      $errors->add( 'password_mismatch', sprintf( __( 'Custom Mismatch Error message.' ), 
      wp_login_url() ) );
      return $errors;
     } else{
      return $errors;
     }
    }

    Let me know is it work for you or not.
    Thank you.

    Unfortunately your code just shows error message. Even it doesn’t let users register.

    Anyway, I am using redirection method described here.

    Thank you.

    Plugin Support Muhammad Arslan

    (@wparslan)

    Hi @sumon1068,
    Please use the following snippet in your child theme’s functions.php to show a message after a user registers to your liking.
    Here is the output of the code => https://d.pr/i/WjmwKW

    /**
     * Change the Register Success message 
     * @param WP_Error	$wp_error The WP_Error object.
     * @param string		Redirect destination URL.
     * 
     * @return WP_Error	$wp_error The WP_Error object.
     */
    add_filter( 'wp_login_errors', 'filter_wp_login_errors', 10, 2 );
    
    function filter_wp_login_errors( $errors, $redirect_to ) {
    	//Run Only if user registration is a success
    	if( strpos($_SERVER['REQUEST_URI'],'checkemail=registered') !== false ) {
    
    		//Remove the existing Register success message
    		$errors->remove( 'registered');
    
    		// make the changes to register message
    		$errors->add( 'registered', sprintf( __( 'Please check your Spam box if email is 
    		not to be found in inbox.' ), wp_login_url( ) ), 'message' );
    
    		return $errors;
    
    	} else{
    		//Return the other message and errors
    		return $errors;
    	}
    }

    Thank you very much @wparslan

    This works great.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘I want to change the “registration successfully” message’ is closed to new replies.