Skip Navigation

[Resolved] Cannot get the email of the parent author to send a notification

This support ticket is created 5 years, 4 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 6 replies, has 3 voices.

Last updated by kateP-2 5 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#1363261

I’ve got a custom post type called “Opdracht” (Jobs) and a custom post type called “Offers”. The offer post type acts as a child for the post type “Opdracht”.

A user can submit an offer to a post created in the post type “Opdracht”. This offer is then shown inside the dashboard of the author that created the post inside the post type “Opdracht”.

When an offer is submitted on a post I want the parent author (so the author of the one that created the post inside the post type opdracht) to receive an e-mail that says they’ve received a new offer.

However I cannot seem to get the email address from the parent author. All I can get is the email address from the author that submits the offer.

TL;DR:
Have a parent and child post type called “Opdracht” and “Offer”
User submits an offer to opdracht
When user submits an offer the author of the parent post (opdracht) should receive an email
Can’t grab the emailadress of the parent author so the email cannot be sent through toolset

#1363301

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I would like to know here where you added the child form "Offers" that creates new entry for offers - on a single post of parent post Opdracht” (Jobs)?

#1363307

The form is accessed by clicking a button on the single job(opdracht) page. When clicking the button you're redirected to the form on a seperate page. This form contains the ID of the parent post with the following code: [cred_field field='@opdracht-offer.parent' class='form-control' output='bootstrap' select_text='--- geen opdracht ---' author='$opdracht-offer.parent']

#1363421

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Is your parent preselected when you click on the link of child form?

Please check the following Doc:
=> https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/#creating-forms-when-a-parent-post-is-preselected

You want child form on separate page or you want to add the child form to your current parent page?

#1363453

Yes the parent is pre selected when you click on the link of the child form.

The child form doesn't need to be on a seperate page. I could just place it inside a modal on the parent page, would this solve the problem of grabbing the parent authors emailadress?

#1363467

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Actually - the easiest way is, you should try to use the Toolset Form's hook cred_notification_recipients to add as many notification recipients as you want.

More info:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_notification_recipients

You should try to get your parent post author email and setup your notification accordingly.

We also offer Toolset post-relationship API function: toolset_get_related_post() that you may use to get the parent post ID if that helps.

More info:
=> https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post

#1366327

Hi, I currently have the same requirement. cred_notification_recipients looks good.

How do I get the parent post author email into the to field?
Thanks