Skip Navigation

[Resolved] Using author user meta fields in CRED post form notification emails

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to display author user meta field value within CRED email notification.

Solution:
You can use shortcode [wpv-post-author] to display the first name of post author within your CRED form's email notification body.

For example:

[wpv-post-author format="meta" meta="first_name" id="%%POST_ID%%"]

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/using-author-user-meta-fields-in-cred-post-form-notification-emails/#post-627464

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-author

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

Last updated by daveG-7 6 years ago.

Assisted by: Minesh.

Author
Posts
#626350

In a CRED post form for a custom post type, I would like to use the author of the post being published's first name (a user field) in the notification email. How can I do this?

#626381

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - do you mean that the logged in user who is creating the post using CRED form - you want to display that user name?

#626678

That's mostly correct. I want the logged-in author of the post's first name, not their username.

Thanks.

#626824

Minesh
Supporter

Languages: English (English )

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

Well - could you please try to add following place holder to your CRED form's email body:

%%USER_DISPLAY_NAME%%

You can add this from your CRED form's email body editor - you will see the button "Insert Body Codes" click on this button and select (Logged in User) User Display Name .

#627153

That still seems to be updating to the name of the admin account, not the test account with which I created the post. Also, I just want the first name - a display name might be different, right? This email goes out when a listing's status is changed to published - is that the issue, is it getting the logged in user who is changing the status's name?

#627205

Minesh
Supporter

Languages: English (English )

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

What if you try to use following shortcode:

[wpv-user field="user_firstname"]

Does this help to resolve your issue.

#627385

That's what I tried first. It still returned my admin account's name, not the name of the account who had created the post.

#627388

Minesh
Supporter

Languages: English (English )

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

I want to clarify something here again - do you want to display author's first name of post where CRED form is added or user who is creating the entry using CRED form after loggedin?

#627392

It's a front-end CRED Post form for a custom post type. If user A is the author of the post using the post form, I would like to use user A's first name in the email that goes out from that post to the author when the status of the post is changed from Pending (which it starts as) to Published. Admins change that post status after reviewing the post.

#627442

Minesh
Supporter

Languages: English (English )

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

Ok - this flow is bit different and that is why it's printing admin user name as shortcode does not have track of which post author should be displayed.

I would like to know here - what is the content of your email notification body - could you please share it.

Are you using any other shortcode withing email notification body? If yes: does all shortcode displays correct content?

#627457

The email is set for When post status changes to Published, Send notification to Author.

Here's the body. The %%POST_ID%% body code works fine, but the %%USER_DISPLAY_NAME%% ( and [wpv-user field="user_firstname"] when I had that in) both returned the admin's name, not the post author's.

<p>Dear %%USER_DISPLAY_NAME%%,</p>
<p>Your listing has been approved and is now live on Farm to Farmer. You may <a href="<em><u>hidden link</u></em>">view your listing here</a>. If you would like to make changes to your listing, you can do so at anytime by visiting <a href="<em><u>hidden link</u></em>">your Account page.</a></p>
<p>For reference, your listing ID is %%POST_ID%%. Please note that your listing will expire after 6 months. You will have an opportunity to renew your listing if you so choose one week before its expiration date.</p>
<p>Thanks and feel free to respond to this email with any questions.</p>
<p>Amy Moreno-Sills<br />Project Coordinator, Farm to Farmer</p>
<p><img src="<em><u>hidden link</u></em>" width="300px" /></p>
#627464

Minesh
Supporter

Languages: English (English )

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

Nice - so as you can see %%POST_ID%% is works fine.

[wpv-post-author format="meta" meta="first_name" id="%%POST_ID%%"]

This should work. Could you please check and confirm.

#627489

That worked! 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.