Simple Membership Plugin › Forums › Simple Membership Plugin › Stop Confirmation Email or Change body at runtime
Tagged: confirmation, email, verify
- This topic has 7 replies, 4 voices, and was last updated 6 years, 1 month ago by
admin.
-
AuthorPosts
-
February 24, 2017 at 3:36 pm #10285
nickc
ParticipantHi,
Is there anyway to stop the confirmation email from being sent?
I have written some custom logic to allow users to confirm their email address before being able to login, but the last step is to stop two emails being sent on registration (my custom one with the verify link in and then standard confirmation one).
If there is no way what about intercepting the Simple Membership confirmation and changing the email body via an action for example so that I can add my email confirmation/verify link?
Thanks
NickFebruary 25, 2017 at 5:18 am #10290mbrsolution
ModeratorHi Nick, just to let you know that you customize the e-mails sent to members. Does that help you in any way? If not, maybe you can check the following action hooks.
Let me know if you need more help.
Regards
February 27, 2017 at 4:16 pm #10301nickc
ParticipantHi,
Already using the admin pages to customise the email bodies.
I need to add a dynamic link to the confirmation body or turn the plugins confirmation email off completely.The two actions that are close are:
-swpm_front_end_registration_complete
-swpm_front_end_registration_complete_user_dataBut they happen after the email is already sent.
I’m currently using swpm_front_end_registration_complete to send out my own custom confirmation email with the verification link in. So would either need this link in the Simple Membership Confirmation email or to turn it off and keep my custom email.
Could there be the option added to the plugin to either turn off the confirmation email (maybe a checkbox or if the body is blank in admin) or a action/filter that the confirmation email body is passed into.
Nick
February 27, 2017 at 9:28 pm #10306mbrsolution
ModeratorThank you Nick for providing more information. The plugin developers will investigate further your issue/request.
Kind regards
February 28, 2017 at 8:31 am #10313admin
KeymasterI will add a new filter for this in the next version of the plugin. This filter can be used to override the registration complete email body from your custom code.
February 28, 2017 at 9:29 am #10317nickc
ParticipantLovely, thanks for the update.
Will wait for the next version,If I can help in any way just let me know.
Thanks again,
NickMarch 3, 2020 at 4:58 pm #19866quick_dry
ParticipantI know this is an old thread, but I had the same problem. Not sure if there is a better version yet, but I did it with a filter on wp_mail looking for any email with a certain phrase in the subject (that i could set via the SWPM admin screen) and removing the ‘to’ and ‘message’.
add_filter(‘wp_mail’,’disabling_swpm_emails’, 10,1);
function disabling_swpm_emails( $args ){
try {
if (strpos($args[‘subject’],’DO_NOT_SEND_THIS_EMAIL’)>-1){
$args[‘to’]=”;
$args[‘message’]=”;
}
} catch (Exception $e) {
//do nothing
}
return $args;
}March 3, 2020 at 11:28 pm #19870admin
KeymasterThank you.
The following filter hook can also be used to set change the email body dynamically. It can be used to set the email body to empty. That will stop the email from being sent out.
swpm_email_registration_complete_body
Example code below:
add_filter('swpm_email_registration_complete_body', 'disabling_swpm_registration_complete_emails'); function disabling_swpm_registration_complete_emails( $email_body ){ $email_body = ""; return $email_body; } -
AuthorPosts
- You must be logged in to reply to this topic.