gmb_show_upgrade_notices

Display Upgrade Notices.

Description

gmb_show_upgrade_notices(); 

Usage

  1. if ( !function_exists( 'gmb_show_upgrade_notices' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'maps-builder/includes/admin/upgrades/upgrade-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gmb_show_upgrade_notices(); 
  7.  

Defined (2)

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

/includes/admin/upgrades/upgrade-functions.php  
  1. function gmb_show_upgrade_notices() { 
  2.  
  3. //Uncomment for testing ONLY - Never leave uncommented unless testing: 
  4. //delete_option( 'gmb_refid_upgraded' ); 
  5.  
  6. // Don't show notices on the upgrades page 
  7. if ( isset( $_GET['page'] ) && $_GET['page'] == 'gmb-upgrades' ) { 
  8. return; 
  9.  
  10. //Check to see if we have any posts 
  11. $gmb_posts = get_posts( array( 'post_type' => 'google_maps', 'posts_per_page' => 10 ) ); 
  12. if(empty($gmb_posts)) { 
  13. update_option( 'gmb_refid_upgraded', 'upgraded' );//mark as updated 
  14. return; //Don't run if there's no posts! 
  15.  
  16. $gmb_version = get_option( 'gmb_version' ); 
  17.  
  18. if ( ! $gmb_version ) { 
  19. // 2.0 is the first version to use this option so we must add it 
  20. $gmb_version = '2.0'; 
  21. update_option( 'gmb_version', GMB_VERSION ); 
  22.  
  23. $gmb_version = preg_replace( '/[^0-9.].*/', '', $gmb_version ); 
  24.  
  25. if ( version_compare( $gmb_version, '2.0', '<=' ) && ! get_option( 'gmb_refid_upgraded' ) ) { 
  26. printf( 
  27. '<div class="updated"><p><strong>Google Maps Builder Notice:</strong> ' . esc_html__( 'Google has updated their Maps API to use the new Google Places ID rather than previous Reference ID. The old method will soon be deprecated and eventually go offline. We are being proactive and would like to update your maps to use the new Places ID. Once you upgrade, your maps should work just fine but remember to make a backup prior to upgrading. If you choose not to upgrade Google will eventually take the old reference ID offline (no date has been given). Please contact WordImpress support via our website if you have any further questions or issues. %sClick here to upgrade your maps to use the new Places ID%s', 'gmb' ) . '</p></div>',  
  28. '<br><a href="' . esc_url( admin_url( 'options.php?page=gmb-upgrades' ) ) . '" class="button button-primary" style="margin-top:10px;">',  
  29. '</a>' 
  30. ); 
  31.  
  32.  
/vendor/wordimpress/maps-builder-core/includes/admin/upgrades/upgrade-functions.php  
  1. function gmb_show_upgrade_notices() { 
  2.  
  3. // Don't show notices on the upgrades page. 
  4. if ( isset( $_GET['page'] ) && $_GET['page'] == 'gmb-upgrades' ) { 
  5. return; 
  6.  
  7. //Check to see if we have any posts. 
  8. $gmb_posts = get_posts( array( 'post_type' => 'google_maps', 'posts_per_page' => 10 ) ); 
  9. if ( empty( $gmb_posts ) ) { 
  10. update_option( 'gmb_refid_upgraded', 'upgraded' ); //mark as updated. 
  11. return; //Don't run if there's no posts! 
  12.  
  13. $gmb_version = get_option( 'gmb_version' ); 
  14.  
  15. if ( ! $gmb_version ) { 
  16. // 2.0 is the first version to use this option so we must add it. 
  17. $gmb_version = '2.0'; 
  18. update_option( 'gmb_version', GMB_VERSION ); 
  19.  
  20. $gmb_version = preg_replace( '/[^0-9.].*/', '', $gmb_version ); 
  21.  
  22. if ( version_compare( $gmb_version, '2.0', '<=' ) && ! get_option( 'gmb_refid_upgraded' ) ) { 
  23. printf( 
  24. '<div class="updated"><p><strong>' . __( 'Maps Builder Update Required', 'google-maps-builder' ) . ':</strong> ' . esc_html__( 'Google has updated their Maps API to use the new Google Places ID rather than previous Reference ID. The old method will soon be deprecated and eventually go offline. We are being proactive and would like to update your maps to use the new Places ID. Once you upgrade, your maps should work just fine but remember to make a backup prior to upgrading. If you choose not to upgrade Google will eventually take the old reference ID offline (no date has been given). Please contact WordImpress support via our website if you have any further questions or issues. %sClick here to upgrade your maps to use the new Places ID%s', 'google-maps-builder' ) . '</p></div>',  
  25. '<br><a href="' . esc_url( admin_url( 'options.php?page=gmb-upgrades' ) ) . '" class="button button-primary" style="margin-top:10px;">',  
  26. '</a>' 
  27. ); 
  28. } elseif ( version_compare( $gmb_version, '2.1', '<=' ) && ! gmb_has_upgrade_completed( 'gmb_markers_upgraded' ) ) { 
  29. printf( 
  30. '<div class="updated"><p><strong>' . __( 'Maps Builder Update Required', 'google-maps-builder' ) . ':</strong> ' . esc_html__( 'An upgrade is required to update your Google maps with the latest plugin version. Please perform a site backup and then upgrade. %sClick here to upgrade your maps%s', 'google-maps-builder' ) . '</p></div>',  
  31. '<br><a href="' . esc_url( admin_url( 'options.php?page=gmb-upgrades' ) ) . '" class="button button-primary" style="margin-top:10px;">',  
  32. '</a>' 
  33. ); 
  34.  
  35.