Override s2member welcome email with custom function

I created a custom wp_new_user_notification() function in s2-hacks.php as i need a custom email design to be sent when a user registers. This works fine with regular registration, but when i wanted to reset that user’s password by checking “Reset Password & Resend Welcome Email Message” the s2member’s custom email (admin.php?page=ws-plugin–s2member-gen-ops#ws-plugin–s2member-new-user-emails) got sent instead of email from my custom function. Why does this happen only when resetting? How do i override/turn off s2member’s option and use/prioritise my custom function for registration & reset notification, as it’s currently shown as disabled and i cannot edit them?

What hook are you using to call your custom function? You probably just need to check the code and see what hook is used when the password is reset via the admin and add that to your function.

1 Like

No hook is used, just a plain custom wp_new_user_notification() in a s2-hacks.php inside mu-plugin.

Try this: https://code.tutsplus.com/tutorials/build-a-custom-wordpress-user-flow-part-3-password-reset--cms-23811