Skip Navigation

[Resolved] Custom post expiration time issue

This support ticket is created 6 years, 11 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
- 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)

Tagged: 

This topic contains 6 replies, has 3 voices.

Last updated by Minesh 5 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#594978

Hi,

I am using below code in functions.php to set post expiration time, to the last minute/second of the current month:

function func_my_custom_sample_expiration($post_id, $form_data)
{
    if (($form_data['id'] == 462) or ($form_data['id']==628)) {
  	// Modify the automated expiration time to use last minute of last day of current month
	// Note that times here are UTC. WordPress then translates to local times.
	$new_expiration = mktime(21, 59, 59, date("n"), date("t"));
	update_post_meta($post_id, '_cred_post_expiration_time', $new_expiration);
    }
}
add_action('cred_save_data', 'func_my_custom_sample_expiration',15,2);

Above code works fine and in the backend in the "Settings for Post Expiration Date", the post expiration shows as December 31, 2017, 23:59 which is correct.

Now, to print expiration date, I use:

[cred-post-expiration id=$active_sample_id format='j F Y, H:i']

It prints December 31, 2017, 21:59 which is wrong as it is two hours earlier.
Also, please note that at my WP General Settings, timezone is set to Athens, which is UTC+2.

This printing of expiration time at two hours difference, looks like a bug to me.
Please check it out.

Thank you,
Kostas

#595054

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - first of all, I would like to know what is "$active_sample_id", is it assigning ID? what if you try to assign static ID to "id" attribute?

Could you please just confirm my doubt of "$active_sample_id" what value that give you and what it prints when you use static ID.

I see one related ticket and I will get in touch with you as soon as possible.

#595060

Hi MInesh,

Thank you for responding.

If I use static ID like:

[cred-post-expiration id=814 format='j F Y, H:i']

it prints the same: December 31, 2017, 21:59

#595061

Minesh
Supporter

Languages: English (English )

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

Ok fine - thank you. I will get in touch with you as soon as possible once I've update on it.

#599702

Any news on this one?

#599746

Hello,

I’m Mohammed: the Toolset support team leader.

I'm posting here to update you that the issue is in the development team queues and they will work on it ASAP.

Please keep watching this ticket and we will update you once we get any news.

Thanks.

#1278173

Minesh
Supporter

Languages: English (English )

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

I would like to update you that Toolset Forms 2.4 have been officially out. Please check and try to resolve your issue.