_wpsc_action_update_option_base_country

The WordPress Core wpsc action update option base country function.

Description

_wpsc_action_update_option_base_country( $old_value, $new_value ); 

Parameters (2)

0. $old_value
The old value.
1. $new_value
The new value.

Usage

  1. if ( !function_exists( '_wpsc_action_update_option_base_country' ) ) { 
  2. require_once '/wpsc-admin/init.php'; 
  3.  
  4. // The old value. 
  5. $old_value = null; 
  6.  
  7. // The new value. 
  8. $new_value = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _wpsc_action_update_option_base_country($old_value, $new_value); 
  12.  

Defined (1)

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

/wpsc-admin/init.php  
  1. function _wpsc_action_update_option_base_country( $old_value, $new_value ) { 
  2. global $wpdb; 
  3. $region_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(`regions`.`id`) FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('%s')", $new_value ) ); 
  4. if ( ! $region_count ) 
  5. update_option( 'base_region', '' );