pmpro_wp_ajax_pmpro_updates

Load an update via AJAX.

Description

pmpro_wp_ajax_pmpro_updates(); 

Usage

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

Defined (1)

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

/includes/updates.php  
  1. function pmpro_wp_ajax_pmpro_updates() { 
  2. //get updates 
  3. $updates = array_values(get_option('pmpro_updates', array())); 
  4.  
  5. //run update or let them know we're done 
  6. if(!empty($updates)) {  
  7. //get the latest one and run it 
  8. if(function_exists($updates[0])) 
  9. call_user_func($updates[0]); 
  10. else 
  11. echo "[error] Function not found: " . $updates[0]; 
  12. echo ". "; 
  13. } else { 
  14. echo "[done]"; 
  15.  
  16. //reset this transient so we know AJAX is running 
  17. set_transient('pmpro_updates_first_load', false, 60*60*24); 
  18.  
  19. //show progress 
  20. global $pmpro_updates_progress; 
  21. if(!empty($pmpro_updates_progress)) 
  22. echo $pmpro_updates_progress; 
  23.  
  24. exit;