Skip Navigation

[Resolved] Post form notification e-mail not showing toolset fields

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 10 replies, has 2 voices.

Last updated by lesleeM 1 year, 5 months ago.

Assisted by: Minesh.

Author
Posts
#2606721

I have set up an e-mail notification with a Post Form to send the following:

[types field='name'][/types] has registered for your [wpv-post-title] ride.

The e-mail I received merely shows the following:

has registered for your ride.

I'm not sure if I've done something wrong or not. The name field is one of the fields in the Post Form. The post title field should be pulling the title of the page the user is on when they submit the Post Form. I thought I had this working fine previously, but that might not be the case.

#2606783

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Can you please try to use the following line:

[types field='name' item="%%POST_ID%%"][/types] has registered for your %%POST_TITLE%% ride.

More info:
- https://toolset.com/course-lesson/send-notifications-when-someone-submits-the-form/#displaying-post-and-user-fields-in-notifications

#2606945

The first part of that worked perfectly. Thanks for that. The fact that this was needed to get that to work tells me that I must not have had this working previously. because I haven't done that before.

However the %%POST_TITLE%% part of it is pulling the post title of the Registration post that gets created upon submission of the Registration post form. It needs to be pulling the title of the Ride post that the form is displayed on. So this is providing the child post title when it needs to provide the parent post title. Here is what the notification said this time:

Kenny has registered for your [] Registration – [Kenny] [05/16/2023] ride.

The first instance of "Kenny" is exactly what I'm wanting, pulling what's provided in the name field of the registration form. But on this current test, it should be saying

Kenny has registered for your Adventure Cycle ride.

But your seeing what it is returning instead is another example of the problem discussed below. In providing the Registration post title instead of providing the Ride title, you get to see this. On the Registration post title, the title of the page that the form is displayed on is supposed to be in that first set of brackets from code you guys provided for me in a previous thread. That functionality has broken as well and is not returning anything which then shows as []. That was 100% previously working because I still have examples of test Registration titles in the system that had the correct page title content within those brackets. But something has broken it. I've opened another ticket about that issue that you've replied to here...

https://toolset.com/forums/topic/registration-system-we-previously-had-working-has-broken/

...so there may be some overlap happening here between these two issues as to the solution. It seems like the Relationship between Rides and Registrations has been broken in some way that is beyond my skill level to diagnose. I thought we previously had it to where when someone filled out the Registration form, they would be visible at the bottom of the Ride edit page in the Ride Registrations section where relationships are shown. Hmm, now this is interesting. The test form submission I just did to test this change in the notification code you provided here did work as expected on that front. I just looked there after bringing that up to you here. My Registration here is showing at the bottom of the Ride edit page. Previous test form submissions I sent weren't working to do that until this one. Also the view I have set to display the names and emails of everyone that has registered for a Ride did work properly on this newest form submission as well. I have no explanation for why my previous tests weren't working, but this is encouraging that things may not be as broken as I feared. Here is the Ride page I used to submit this test Registration form submission:

hidden link

You can see me (Kenny) listed under who has registered for this ride, so that worked this time.

#2606961

Minesh
Supporter

Languages: English (English )

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

Sorry but its confusing as you are talking multiple issues at the same time.

I would be happy to help with all your issues but can we address one issue at a time.

Can you please tell me now what is not working exactly where and what steps do I will have to follow to see the issue and you can share problem URL and admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2606973

For the matter specific to this ticket, the part of my reply that matters is:

--------------------------------------------------

The first part of that worked perfectly. Thanks for that. The fact that this was needed to get that to work tells me that I must not have had this working previously. because I haven't done that before.

However the %%POST_TITLE%% part of it is pulling the post title of the Registration post that gets created upon submission of the Registration post form. It needs to be pulling the title of the Ride post that the form is displayed on. So this is providing the child post title when it needs to provide the parent post title. Here is what the notification said this time:

Kenny has registered for your [] Registration – [Kenny] [05/16/2023] ride.

