• Hi,

    wordpress’ default password reset email is not working correctly on almost all Polish email clients, because it adds “>” at the end of a reset link, which makes the link incorrect.

    Because of that, I’ve created my own password reset email with “Notification – Custom Notifications and Alerts for WordPress” plugin.

    It works, but now user receives 2 password reset email: default and custom. How can I disable default password reset email?

    I tried with “Manage Notification E-mails” plugin, but it disables password reset function. When user tries “forgot password?” option, it says that reseting password was disabled for this user.

    Can somebody help me with that?

    Thanks,
    Szymon

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Dzień dobry (it’s nearly the only Polish I know)

    That sounds like a lot of fuss to address a minor error. My inclination is to address the root cause instead of blocking one email and recreating virtually the same. My advice is to first undo what you have now and restore the default behavior that is causing the problem.

    Next, add code to a child theme or custom plugin that hooks the ‘retrieve_password_message’ filter. Your callback function is passed the default email message body. Fix the offending link by use of PHP string manipulation functions like str_replace() or preg_replace(). Return the revised message and the user will receive a functioning link in their mail client.

    Thread Starter gamcoder

    (@gamcoder)

    Thank you. It works.

    This is what I added to functions.php (for the benefit of others):

    add_filter("retrieve_password_message", "mapp_custom_password_reset", 99, 4);
    
    function mapp_custom_password_reset($message, $key, $user_login, $user_data )    {
    
    $message = "Otrzymali?my pro?b? o nowe has?o do nast?puj?cego konta: " . sprintf(__('%s'), $user_data->user_email) . "
    
    Je?li to pomy?ka, zignoruj tego emaila. Aby uzyska? nowe has?o, przejd? na t? stron?:
    
    https://www.mysite.com/wp-login.php?action=rp&key=$key&login=".rawurlencode($user_login)."
    
    Je?li masz jakie? pytania, to napisz do nas na adres [email protected]
    
    Pozdrawiam,
    John Doe";
    
      return $message;
    
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to disable default password reset email’ is closed to new replies.