Paid Memberships Pro plugin – pmpro_cron_delete_tmp scheduled event failed

[ad_1]

Site Health reads: *The scheduled event, pmpro\_cron\_delete\_tmp, failed to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.*

Does anyone know why this would be failing to run, what it does/why it’s important and how to fix it?

I’ve noticed the website running slowly when trying to log in so I’m wondering if this is the issue.

​

crons.php:

function pmpro_get_crons() {
$crons = [
‘pmpro_cron_expire_memberships’ => [
‘interval’ => ‘hourly’,
],
‘pmpro_cron_expiration_warnings’ => [
‘interval’ => ‘hourly’,
‘timestamp’ => current_time( ‘timestamp’ ) + 1,
],
‘pmpro_cron_credit_card_expiring_warnings’ => [
‘interval’ => ‘monthly’,
],
‘pmpro_cron_admin_activity_email’ => [
‘interval’ => ‘daily’,
‘timestamp’ => strtotime( ’10:30:00′ ) – ( get_option( ‘gmt_offset’ ) * HOUR_IN_SECONDS ),
],
‘pmpro_cron_delete_tmp’ => [
‘interval’ => ‘daily’,
‘timestamp’ => strtotime( ’10:30:00′ ) – ( get_option( ‘gmt_offset’ ) * HOUR_IN_SECONDS ),
],
‘pmpro_license_check_key’ => [
‘interval’ => ‘monthly’,
],
];

fields.php:

/**
* Delete old files in wp-content/uploads/pmpro-register-helper/tmp every day.
*/
function pmpro_cron_delete_tmp() {
$upload_dir = wp_upload_dir();
$pmprorh_dir = $upload_dir[‘basedir’] . “/paid-memberships-pro/tmp/”;

if(file_exists($pmprorh_dir) && $handle = opendir($pmprorh_dir))
{
while(false !== ($file = readdir($handle)))
{
$file = $pmprorh_dir . $file;
$filelastmodified = filemtime($file);
if(is_file($file) && (time() – $filelastmodified) > 3600)
{
unlink($file);
}
}

closedir($handle);
}

exit;
}

add_action( ‘pmpro_cron_delete_tmp’, ‘pmpro_cron_delete_tmp’ );

/**
* Get user fields from global.
* @since 2.9.3
*/
function pmpro_get_user_fields() {
global $pmpro_user_fields;

return (array)$pmpro_user_fields;
}

I am new to WordPress so all help is appreciated.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer