Skip Navigation

[Resolved] Displaying _cred_post_expiration_time for user

This support ticket is created 2 years, 9 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.

Our next available supporter will start replying to tickets in about 1.89 hours from now. Thank you for your understanding.

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: Africa/Casablanca (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Jamal 2 years, 9 months ago.

Assisted by: Jamal.

Author
Posts
#2092669

Hi,

I've successfully enabled a filter (https://toolset.com/forums/topic/archive-query-filter-based-on-cred-field/) based on the _cred_post_expiration_time for a user who is posting to a directory site. Each entry is called a "Listing."

In the user's account page, I'm creating a View to show all of their existing, active listings + all of their expired listings. I can successfully do that using a Query Filter, as the link shows above.

What I would like to do for the existing, active listings is to show both the Post Date ("This listing was created on May 3, 2021") and the Expiration Date ("This listing will expire on June 31, 2021.") I easily got the post date and I was able to call the _cred_post_expiration_time to the View, but it's formatted in a very strange set-up. It currently just outputs a string of numbers.

I presume this has to do with system defaults somewhere? Probably like

YY-MM-DD-HH-MM-SS

or something like that? How can I change this to output a user-friendly date? Do I need to create a custom function to hook to this post-field?

The shortcode that is created inside the View, for the record, is

[wpv-post-field name='_cred_post_expiration_time']

.
Thank you!

#2093207

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

Toolset stores datetimes as timestamps, the number of seconds from the UNIX epoch, that's why you get a string of numbers.
hidden link

Instead of using the wpv-post-field shortcode that will display the raw value of a customfield(unless it was defined in Toolset->Custom Fields), use the cred_post_expiration shortcode that accepts a format argument

[cred-post-expiration format="m/d/Y"]

https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_post_expiration

I hope this helps. Let me know if you have any questions.

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