I upgraded to CRED 1.9.2 from 1.8.8
Users who registers does not receive the notification with password and username anymore.
Applies to ALL of my CRED user registration forms.
(wp_mail is working)
Attaching duplicator copy of my site
Example form:
Try the form on this page after installing the copy of my site: /create-exhib-web/
This user form: /wp-admin/post.php?post=3986&action=edit
This was not a general CRED problem.
The CRED hook, 'cred_notification_recipients', function I created yesterday is the problem.
(From this ticket: https://toolset.com/forums/topic/does-cred_notification_recipients-apply-to-scheduled-notifications/)
How can this function disable all CRED user registration notifications?
The form id in the function is an edit post form.
It should apply only to this form not disabling other notifications - correct?
function b_invoice_mail($recipients, $notification, $form_id, $post_id) {
if (5803 == $form_id) {
//applies to all invoice form notifications
$exhibitor_id = get_post_meta($post_id, '_wpcf_belongs_exhibitor_id', true);
if (!empty($exhibitor_id)) {
$email = get_post_meta($exhibitor_id, 'wpcf-email', true);
} else {
$email = get_post_meta($post_id, 'wpcf-book-exhib-mail', true);
}
if (empty($email)) {
//Use form email settings instead
exit;
} else {
$recipients[] = array(
'to' => 'to',
'address' => $email,
'name' => '',
'lastname' => ''
);
return $recipients;
}
}
}
add_filter('cred_notification_recipients', 'b_invoice_mail', 10, 4);
The hook required a return $recipients at the end.
Just return; wasn't enough.
Final working function if anyone reads this:
function b_invoice_mail($recipients, $notification, $form_id, $post_id) {
if (5803 == $form_id) {
//applies to all invoice form notifications
$exhibitor_id = get_post_meta($post_id, '_wpcf_belongs_exhibitor_id', true);
if (!empty($exhibitor_id)) {
$email = get_post_meta($exhibitor_id, 'wpcf-email', true);
} else {
$email = get_post_meta($post_id, 'wpcf-book-exhib-mail', true);
}
if (!empty($email)) {
$recipients[] = array(
'to' => 'to',
'address' => $email,
'name' => '',
'lastname' => ''
);
}//else use form email settings
}
//this hook requires 'return $recipient' here, else disabling notifications for all forms
//plain return; does not work
return $recipients;
}
add_filter('cred_notification_recipients', 'b_invoice_mail', 10, 4);