Does 'Post Expiration' work?

This topic contains 3 reply and 4 voices, and was last updated by Ari 9 years, 9 months ago
Viewing 3 Posts - 1 through 3 (of 3 total)
Author Posts
September 4, 2013 at 4:25 pm 7775
Ari Hi there, It seems the post expiration doesn't work anymore? I've been reading around the forums and WordPress support forum, and Tareq mentioned that the post expiration on WP User Frontend had stopped working (presumably as WordPress changed the way the expiration worked?) and that it would be added back in in the future. Has that been added back in as a feature yet? A site I'm using the plugin on would rely quite heavily on this feature on the frontend and now it's not working. Or, perhaps someone has a workaround for it? Post Expiration plugin doesn't work for me (if anyone could shed some light on how to integrate these two plugins, that would be great!) Thanks!
September 4, 2013 at 10:45 pm 7781
Tareq Hasan Tareq Hasan

Post expiration plugin changed as it was before. So eventually the integration broke when it updated. It’s not yet compatible with the plugin again, hope it will be again integrated soon.

September 5, 2013 at 4:18 pm 7828
jman057 jman057

Hi exsite,

I needed this functionality (the ability to set expiry dates on posts) and found a solution. Tareq, I hope this is useful to your other users.

Download and install the plugin “Content Scheduler”. It is crucial that you get version 0.9.8, not the current version, so click the “Developers” tab when viewing it on the wordpress repository. Check the setting of the plugin, it seems to work well with all features, although I had multiple email notifications when attempting a 7-day advanced notice email, so disabled that.

I have this working two ways for my site, so I will share both methods. First, I let the users set the expiry date. To do this create a “date” field, and set the meta key to “_cs-expire-date” (without the quotations). In the “date format” option, enter “yy-mm-dd 00:00:00” exactly. This will let the user set the date, however you also need to enable it, so create a radio button option custom field and set the meta key to “_cs-enable-schedule” and the options to be “Enable” and “Disable” (you could probably get away without the disable option and use a checkbox).

The second way was to automatically set the posts to expire a given number of days from the listing date. Here is how I did that.

[php]function wpufe_set_default_cat( $post_id, $form_id ) {

$expdate = date("Y-m-d H:i:s", strtotime("+2 days")); //change this to suit
$willexpire = get_post_meta( $post_id, ‘_cs-enable-schedule’, true ); //returns if an expiry date has been set already so the user doesnt reset it just by editing the post

if ( 1366 == $form_id ) { // this is the form for which I want to auto-set expire

if( ‘Enable’ <> $willexpire ) {// check if it is already enabled
update_post_meta( $post_id, ‘_cs-enable-schedule’, ‘Enable’ );
update_post_meta( $post_id, ‘_cs-expire-date’, $expdate );
}
}
}

add_action( ‘wpuf_add_post_after_insert’, ‘wpufe_set_default_cat’, 10, 2 );
[/php]

I’m sorry for the messy code, I’ve only been coding for a few weeks so there is no doubt a better way around this, but it seems to work for me, so hopefully it will for you too.

February 6, 2015 at 12:23 am 35907
Ari Ari

Hi,this Content scheduler plugin code is working,

I have three forms and expiration days are form1=7 day, form2=14 days and form3=30days.
Can i use this code and how to add two more form ID’s to the code??

Viewing 3 Posts - 1 through 3 (of 3 total)