• HI, i want to delete the email sent to admin when user reset password but i want customize too the email sent to user.

    For now i created a plugin and wrote this:

    if ( !function_exists( 'wp_password_change_notification' ) ) {
    		function wp_password_change_notification(){
    			// do nothing
    		}
    	}

    But these just avoid admin notification on user reset password. Is there any way to change the content of email sent to user? Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • check out retrieve_password() in wp-login.php it has a retrieve_password_message filter that may be of use.

    https://core.trac.www.ads-software.com/browser/tags/3.8.1/src/wp-login.php#L263

    Thread Starter otta88sun

    (@otta88sun)

    I did this and work:

    function my_awesome_retrieve_password_message( $content, $key )
    {
            $input = filter_input( INPUT_POST, 'user_login', FILTER_SANITIZE_STRING );
    
            if( is_email( $input ) )
            {
                    $user = get_user_by( 'email', $user_login );
            }
            else
            {
                    $user = get_user_by( 'login', sanitize_user( $input ) );
            }
    
            $content = '<strong>'.get_bloginfo('name').' - Reimpostazione Password</strong><br/><br/>';
            $content .= sprintf( 'Ciao %s, è stata richiesta la reimpostazione della password per il tuo account<br/>', $user->first_name );
            $content .= 'Non cliccare sul link in basso se non hai effettuato la richiesta<br/>';
            $content .= sprintf( '%s?action=rp&key=%s&login=%s', wp_login_url('url'), $key, $input );
    
            return $content;
    }
    add_filter ( 'retrieve_password_message', 'my_awesome_retrieve_password_message', 10, 2 );

    But the email is sent in text, any way to set it in html? Thank you.

    Thread Starter otta88sun

    (@otta88sun)

    i added this before return $content; at the end of the function.

    add_filter( 'wp_mail_content_type', 'set_html_content_type' );

    But have no idea how disable it, because disable it with

    remove_filter( 'wp_mail_content_type', 'set_html_content_type' );

    before end of function will disable html.

    However works without disabling it too.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Edit reset/lost password notification’ is closed to new replies.