Skip Navigation

[Resolved] Shortcodes Return Empty in Second Email to User

This support ticket is created 7 years, 8 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 12 replies, has 3 voices.

Last updated by julieP 7 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#431743

When a user completes a post form on the front end, the first email goes to Admin as a prompt to check and then set post to Published, the second email goes to the user with a copy of the post they've just created. When Admin sets the post to Published, the third email goes to the user, confirming their post is now active.

The first two emails contain all the information they should but in the third email (second one to the user) the user fields are returned empty.

Please advise.

#431938

Tia

Thank you for contacting Toolset Support. I am happy to help you with this.

"When Admin sets the post to Published, the third email goes to the user, confirming their post is now active."

I have a few questions:

1. When you say "The shortcodes return empty", this is directly from a CRED form, correct?

2. There is an action the Admin has to perform (set post to published) before the 3rd email is sent, correct?

3. "the user fields are returned empty" Is another other portion of the email not empty?

4. Do you mind attaching a screenshot or pasting the text of the 3rd email?

#432035

Hi Tia

Thanks for your help.

1. I mean the shortcodes I've picked from Fields & Views in the notification mail body.

2. Yes, that's right

3. In the third email I only use [wpv-user field='user_firstname'] but I've just noticed that %%FORM_DATA%% isn't appearing in the email either

4. Here's the content of the notification mail body for the third email:-

[php]<p>Hi [wpv-user field='user_firstname']</p>
<p>I'm pleased to inform you that the booking below is now fully confirmed.</p>
<p>If you need to cancel any of the dates, please make the necessary amendments to your booking form via your <a href="hidden link">account area</a>. If you wish to adjust your deposit accordingly, please add your bank account details to the message box at the bottom of the form and I will arrange the necessary refund. </p>
<p>If you wish to either extend the booking or change both the arrival & collection dates, please check availability with me first.</p>
<p>If you wish to pay the balance by BACS, please ensure this reaches my account by 5pm the day before arrival at the very latest. Alternatively, you can bring cash on the day.</p>
<p>If you have any queries or concerns in the meantime, please do give me a ring.</p>
<p>Best wishes</p>
<p>Julie @ Kennel Free K9s</p>

%%FORM_DATA%%

#432192

Tia

Can you test with a non-user and a non-Toolset related shortcode and see if that works please?

If unavailable, you can try the following:

1. Insert the following code into the theme's function.php
2. Insert the [foobar] shortcode into the email.

Please let me know your results.

functions.php:

//[foobar]
function foobar_func( $atts ){
	return "I am a test shortcode.";
}
add_shortcode( 'foobar', 'foobar_func' );

shortcode for email:

[foobar]
#432394

Hi again

thanks for your assistance.

I set up the [foobar] shortcode, added a notification to my form to a specific email address (non-user) and added [foobar] to the message area. "I am a test shortcode" appeared in the email to the non-user.

#432747

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Julie,

As Tia is currently on holiday then I will be handling this ticket on her behalf 🙂

I see that you have the %%FORM_DATA%% code on the 3rd email. Since this email isn't being triggered directly by the CRED form then it won't work.

What you need to do is use the Views and Fields button on the editor to add the appropriate shortcodes to the email.

The %%FORM_DATA%% code will only work if the notification is being triggered by a form submission but in the case of the 3rd email its being triggered on a status update and not a form submission.

Please let me know if this helps.
Thanks,
Shane

#433731

Ah OK, yes that does make sense - I can achieve that another way.

I thought one of the fields wasn't populating but when I double checked, the entry for that field was empty so that's explained.

If I may ask one more question relating to this issue please? Should Types fields populate in the email notifications? I've used two (in the first email to admin) that are used in a different form to the one being submitted, but the values don't appear. Does one of the forms need to be a child post of the other for this particular scenario to work (i.e. is that why it isn't working)?

Thanks

#433752

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Julie,

If the email is being generated from the Form then no the types field won't work. We currently have an ongoing issue with this and our developers are working to resolve this.

Thanks,
Shane

#433943

I'm confused now! All the Types fields I use in the email notifications for my Contact Form return values in the emails. Are you saying the Types fields will only work in the first emails but not in any subsequent one?

#434151

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Julie,

Sorry for the confusion 🙁

The emails that are sent from the form do they contain custom fields for Types ?

I may not have explained things clearly .

Please let me know.
Thanks,
Shane

#435998

yes, they do. In the third email, I've replaced %%FORM_DATA%% with all the Types fields in a table and the values are populated which is why I'm confused about your comment in thread #433752.

My original query is actually resolved but I'd appreciate making sure I've understood everything correctly.

Thank you

#436254

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Julie,

Your 3rd email is the one for the post status change. This works because its able to get the data from the post itself and not from the CRED form.

If an email is generated when a post is already created, the Types fields will work.

If the email is generated from a form being created then the Types fields won't work (we are currently working on fixing this)

Hopefully this clears up the confusion 🙂

Thanks,
Shane

#436504

Sorry to labour the point here but I don't agree that Types fields won't work if the email is generated from a form being created (they're working for me!)

My original question has been answered so I'm closing this ticket.

Thanks for your help.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.