This support ticket is created 3 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Hi, Waqar is currently on holiday and expected to return to work on August 20. Would you prefer to speak with another supporter, or continue waiting for Waqar?
Hello. Thank you for contacting the Toolset support.
Can you please share problem URL where you added your form and tell me on what action you setup the "nieuwe gebruiker geregistreerd PROMO" email notification.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
/*
// if notification is named "Nieuwe gebruiker geregistreerd"
if ( isset($notification['name']) && 'Nieuwe gebruiker geregistreerd' == $notification['name'] ) {
// if the checkbox field is checked remove all notification recipients
if(isset($_POST['wpcf-ik-wil-het-aanbod-gratis-bekijken'][0])) {
$recipients = array();
}
}
*/
As the 2nd condition also set the recipients to empty. I can see it working. Can you please confirm it works at your end as well.
Your custom code for the 2nd condition above is EXACTLY the same as the one Waqar already provided before. Obviously it does NOT work!
Create a TEST registration and send the proper custom code when it actualy works. MAKE SURE that the email notification is sent to the user AND admin at hello@landman.re
We just tested the first condition, and the email notification for that condition is NOT sent anymore either. Also here the notification should be both sent to the user AND admin at hello@landman.re
Sent the COMPLETE code for both the first and second condition which we can copy paste
----- Send the "complete" custom code instead of the one that Waqar created (see below) -----
----- We did "not" receive any email at hello@landman.re -----
---------------------------------
add_filter('cred_notification_recipients', 'modify_recipients_user_form_18888', 10, 4);
function modify_recipients_user_form_18888($recipients, $notification, $form_id, $post_id) {
// if specific form
if ($form_id == 18888) {
// if notification is named "Nieuwe gebruiker geregistreerd promo"
if ( isset($notification['name']) && 'Nieuwe gebruiker geregistreerd promo' == $notification['name'] ) {
// if the checkbox field is not checked remove all notification recipients
if(!isset($_POST['wpcf-ik-wil-het-aanbod-gratis-bekijken'][0])) {
$recipients = array();
}
}
// if notification is named "Nieuwe gebruiker geregistreerd"
if ( isset($notification['name']) && 'Nieuwe gebruiker geregistreerd' == $notification['name'] ) {
// if the checkbox field is checked remove all notification recipients
if(isset($_POST['wpcf-ik-wil-het-aanbod-gratis-bekijken'][0])) {
$recipients = array();
}
}
}
return $recipients;
}
The code that is shared by Waqar is not needed that is why I commented it.
I do not add any code. You should take the backup of the code Waqar shared and delete it and check as per my testing and as I shared the proof it works for me when I disable/delete the code Waqar has added.
Deactivated the custom code Waqar shared.
Results:
1/ no email is received by the user
2/ no email is received at hello@landman.re
This is the case for both conditions.
To better assist you with this issue, I would prefer to take a copy of your website and work on it in my local development environment. Can I take a copy?