Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created August 16, 2018 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/276ed5b0234188f95101b60155f4cd6e to your computer and use it in GitHub Desktop.
Save joshfeck/276ed5b0234188f95101b60155f4cd6e to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Event Espresso - States/Provinces Pack: Venezuela
Plugin URI: http://www.eventespresso.com
Description: This plugins adds states/provinces for the country of Venezuela to Event Espresso 4.
Version: 1.0
AFthor: Event Espresso
AFthor URI: http://www.eventespresso.com
Copyright 2014 Event Espresso (email : support@eventespresso.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA02110-1301USA
*/
function ee_venezuela_states_provinces_activate() {
$installed = get_option( 'ee_venezuela_another_attempt_states_provinces_added');
//Get out if the state pack has been installed previously
if ($installed) return;
global $wpdb;
$sql = "INSERT INTO `" . $wpdb->prefix . "esp_state` (`CNT_ISO`, `STA_abbrev`, `STA_name`, `STA_active`) VALUES
('VE', 'AA', '99 Unknown', 1),
('VE', 'AB', 'Amazonas', 1),
('VE', 'AC', 'Anzoategui', 1),
('VE', 'AD', 'Apure', 1),
('VE', 'AE', 'Aragua', 1),
('VE', 'BS', 'Barinas', 1),
('VE', 'AG', 'Bolivar', 1),
('VE', 'BA', 'Carabobo', 1),
('VE', 'BB', 'Cojedes', 1),
('VE', 'BC', 'Delta Amacuro', 1),
('VE', 'BD', 'Dependencias Federales', 1),
('VE', 'BF', 'Distrito Capital', 1),
('VE', 'BE', 'Falcon', 1),
('VE', 'BG', 'Guarico', 1),
('VE', 'CA', 'Isla Margarita', 1),
('VE', 'CB', 'Lara', 1),
('VE', 'CC', 'Merida', 1),
('VE', 'CD', 'Miranda', 1),
('VE', 'CF', 'Monagas', 1),
('VE', 'DA', 'Portuguesa', 1),
('VE', 'DB', 'Sucre', 1),
('VE', 'DC', 'Tachira', 1),
('VE', 'DD', 'Trujillo', 1),
('VE', 'DE', 'Vargas', 1),
('VE', 'FA', 'Yaracuy', 1),
('VE', 'FE', 'Zulia', 1);";
if ($wpdb->query($sql)){
update_option( 'ee_venezuela_another_attempt_states_provinces_added', 1, '', 'no' );
$dropdown_sql = "UPDATE `" . $wpdb->prefix . "esp_country` SET `CNT_active`= 1 WHERE `CNT_ISO` = 'GB'";
$wpdb->query($dropdown_sql);
}
}
register_activation_hook( __FILE__, 'ee_venezuela_states_provinces_activate' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment