pmpro_upgrade_1_8_7

Remove extra cron jobs inserted in version 1.8.7 and 1.8.7.1.

Description

pmpro_upgrade_1_8_7(); 

Usage

  1. if ( !function_exists( 'pmpro_upgrade_1_8_7' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/updates/upgrade_1_8_7.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_upgrade_1_8_7(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/updates/upgrade_1_8_7.php  
  1. function pmpro_upgrade_1_8_7() { 
  2.  
  3. //fix cron jobs 
  4. $jobs = _get_cron_array(); 
  5.  
  6. // Remove all pmpro cron jobs (for now). 
  7. foreach( $jobs as $when => $job_array ) { 
  8.  
  9. foreach($job_array as $name => $job) { 
  10. //delete pmpro cron 
  11. if ( false !== stripos( $name, 'pmpro_cron') ) 
  12. unset($jobs[$when][$name]);  
  13.  
  14. //delete empty cron time slots 
  15. if( empty($jobs[$when]) ) 
  16. unset($jobs[$when]); 
  17.  
  18. // Save the data 
  19. _set_cron_array($jobs); 
  20.  
  21. //add the three we want back 
  22. pmpro_maybe_schedule_event(current_time('timestamp'), 'daily', 'pmpro_cron_expire_memberships'); 
  23. pmpro_maybe_schedule_event(current_time('timestamp')+1, 'daily', 'pmpro_cron_expiration_warnings'); 
  24. pmpro_maybe_schedule_event(current_time('timestamp'), 'monthly', 'pmpro_cron_credit_card_expiring_warnings'); 
  25.  
  26. pmpro_setOption("db_version", "1.87");  
  27.  
  28. return 1.87;