The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Displaying on a view - the date an image was uploaded

Labels

This Discussion is public

Notifications

We are trying to display the date each image was uploaded to a form.  Th following hook was used:

add_filter('frmpro_fields_replace_shortcodes', 'frm_show_post_shortcode', 10, 4);
function frm_show_post_shortcode($replace_with, $tag, $atts, $field){
if(isset($atts['show_post']) and is_numeric($replace_with)){
$post = get_post($replace_with);
if($post){
if(isset($post->{$atts['show_post']}))
$replace_with = $post->{$atts['show_post']};
else
$replace_with = get_post_meta($post->ID, $atts['show_post'], true);
}
}
return $replace_with;
}

This shortcode was added to the view: [178 show_post=post_date]

The post_date is a valid field, but no matter what i'v tried, it displays the guid field.

Any help or suggestions would be greatly appreciated.

Thank You in advance

Dates are stored in tables as unformatted timestamps. You have to convert them to dates and format them so they look like dates. See the date example in the hook's documentation: http://community.formidableforms.com/knowledgebase/frmpro_fields_replace_shortcodes/

Thank You for your response.   I'll give it a shot

Do I include the formatting in the same snippet, or do I create a separate snippet for the conversion.  I cant find a close comparison to doing the simple conversion in the hooks documentation, but this process is new to me.  Thank You again for the direction.

If anyone else has experienced this, can you give any more on the date formatting.  When I look at the database, the post_date is in a format such as 2016-10-06 12:30:26.  That doesn't look unformated to me.  I looked through formidable code, the Forums, Formidable Knowledge base and looked through all the hooks.  There doesn't seem to be documentation that goes over all the built in Formidable features that can be used in a code snippet.  There is a lot hidden and if anyone could point me in the direction of more in depth documentation, it would be appreciated.

Discussion closed.