Skip Navigation

[Resolved] Send email notification to a user email that has a custom field with a specified

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

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#2334445

Hello,
I want to sent an email notification on form submit to a user that has a custom field that has a value similar to a value specified in user form.
---
I have custom post "Ticket" that has a custom field "region" (select field with value A, B, C) [parent]
I have a custom post "Tichet Answer" [child]
I have custom post relationship: "Ticket - TicketAnswer"
I have a form to add custom post "Tichet Answer"
I can display the custom field "region" of custom post "Ticket" in "TicketAnswer" add form - [types field='region' output='raw'][/types]
I have a custom field for USER "zone" (select field with value A, B, C)

I want to sent a notification to USER email that has the user custom field "zone" value set to "C" if the post "Ticket" custom field "region" has set value to "C"

Please help me to set this up - I think that i can take the displayed value of custom field "region" that has set value to "C" and pass to a user shortcode that has custom field "zone" value set to "C" but i don't know hot to set this up.

Thank you!

#2334863

Hello,

There isn't such kind of built-in feature, it needs custom codes, for example:
1) After user submit the child "TicketAnswer" add form, use filter hook "cred_notification_recipients" to trigger a PHP function:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_notification_recipients

2) In this PHP function:
a) Get the parent "Ticket" post ID:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post
b) And get the parent "Ticket" post field "region" value:
https://developer.wordpress.org/reference/functions/get_post_meta/
c) Use "region" value to get all users by USER "zone" field:
https://developer.wordpress.org/reference/functions/get_users/
d) And get user email addresses:
https://developer.wordpress.org/reference/functions/get_userdata/
e) Then setup the results of filter hook "cred_notification_recipients" with above email addresses.

For your reference.