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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
Ce sujet est une subdivision de https://toolset.com/fr/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)
Ce sujet contient 4 réponses, a 2 voix.
Dernière mise à jour par Il y a 6 années et 4 mois.
Assisté par: Christian Cox.