Skip Navigation

[Resolved] Toolset forms not expiring posts

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 10 replies, has 1 voice.

Last updated by Minesh 1 week, 6 days ago.

Assisted by: Minesh.

Author
Posts
#2860502

Tell us what you are trying to do?
Test if Toolset Forms is expiring posts

Is there any documentation that you are following?
No

Is there a similar example that we can see?
There have been many reports of this in past, it seems either still an issue, or perhaps a misunderstanding of how it works

What is the link to your site?
Please enable private form for log in

#2860603

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

That is really strange.

Can you please share problem URL as well as admin access details and what posts are not expiring.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2860869

Minesh
Supporter

Languages: English (English )

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

Hi Beda,

When I checked the CRON listing page that controls all cron:
- hidden link

I see there is a notice:

The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.

Is this related to your issue?

#2860925

No, because the CRON control screen has "run now" features, so, even if CRON is disabled, it can run the hooked functions.

That's how I do it on many other websites - as long as you "run now", it does not matter if CRON is disabled.
Of course, naturally the normal process of the CRON is hooked off, meaning you _have_ to click "run now" to trigger the hooked code.

#2860940

Minesh
Supporter

Languages: English (English )

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

Hi Beda,

May I know what timezone you are in and using what timezone you created the following post:
- hidden link

For instance, when I tested with my localhost, I set WordPress timezone to UTC+0.
(Please remember my timezone is UTC+5:30)

The form that creates the post - I set the post expiration setting to expirt post in 1 minute after submission of the form and change the post status to "draft" as you can see with the following screenshot.
- hidden link

I've added the following code to theme's functions.php file:

add_filter ('cred_post_expiration_cron_schedules', 'func_cron_one_minute_schedule', 10,1);
function func_cron_one_minute_schedule ($schedules) {
  
     $schedules['every1minute'] = array( 'interval' => 1 * MINUTE_IN_SECONDS, 'display' => __( 'Every 1 minute' ) );
    $schedules['every2minute'] = array( 'interval' => 2 * MINUTE_IN_SECONDS, 'display' => __( 'Every 2 minute' ) );
    return $schedules;
}

And from the Toolset => Settings I've set the post expiratioin cron setting to run "Every 2 minute".

So, basically, with the form when new post will be created,the post expiration date set is 1 minute after the post submission and change the post status to "draft" and I set the CRON to run every 2 minuets.

I created the post using form and I can not see post expiration works as expected.

But when I change the WordPress timezone to UTC+5:30 from Seetings => General and then edit the post I've created using form and enable the post expirataion and set the post expiration date to 14th May at 18:00 (6 PM) - and when I refresht the page after 2-5 minutues the post status does changed to "draft".

It seems - you need to adjust the post-expiration timestamp we stored with correct timezone if I'm not wrong.

#2860953

Hi Minesh

I cannot change that website's timezone. My own timezone is UTC-3, their timezone is UTC-0 and their clients might be who knows from UTC+7 or -7

The point is that the post I created as testing did not expire neither minutes after MY timezone nor UTC-0's timezone timeout passed.
Moreover, now that over three days passed, it should have expired no matter in what timezone we are thinking, since there are exactly only 24 of those worldwide, so we could expect a maximum of 24 hours delay on the most extreme case.
Yet, the post simply does not expire.

From your testing, it results that the WP site UTC must be _identical_ to the user's timezone who creates the post?
Then the feature is broken, because we cannot expect a user to be in the site's timezone all the time.

I did not test the feature on a brand-new install. I tested on that staging site without custom code/non-essential plugins (which involve WooCommerce!), so maybe the issue is buried in that additionally?

#2861478

Minesh
Supporter

Languages: English (English )

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

Hi Beda

I've working copy of the test site on my local test installation and the thing is that post expiration feature is also working with the UTC+0 timezone.

Can you please share brand new staging site on the same server and also FTP access details so that I can try to install the duplicator copy and check on your server that is the same site copy works with post expiratoin feature on your staging site or not.

I have set the next reply to private which means only you and I have access to it.

#2861568

Minesh
Supporter

Languages: English (English )

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

Hi Beda - I've created the "demo" directory under the publc_html folder with the FTP access details you shared.

It will be great if you can share database access details for the new database that I can use to install the duplicator. I want to keep the original staging site you have "staging7" if required later I can compare the things.

I have set the next reply to private which means only you and I have access to it.

#2861594

Minesh
Supporter

Languages: English (English )

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

Hi Beda

I've also created the following sandbox site where latest Toolset plugins installed:
- hidden link

You can login to it using:
user: admin
pass: Admin@999

For the post expiration settings - I've set the cron to run every 2 minutes:
- hidden link

I've created the following form that will create a new student posttype post and post status is set to publish.
- hidden link

The post expiration setting set to post will expire in 1 minute after the form submitted and after expiration post status should be changed to draft:

Above form added to the following page:
- hidden link

I checked once I submit the new entry usign the "add-new-student" page - I can see the post expiration works fine and after 2 minutes the post status is changed to "draft".

#2861627

Hi minesh, the staging7 is at your disposal - we are not using it.
For comparison we can then use staging5, which is the one we use (and that should remain unaltered)
Database access for the staging7 is visible directly in its wp-config.php, as it is a verbatim copy of life site but for staging purpose.

#2861697

Minesh
Supporter

Languages: English (English )

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

Hi Beda

I've installed the duplicator and I created the test post and the post expiration does not work - however the same way it works on my local test installation.

URL: hidden link
User: admin
pwd: Admin@999

Then I've installed the WP Control plugin and as soon as I visit the custom cron listing page:
- hidden link

I can see the notice at top the the page:

There was a problem spawning a call to the WP-Cron system on your site. This means WP-Cron events on your site may not work. The problem was:

Unexpected HTTP response code: 401

More information

And when I check the "More information" link:
=> hidden link

Unexpected HTTP response code: 401 or 403
This means an access control restriction such as BasicAuth, a firewall, a security or privacy plugin, some form of password protection, or an .htaccess rule is preventing your server from accessing wp-cron.php.

It seems your server havve some restriction or firewall or any of the reason listed above that seems to block the CRON request.