Skip Navigation

[Resolved] CRED stopped sending user registration emails.

This support ticket is created 7 years, 2 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 1 voice.

Last updated by tinaH 7 years, 2 months ago.

Assisted by: Beda.

Author
Posts
#569618

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

#569716

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);
#569766

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);