Skip Navigation

[Resolved] Expired post email notifications not populated correctly with post-specific data

This support ticket is created 3 years, 6 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 27 replies, has 3 voices.

Last updated by simonM-5 3 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#2138161

Hi Support

The timed email notifications from expired posts are not retrieving post-specific information correctly from the database to populate the email notification correctly.

1) The first name of the user is not being pulled correctly when the notification is being sent out. I have tried with 2 variants:

We previously had a ticket with Nigel (https://toolset.com/forums/topic/user-first-name-not-inserted-correctly-in-translated-user-forms-notifications/) in which he offered the tip to use

[wpv-user field="user_firstname" id="%%USER_USERID%%"]

instead of

[wpv-user field="user_firstname"]

, the latter being what is inserted if you choose User first name via the GUI.

This was in the context of email notifications being sent out on new Post creation, which worked. For post expiry notifications, with the 2nd variant, the name appears correctly in the test email which you can send from the notification settings, however when the post expires and the "real" notification goes out, the first name is omitted.

2) For testing purposes, I added the specific post title to the notification so that the notification is post-specific, however the Post Title does not appear to be being pulled correctly from the database in the timed notification either.

Notification "[Post Form - New Job Ad] - Notify Family 7 days prior to Job Ad Expiry Date" is specific, referencing the post title:

Hi [wpv-user field="user_firstname"]
<p>
<strong>Your Job Ad <strong>[wpv-post-title]</strong> will expire in 7 days.</strong>

Notification "[Post Form - New Job Ad] - Notify Family 3 days prior to Job Ad Expiry Date" I left as the previously generic text:

Hi [wpv-user field="user_firstname" id="%%USER_USERID%%"]
<p>
<strong>One of your Job Ads will expire in 3 days.</strong>

and created 2 new job Ads, one in English and one in German.

Results:
- None of the notifications from the timed email notifications contains the post-specific content (neither user first name nor post title.)
- Neither of the two syntaxes for user first name worked in the notifications
- The post title was not populated in the email notification

Question: is any of the used placeholder syntax correct (I picked this via the GUI). If not what should we be using as placeholders in CRED forms? I've seen numerous posts with the %%-%% style notation, is this what should be being used? Is there a list of correct placeholders anywhere in the support forum? I looked for the official comprehensive list but couldn't find the relevant documentation, just old posts with some suggestions.

Kind regards
Simon

#2140077

Hello,

I assume we are talking about the post form "Post Form - New Job Ad":
hidden link
It is a post form for creating new "Job Ad" post, but the %%USER_USERID%% placeholder works for user form.

I assume you are going to display post author's information, if it is, you can try View's shortcode [wpv-post-author], for example:
[wpv-post-author format="meta" meta="user_firstname"]

#2140197

Hi Luo

Yes, I am testing with Post Form - New Job Ad.

I have changed email notification to:

Hi [wpv-post-author format="meta" meta="user_firstname"]
 <p>
 <strong>The following Job Ad will expire in 3 days: %%POST_TITLE%%</strong>

In another post I found in the forum (https://toolset.com/forums/topic/cred-form-notification-email/#post-2011761/), you recommended NOT using %%POST_TITLE%%.

So far [wpv-post-title] did not work for me, so the test Job Ads I just created use the %% notation.

1) Please confirm what the correct notation should be: Should I be using [wpv-post-title] or %%POST_TITLE%%?
2) Is there a documented list of the possible placeholder codes we can use?

Thanks and regards
Simon

#2140249

Hi Luo

Quick update: I can see some of the notifications coming in now.

1) %%POST_TITLE%% seems to be working - it is showing the Post Title
2) Still not able to get the user's first name to appear in the notifications.
3) Turning off the snippet has caused Ads created in German to send out unwanted (duplicate) notifications in English, so I think we could turn that on again, but still have to resolve why the first notification goes out two times...

Kind regards
Simon

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/why-the-first-notification-goes-out-two-times/

#2140763

Q2) Still not able to get the user's first name to appear in the notifications.
The problem you mentioned above is abnormal, please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/

2) In case it is a compatibility problem, please deactivate all other plugins, and switch to WordPress default theme 2021, deactivate all custom PHP/JS code snippets, and test again

3) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

4) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

Q3) turning off the snippet has caused Ads created in German to send out unwanted (duplicate)

