Skip Navigation

[Resolved] Sending to conditional mail according to a custom field on a job offer website

This support ticket is created 3 years, 1 month 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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by carmenL 3 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#2183621

I am developing a job vacancies website that users can apply through open applications.

For this I have created two special types of content, Job Offers and Requests, with their corresponding custom fields. Between them I have created a one-to-many relationship, in which Job Offers is the parent element.

Then I have created an entry form so that users can request the desired offer. So far so good.

Now I would like to be able to modify two questions:

1. To be able to select the email that receives the notification, which is defined by a custom field in the Job Offer, since they can be different emails depending on the needs.

2. Automatically set the title of the Request, so that it shows the title of the selected Job Offer, and / or a numerical reference to it (this custom field is also created in the Job Offer).
In editing this field in the input form I see that I can enter a default value from a URL parameter, but I don't understand what it refers to. In fact, I would like this field to be hidden from the applying user, but I understand that I can hide it using CSS if the title is previously set.

Thanks in advance.

Best,
Carmen

#2184397

Hi Carmen,

Thank you for contacting us and I'd be happy to assist.

1. You can get the ID of the parent "Job Offers" post using the "toolset_get_related_post" function and then change the form's email notification recipient, using the "cred_notification_recipients" filter:

https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post
https://toolset.com/documentation/programmer-reference/cred-api/#cred_notification_recipients

An example code snippet for the similar requirement, is available in this support ticket:
https://toolset.com/forums/topic/send-notification-to-recipient-email-defined-in-parent-post-custom-field/

2. To change the title of the newly created "Request" post, you can first get the ID of the related parent "Job Offers" post using the "toolset_get_related_post" function and then use the "cred_save_data" hook, to perform a custom function to change the child post's title. Example code snippet for this requirement is available in this support ticket:
https://toolset.com/forums/topic/populate-child-post-title-with-parent-post-title/#post-908981
( please refer to the first code snippet in that reply )

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2186635

Hi Waqar,

I have not had to try the solution yet, but I think my problem is solved with your instructions.

Thank You!
Carmen