<?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 : [email protected])
  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_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
    ('BS', 'AA', '99 Unknown', 1),
    ('BS', 'AB', 'Amazonas', 1),
    ('BS', 'AC', 'Anzoategui', 1),
    ('BS', 'AD', 'Apure', 1),
    ('BS', 'AE', 'Aragua', 1),
    ('BS', 'BS', 'Barinas', 1),
    ('BS', 'AG', 'Bolivar', 1),
    ('BS', 'BA', 'Carabobo', 1),
    ('BS', 'BB', 'Cojedes', 1),
    ('BS', 'BC', 'Delta Amacuro', 1),
    ('BS', 'BD', 'Dependencias Federales', 1),
    ('BS', 'BF', 'Distrito Capital', 1),
    ('BS', 'BE', 'Falcon', 1),
    ('BS', 'BG', 'Guarico', 1),
    ('BS', 'CA', 'Isla Margarita', 1),
    ('BS', 'CB', 'Lara', 1),
    ('BS', 'CC', 'Merida', 1),
    ('BS', 'CD', 'Miranda', 1),
    ('BS', 'CF', 'Monagas', 1),
    ('BS', 'DA', 'Portuguesa', 1),
    ('BS', 'DB', 'Sucre', 1),
    ('BS', 'DC', 'Tachira', 1),
    ('BS', 'DD', 'Trujillo', 1),
    ('BS', 'DE', 'Vargas', 1),
    ('BS', 'FA', 'Yaracuy', 1),
    ('BS', 'FE', 'Zulia', 1);";
  if ($wpdb->query($sql)){
 
  update_option( 'ee_venezuela_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' );

Add a code snippet to your website: www.paste.org