According to our support policy, we prefer one ticket one question, for other problems please check the new thread here:
https://toolset.com/forums/topic/why-the-first-notification-goes-out-two-times/

#2140973

Hi Luo

The original ticket (https://toolset.com/forums/topic/notifications-not-going-out-in-language-of-original-post/) was to handle the issue that the notifications weren't going out in the right languages.

Waqar's snippet cures the fact that the language duplicates were also sending out notifications, but the 1st notification still going out twice >> you opened an additional ticket for that (https://toolset.com/forums/topic/why-the-first-notification-goes-out-two-times/), so if you agree, I think we can just reactivate Waqar's code snippet and close my original ticket (https://toolset.com/forums/topic/notifications-not-going-out-in-language-of-original-post)?

Then we have two remaining issues with the notifications.
1) TICKET: https://toolset.com/forums/topic/expired-post-email-notifications-not-populated-correctly-with-post-specific-data/
2) TICKET: https://toolset.com/forums/topic/why-the-first-notification-goes-out-two-times/

Otherwise we are mixing previous issues into this ticket.

Kind regards
Simon

#2143507

We can handle the questions one by one, for the question:

Still not able to get the user's first name to appear in the notifications.

Have you tried as I mentioned above?
https://toolset.com/forums/topic/expired-post-email-notifications-not-populated-correctly-with-post-specific-data/#post-2140763

If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2143723
#2145683

HI Luo

Just to let you know I'll be away on holiday for a week so can only react to any of the 5 or 6 tickets with you as of Wednesday 24.

Have a good week until then!

Kind regards
Simon

#2151809

Hi Luo

I'm back and looking forward to your updates on our open tickets.

Kind regards
Simon

#2153429

Sorry for the delay answer, I have problem to install the duplicator package you provided, I get lots of PHP errors and Mysql errors when install it.

For the issue:
Still not able to get the user's first name to appear in the notifications.
Please try below shortcode:
[wpv-post-author format="meta" meta="first_name" item="%%POST_ID%%"]

The attribute "item" will pass current post ID to the shortcode [wpv-post-author]

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/item-attribute/

I am trying to make the duplicator package from your website directly, will update your tickets if find anything

#2155295

HI Luo

I updated the notifications for New Nanny Ads and New Job Ads with the notation you suggested and it works sometimes, but not every time, which I find a little strange. As yet I cannot determine the pattern when it works and when it doesn't.

I'll create a few new Ads this morning and see how they behave and get back to you.

Kind regards
Simon

#2155573

Hi Luo

Here's a summary of what happened with today's tests:

NANNY ADS:
Test expiry notifications NAD EN 20210830 1437
- 7 day expiry notification went out correctly in English with user first name and post title included.
- 3 day expiry notification went out correctly in English with user first name and post title included.

Test expiry notifications NAD DE 20210830 1438
- 7 day expiry notification went out in German, included correct post title, but user first name was missing
- 3 day expiry notification went out in German, included correct post title, but user first name was missing

JOB ADS:
Test expiry notifications JAD EN 20210830 1439
- 7 day expiry notification went out correctly in English with user first name and post title included.
- 3 day expiry notification went out correctly in English with user first name and post title included.
- 7 day expiry notification went out AGAIN in English with user first name and post title included.

Test expiry notifications JAD DE 20210830 1440
- 7 day expiry notifcation went out in German, included correct post title, but user first name was missing
- 3 day expiry notifcation went out in German, included correct post title, but user first name was missing
- 7 day expiry notification went out AGAIN in German, included correct post title, but user first name was missing

So in summary, in this round of tests:
- it worked correctly for Nanny Ads in English, but user name still missing in German.
- it worked correctly for Job Ads in English, except that that superfluous notification is going out. In German the user first name is still missing.

It's curious that the updated translations for the notifications worked, except for the user first name.

I'll do one more round of tests. Maybe we can spot a pattern.

Kind regards
Simon

#2155849

Please check these:
Edit those problem German posts, find and edit their post author, make sure they do have "first_name" setting in their profile page.

#2155911

Hi Luo

Yes, both the nanny user and family user have a first name and a last name. The two users I am using for testing are: nativenanny2 and nativefamily6.

I checked their profile and switched to English and German as well using the WPML flag, but as far as I'm aware anyway, there are no language duplicates of the User post type, right?

Kind regards
Simon