Problem: I have a Form that triggers an email notification. I send the notification to an email address that is stored in a parent post's custom field, by using the CRED API cred_notification_recipients. Since updating to Types 3.0, the email notifications are not sent as expected.
Solution: Update the code to work with the new Post Relationships API, and ensure the child post status is not "private".
add_filter('cred_notification_recipients', 'modify_recipients', 10, 4); function modify_recipients($recipients, $notification, $form_id, $post_id) { // Check notification name matches target notification if ( isset($notification['name']) && 'Mail an Veranstalter' == $notification['name'] ) { // Add email recipient $parent_id = toolset_get_parent_post_by_type( $post_id, 'veranstaltung' ); $email_of_organizer = get_post_meta($parent_id, 'wpcf-veranstalter-email', true); $recipients[] = array( 'to' => 'cc', 'address' => '$email_of_organizer', 'name' => '', 'lastname' => '' ); } return $recipients; }
Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_parent_post_by_type
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.
Dieses Thema wurde abgetrennt von https://toolset.com/de/forums/topic/cred-notification-to-email-from-parent-post-field/
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Dieses Thema enthält 4 Antworten, hat 2 Stimmen.
Zuletzt aktualisiert von vor 6 Jahren, 6 Monaten.
Assistiert von: Christian Cox.