The first instance of "Kenny" is exactly what I'm wanting, pulling what's provided in the name field of the registration form. But on this current test, it should be saying

Kenny has registered for your Adventure Cycle ride.

--------------------------------------------------

I just wanted to let you know the rest of it so you'd have that background here that whatever is going on here is likely related to the other problem we're looking at.

Note that I sent you the admin access needed in another ticket. I don't want to send it again here because I'd have to reset the password on the admin user account to get you the password in this ticket. I didn't save that password and I don't know how to see the password for a user in the WordPress dashboard without resetting it. That would interfere with your ability to get in from the other ticket.

#2606989

Minesh
Supporter

Languages: English (English )

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

Can you please tell me where I can see the following form on the frontend?
=> hidden link

#2606991

The form is on any Ride page. You can use this one:

hidden link

It's set up in the Ride template page here:

hidden link

#2607009

Minesh
Supporter

Languages: English (English )

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

To add the parent post title to email notification body or subject line you will have to add it as custom placeholder.

More info:
- https://toolset.com/documentation/programmer-reference/forms/how-to-use-custom-placeholders-in-cred-notifications/

With the following form - I've added the generic hidden field just before the submit button and set it's default value as follows and saved the form.

[wpv-post-title item='$current_page']

=> hidden link

Then I've added the following "Custom Code" snippet "add-parent-post-title-email-notification" to the "Custom Code" section offered by Toolset:
=> hidden link

add_filter('cred_subject_notification_codes', 'func_add_parent_post_title_to_email_notification', 10, 1);
add_filter('cred_body_notification_codes', 'func_add_parent_post_title_to_email_notification', 10, 1);
function func_add_parent_post_title_to_email_notification( $defaultPlaceHolders ) {
    if( !isset( $_REQUEST['parent-post-title'] )  ) {
      return $defaultPlaceHolders;
    }
    $newPlaceHolders = array( 
        '%%PARENT_POST_TITLE%%' => $_REQUEST['parent-post-title'],
    );
   
    return array_merge($defaultPlaceHolders, $newPlaceHolders );
}

Can you please confirm now you can see the parent post title in the email notification as desired.

#2607181

OK, that worked partially. I think your code for supplying the correct ride title in the e-mail is perfect. But my testing has revealed one more problem situation with the Registration system. Feel free to consider this ticket resolved and split this reply into another ticket for that.

The remaining issue with this ticket now lies in how the Post Form/Relationship handles things when a Guest user submits the Registration form as compared to when a logged in user submits the same form. When a Guest user submits a Registration form, the e-mail notification says:

Kenny-test has registered for your ride.

But when a logged in user submits the Registration form, the e-mail notification correctly says:

Kenny-test has registered for your Ride of Silence ride.

I used

hidden link

for the second test because my user had already registered for the other ride we were using to test. Your code worked perfectly there when I was logged in.

But it wasn't just your code that didn't work for the Guest user. I think your code is actually good there too, but something else is broken for the Guest user to cause the Ride title to not appear in the e-mail notification. When I submitted this test, the new Registration content type post was created on the back end. But the notification triggered here did not include the Ride title. But also, the View that shows who has registered did not include a listing for that registration at all and nothing is showing on the Ride edit page for that Registration in the Ride Registrations section. So the guest user Registration is being ignored completely by anything relying on the relationship. The only thing working for Guest Registrations is the post is getting created as expected.

I think whatever is causing the Relationship related functions to not work for the Guest user is also what is causing your code in this ticket to not work. I think if I'd see the Guest user Registration in the View showing all Registrations and see the Guest user Registration present on the Ride edit page, then your code on this page would have produced the correct e-mail text with the Ride title included.

Is there any setting I've missed that allows Relationships to work on something like this for Guest user submissions?

#2607383

Minesh
Supporter

Languages: English (English )

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

Can you please mark this ticket resolved and I'm splitting the ticket with your last reply.

#2607397

My issue is resolved now. Thank you!