gpr_trigger_upgrades

Triggers all upgrade functions.

Description

gpr_trigger_upgrades(); 

This function is usually triggered via AJAX


Usage

  1. if ( !function_exists( 'gpr_trigger_upgrades' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-places-reviews/inc/upgrades/upgrade-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gpr_trigger_upgrades(); 
  7.  

Defined (1)

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

/inc/upgrades/upgrade-functions.php  
  1. function gpr_trigger_upgrades() { 
  2.  
  3. if ( ! current_user_can( 'activate_plugins' ) ) { 
  4. wp_die( __( 'You do not have permission to do plugin upgrades', 'google-places-reviews' ), __( 'Error', 'google-places-reviews' ), array( 'response' => 403 ) ); 
  5.  
  6. $gpr_widget_version = get_option( 'gpr_widget_version' ); 
  7.  
  8. if ( ! $gpr_widget_version ) { 
  9. // 1.3 is the first version to use this option so we must add it 
  10. $gpr_widget_version = '1.3'; 
  11. add_option( 'gpr_widget_version', $gpr_widget_version ); 
  12.  
  13. if ( version_compare( GPR_VERSION, $gpr_widget_version, '>=' ) && ! get_option( 'gpr_refid_upgraded' ) ) { 
  14.  
  15. update_option( 'gpr_widget_version', $gpr_widget_version ); 
  16.  
  17. if ( DOING_AJAX ) { 
  18. die( 'complete' ); 
  19. } // Let AJAX know that the upgrade is complete