You are here

function uc_country_enable in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_store/uc_store.admin.inc \uc_country_enable()
  2. 7.3 uc_store/uc_store.countries.inc \uc_country_enable()

Enable a disabled country.

1 string reference to 'uc_country_enable'
uc_store_menu in uc_store/uc_store.module
Implementation of hook_menu().

File

uc_store/uc_store.module, line 1126
Contains global Ubercart functions and store administration functionality.

Code

function uc_country_enable($country_id) {
  $result = db_query("SELECT * FROM {uc_countries} WHERE country_id = %d", $country_id);
  if ($country = db_fetch_object($result)) {
    if ($country->version < 0) {
      db_query("UPDATE {uc_countries} SET version = %d WHERE country_id = %d", abs($country->version), $country_id);
      drupal_set_message(t('@country enabled.', array(
        '@country' => $country->country_name,
      )));
    }
    else {
      drupal_set_message(t('@country is already enabled.', array(
        '@country' => $country->country_name,
      )), 'error');
    }
  }
  else {
    drupal_set_message(t('Attempted to enable an invalid country.'), 'error');
  }
  drupal_goto('admin/store/settings/countries/edit');
}