コード例 #1
0
function events_data_tables_install()
{
    function event_espresso_install_system_names()
    {
        global $wpdb;
        $system_name_data = "SELECT system_name FROM " . $wpdb->prefix . "events_question";
        $system_names = $wpdb->get_results($system_name_data);
        $fname = false;
        $lname = false;
        $email = false;
        $adress = false;
        $adress2 = false;
        $city = false;
        $state = false;
        $country = false;
        $zip = false;
        $phone = false;
        foreach ($system_names as $system_name) {
            switch ($system_name->system_name) {
                case 'fname':
                    $fname = true;
                    break;
                case 'lname':
                    $lname = true;
                    break;
                case 'email':
                    $email = true;
                    break;
                case 'address':
                    $adress = true;
                    break;
                case 'address2':
                    $adress2 = true;
                    break;
                case 'city':
                    $city = true;
                    break;
                case 'state':
                    $state = true;
                    break;
                case 'country':
                    $country = true;
                    break;
                case 'zip':
                    $zip = true;
                    break;
                case 'phone':
                    $phone = true;
                    break;
            }
        }
        if ($fname == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'First Name', 'question_type' => 'TEXT', 'system_name' => 'fname', 'required' => 'Y', 'sequence' => '0'), array('%s', '%s', '%s', '%s', '%s'));
        }
        if ($lname == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Last Name', 'question_type' => 'TEXT', 'system_name' => 'lname', 'required' => 'Y', 'sequence' => '1'), array('%s', '%s', '%s', '%s', '%s'));
        }
        if ($email == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Email', 'question_type' => 'TEXT', 'system_name' => 'email', 'required' => 'Y', 'sequence' => '2'), array('%s', '%s', '%s', '%s', '%s'));
        }
        if ($adress == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Address', 'system_name' => 'address', 'sequence' => '3'), array('%s', '%s', '%s'));
        }
        if ($adress2 == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Address 2', 'system_name' => 'address2', 'sequence' => '3'), array('%s', '%s', '%s'));
        }
        if ($city == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'City', 'system_name' => 'city', 'sequence' => '4'), array('%s', '%s', '%s'));
        }
        if ($state == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'State', 'system_name' => 'state', 'sequence' => '5'), array('%s', '%s', '%s'));
        }
        if ($country == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Country', 'system_name' => 'country', 'sequence' => '6'), array('%s', '%s', '%s'));
        }
        if ($zip == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Zip', 'system_name' => 'zip', 'sequence' => '6'), array('%s', '%s', '%s'));
        }
        if ($phone == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Phone', 'system_name' => 'phone', 'sequence' => '7'), array('%s', '%s', '%s'));
        }
        $system_group = $wpdb->get_row("SELECT system_group FROM " . $wpdb->prefix . "events_qst_group" . " WHERE system_group = 1");
        if ($wpdb->num_rows == 0) {
            $wpdb->insert($wpdb->prefix . "events_qst_group", array('group_name' => 'Personal Information', 'group_identifier' => sanitize_title_with_dashes('personal_information-' . time()), 'system_group' => 1), array('%s', '%s', '%d'));
            $personal_group_id = $wpdb->insert_id;
            $wpdb->insert($wpdb->prefix . "events_qst_group", array('group_name' => 'Address Information', 'group_identifier' => sanitize_title_with_dashes('address_information-' . time()), 'system_group' => 0), array('%s', '%s', '%d'));
            $address_group_id = $wpdb->insert_id;
            $system_name_data = "SELECT id, system_name FROM " . $wpdb->prefix . "events_question" . " where system_name IN ('fname', 'lname', 'email')";
            $system_names = $wpdb->get_results($system_name_data);
            foreach ($system_names as $system_name) {
                $wpdb->insert($wpdb->prefix . "events_qst_group_rel", array('group_id' => $personal_group_id, 'question_id' => $system_name->id), array('%d', '%d'));
            }
            $system_name_data = "SELECT id, system_name FROM " . $wpdb->prefix . "events_question" . " where system_name IN ('address', 'city', 'state', 'zip' )";
            $system_names = $wpdb->get_results($system_name_data);
            foreach ($system_names as $system_name) {
                $wpdb->insert($wpdb->prefix . "events_qst_group_rel", array('group_id' => $address_group_id, 'question_id' => $system_name->id), array('%d', '%d'));
            }
        }
    }
    function espresso_update_event_ids()
    {
        global $wpdb;
        $event_data = "SELECT id FROM " . $wpdb->prefix . "events_detail WHERE event_code='0' ";
        if ($wpdb->num_rows == 0) {
            $wpdb->update($wpdb->prefix . "events_detail", array('group_name' => 'Personal Information', 'group_identifier' => sanitize_title_with_dashes('personal_information-' . time()), 'system_group' => 1), array('%s', '%s', '%d'));
        }
    }
    function event_espresso_update_shortcodes()
    {
        global $wpdb;
        $wpdb->query("SELECT id FROM " . $wpdb->prefix . "posts " . " WHERE (post_content LIKE '%{ESPRESSO_EVENTS}%' AND post_type = 'page') OR (post_content LIKE '%{ESPRESSO_PAYMENTS}%'  AND post_type = 'page') OR (post_content LIKE '%{ESPRESSO_TXN_PAGE}%'  AND post_type = 'page') ");
        if ($wpdb->num_rows > 0) {
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{ESPRESSO_EVENTS}','[ESPRESSO_EVENTS]')");
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{ESPRESSO_PAYMENTS}','[ESPRESSO_PAYMENTS]')");
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{ESPRESSO_TXN_PAGE}','[ESPRESSO_TXN_PAGE]')");
        }
        $wpdb->query("SELECT id FROM " . $wpdb->prefix . "posts " . " WHERE (post_content LIKE '%{EVENTREGIS}%' AND post_type = 'page') OR (post_content LIKE '%{EVENTREGPAY}%' AND post_type = 'page') OR (post_content LIKE '%{EVENTPAYPALTXN}%' AND post_type = 'page') ");
        if ($wpdb->num_rows > 0) {
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{EVENTREGIS}','[ESPRESSO_EVENTS]')");
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{EVENTREGPAY}','[ESPRESSO_PAYMENTS]')");
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{EVENTPAYPALTXN}','[ESPRESSO_TXN_PAGE]')");
        }
    }
    function espresso_update_attendee_qty()
    {
        global $wpdb;
        $sql = "SELECT id FROM " . $wpdb->prefix . "events_attendee WHERE quantity = 0 ";
        $results = $wpdb->get_results($sql);
        if ($wpdb->num_rows > 0) {
            $update_attendee_qty = $wpdb->query("UPDATE " . $wpdb->prefix . "events_attendee SET quantity = 1 OR quantity = '' WHERE quantity = 0");
            do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, " sqldump = " . var_export($results, true) . " ] [ rows affected = " . var_export($update_attendee_qty, true));
        }
    }
    function espresso_answer_fix()
    {
        global $wpdb;
        $sql = "SHOW COLUMNS FROM " . EVENTS_ANSWER_TABLE . " LIKE 'id';";
        $test = $wpdb->query($sql);
        if (empty($test)) {
            $sql = "ALTER TABLE " . EVENTS_ANSWER_TABLE . " DROP PRIMARY KEY";
            $wpdb->query($sql);
            $sql = "ALTER TABLE  " . EVENTS_ANSWER_TABLE . " ADD  id INT( 11 ) unsigned NOT NULL AUTO_INCREMENT FIRST , ADD PRIMARY KEY (  id )";
            $wpdb->query($sql);
        }
    }
    function espresso_added_by_admin_session_id_fix()
    {
        global $wpdb;
        $sql = "SELECT id FROM " . EVENTS_ATTENDEE_TABLE . " WHERE attendee_session=''";
        $ids = $wpdb->get_col($sql);
        foreach ($ids as $id) {
            $wpdb->update(EVENTS_ATTENDEE_TABLE, array('attendee_session' => uniqid('', true)), array('id' => $id));
        }
    }
    //This function was creating a new psot everytime EE was activated
    function espresso_add_cancel_shortcode()
    {
        global $org_options;
        $org_options = get_option('events_organization_settings');
        if (!empty($org_options['cancel_return'])) {
            $cancel_page = get_page($org_options['cancel_return'], ARRAY_A);
            $test = strpos($cancel_page['post_content'], '[ESPRESSO_CANCELLED]');
            if ($test === false) {
                $cancel_page['post_content'] = $cancel_page['post_content'] . '[ESPRESSO_CANCELLED]';
                wp_update_post($cancel_page);
            }
        }
    }
    /**
     * espresso_ensure_event_status_is_not_blank
     * 
     * ensure that for each event has an event status
     * if the event status is missing, give it a default value of  'A'
     * 
     * @since 3.1.32
     * @return void
     */
    function espresso_ensure_event_status_is_not_blank()
    {
        global $wpdb;
        $SQL = "SELECT id FROM " . $wpdb->prefix . "events_detail WHERE event_status = '' ORDER BY id";
        if ($events = $wpdb->get_results($SQL)) {
            foreach ($events as $event) {
                $wpdb->update($wpdb->prefix . "events_detail", array('event_status' => 'A'), array('id' => $event->id), array('%s'), array('%d'));
            }
        }
    }
    function events_organization_tbl_install()
    {
        global $wpdb;
        $table_name = $wpdb->prefix . "events_organization";
        //Check to see if upgrading from an earlier version.
        if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
            $payment_subject = __('Payment Received for [event_name]', 'event_espresso');
            $payment_message = __('<p>***This Is An Automated Response*** </p><p>Thank You [fname] [lname]</p>  <p>We have just  received a payment in the amount of [event_price] for your registration to [event_name].</p> <p>Transaction ID: [txn_id]</p>', 'event_espresso');
            $message = __('<p>***This is an automated response - Do Not Reply***</p> <p>Thank you [fname] [lname] for registering for [event].</p><p>This event starts at [start_time] on [start_date] and runs until [end_time] on [end_date].</p><p>Location:<br>[location]</p><p>Phone: [location_phone]</p><p>Google Map: [google_map_link]</p><p> We hope that you will find this event both informative and enjoyable. Should you have any questions, please contact [contact].</p><p>If you have not done so already, please submit your payment in the amount of [cost].</p><p>Click here to review your payment information [payment_url].</p><p>[edit_attendee_link]</p><p>Thank You.</p>', 'event_espresso');
            $new_org_options = array('organization' => get_bloginfo('name'), 'organization_street1' => '123 West Somewhere', 'organization_street2' => '', 'organization_city' => 'Some City', 'organization_state' => 'AZ', 'organization_zip' => '84128', 'contact_email' => get_bloginfo('admin_email'), 'default_mail' => 'Y', 'paypal_id' => 'my_email@my_website.com', 'payment_subject' => $payment_subject, 'payment_message' => $payment_message, 'message' => $message, 'default_payment_status' => '', 'surcharge' => '0.00', 'country_id' => '', 'organization_country' => '64', 'currency_symbol' => '$', 'expire_on_registration_end' => 'Y', 'email_before_payment' => 'N', 'email_fancy_headers' => 'N', 'enable_default_style' => 'N', 'event_ssl_active' => 'N', 'use_venue_manager' => 'Y', 'enable_default_style' => 'N', 'selected_style' => 'event_espresso_style.css', 'show_pending_payment_options' => 'Y', 'show_reg_footer' => 'Y', 'skip_confirmation_page' => 'N', 'allow_mer_discounts' => 'N', 'allow_mer_vouchers' => 'N', 'display_short_description_in_event_list' => 'N', 'display_description_on_multi_reg_page' => 'N', 'display_address_in_event_list' => 'N', 'display_address_in_regform' => 'Y', 'use_custom_post_types' => 'N', 'display_ical_download' => 'Y', 'display_featured_image' => 'N', 'themeroller' => array('themeroller_style' => 'smoothness'), 'style_settings' => array('disable_legacy_styles' => 'Y', 'enable_default_style' => 'Y', 'css_name' => ''));
            add_option('events_organization_settings', $new_org_options);
        } else {
            if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") == $table_name) {
                //If an earlier version is found
                $results = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "events_organization" . " WHERE id='1'");
                foreach ($results as $result) {
                    $org_id = $result->id;
                    $Organization = $result->organization;
                    $Organization_street1 = $result->organization_street1;
                    $Organization_street2 = $result->organization_street2;
                    $Organization_city = $result->organization_city;
                    $Organization_state = $result->organization_state;
                    $Organization_zip = $result->organization_zip;
                    $contact = $result->contact_email;
                    $registrar = $result->contact_email;
                    $paypal_id = $result->paypal_id;
                    $paypal_cur = $result->currency_format;
                    $event_page_id = $result->event_page_id;
                    $return_url = $result->return_url;
                    $cancel_return = $result->cancel_return;
                    $notify_url = $result->notify_url;
                    $use_sandbox = $result->use_sandbox;
                    $image_url = $result->image_url;
                    $default_mail = $result->default_mail;
                    $payment_subject = $result->payment_subject;
                    $payment_message = $result->payment_message;
                    $message = $result->message;
                }
                switch ($paypal_cur) {
                    case 'USD':
                    case 'HKD':
                    case 'NZD':
                    case 'SGD':
                        $currency_symbol = '$';
                        break;
                    case 'AUD':
                        $currency_symbol = 'A $';
                        break;
                    case 'GBP':
                        $currency_symbol = '&pound;';
                        break;
                    case 'CAD':
                        $currency_symbol = 'C $';
                        break;
                    case 'EUR':
                        $currency_symbol = 'Euro: ';
                        break;
                    case 'JPY':
                        $currency_symbol = '&yen;';
                        break;
                    default:
                        $currency_symbol = '$';
                        break;
                }
                $org_options = array('organization' => $Organization, 'organization_street1' => $Organization_street1, 'organization_street2' => $Organization_street2, 'organization_city' => $Organization_city, 'organization_state' => $Organization_state, 'organization_zip' => $Organization_zip, 'contact_email' => $contact, 'paypal_id' => $paypal_id, 'currency_format' => $paypal_cur, 'currency_symbol' => $currency_symbol, 'event_page_id' => $event_page_id, 'return_url' => $return_url, 'cancel_return' => $cancel_return, 'notify_url' => $notify_url, 'use_sandbox' => $use_sandbox, 'image_url' => $image_url, 'default_mail' => $default_mail, 'payment_subject' => $payment_subject, 'payment_message' => $payment_message, 'message' => $message, 'country_id' => $country_id, 'email_before_payment' => 'N', 'use_personnel_manager' => 'Y', 'use_venue_manager' => 'Y', 'enable_default_style' => 'N', 'selected_style' => 'event_espresso_style.css', 'show_pending_payment_options' => 'Y', 'show_reg_footer' => 'Y', 'skip_confirmation_page' => 'N', 'allow_mer_discounts' => 'N', 'allow_mer_vouchers' => 'N');
                add_option('events_organization_settings', $org_options);
            }
        }
    }
    $table_name = "events_attendee";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t  registration_id VARCHAR(23) DEFAULT '0',\n\t\t\t\t\t  is_primary tinyint(1) DEFAULT '0',\n\t\t\t\t\t  lname VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  fname VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  address VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  address2 VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  city VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  state VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  zip VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  country_id VARCHAR(128) DEFAULT NULL,\n\t\t\t\t\t  organization_name VARCHAR(50) DEFAULT NULL,\n\t\t\t\t\t  vat_number VARCHAR(20) DEFAULT NULL,\n\t\t\t\t\t  email VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  phone VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  date timestamp NOT NULL default CURRENT_TIMESTAMP,\n\t\t\t\t\t  price_option VARCHAR(100) DEFAULT NULL,\n\t\t\t\t\t  orig_price decimal(20,2) DEFAULT '0.00',\n\t\t\t\t\t  final_price decimal(20,2) DEFAULT '0.00',\n\t\t\t\t\t  quantity tinyint(1) DEFAULT '0',\n\t\t\t\t\t  total_cost decimal(20,2) DEFAULT '0.00',\n\t\t\t\t\t  amount_pd decimal(20,2) DEFAULT '0.00',\n\t\t\t\t\t  coupon_code VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  payment VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  payment_status VARCHAR(45) DEFAULT 'Incomplete',\n\t\t\t\t\t  txn_type VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  txn_id VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  payment_date VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  event_id VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  event_time VARCHAR(15) DEFAULT NULL,\n\t\t\t\t\t  end_time VARCHAR(15) DEFAULT NULL,\n\t\t\t\t\t  start_date VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  end_date VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  attendee_session VARCHAR(250) DEFAULT NULL,\n\t\t\t\t\t  transaction_details TEXT,\n\t\t\t\t\t  pre_approve INT(11) DEFAULT '1',\n\t\t\t\t\t  checked_in INT(1) DEFAULT '0',\n\t\t\t\t\t  checked_in_quantity INT(11) DEFAULT '0',\n\t\t\t\t\t  hashSalt VARCHAR(250) DEFAULT NULL,\n\t\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\t\tKEY registration_id (registration_id),\n\t\t\t\t\tKEY event_id (event_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_attendee_meta";
    $sql = "ameta_id bigint(20) NOT NULL AUTO_INCREMENT,\n\t\t\t  attendee_id int(11) DEFAULT NULL,\n\t\t\t  meta_key varchar(255) DEFAULT NULL,\n\t\t\t  meta_value longtext,\n\t\t\t  date_added datetime DEFAULT NULL,\n\t\t\t  date_updated datetime DEFAULT NULL,\n  \t\t\t  PRIMARY KEY  (ameta_id),\n\t\t\t  KEY attendee_id (attendee_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_detail";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t  event_code VARCHAR(26) DEFAULT '0',\n\t\t\t\t  event_name VARCHAR(100) DEFAULT NULL,\n\t\t\t\t  event_desc TEXT,\n\t\t\t\t  display_desc VARCHAR (1) DEFAULT 'Y',\n\t\t\t\t  display_reg_form VARCHAR (1) DEFAULT 'Y',\n\t\t\t\t  event_identifier VARCHAR(75) DEFAULT NULL,\n\t\t\t\t  start_date VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  end_date VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  registration_start VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  registration_end VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  registration_startT VARCHAR (15) DEFAULT NULL,\n  \t\t\t\t  registration_endT VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  visible_on VARCHAR(15) DEFAULT NULL,\n\t\t\t\t  address TEXT,\n\t\t\t\t  address2 TEXT,\n\t\t\t\t  city VARCHAR(100) DEFAULT NULL,\n\t\t\t\t  state VARCHAR(100) DEFAULT NULL,\n\t\t\t\t  zip VARCHAR(11) DEFAULT NULL,\n\t\t\t\t  phone VARCHAR(15) DEFAULT NULL,\n\t\t\t\t  venue_title VARCHAR(250) DEFAULT NULL,\n\t\t\t\t  venue_url VARCHAR(250) DEFAULT NULL,\n\t\t\t\t  venue_image TEXT,\n\t\t\t\t  venue_phone VARCHAR(15) DEFAULT NULL,\n\t\t\t\t  virtual_url VARCHAR(250) DEFAULT NULL,\n\t\t\t\t  virtual_phone VARCHAR(15) DEFAULT NULL,\n\t\t\t\t  reg_limit VARCHAR (25) DEFAULT '999999',\n\t\t\t\t  allow_multiple VARCHAR (15) DEFAULT 'N',\n\t\t\t\t  additional_limit INT(10) DEFAULT '5',\n\t\t\t\t  send_mail VARCHAR(2) DEFAULT 'Y',\n\t\t\t\t  is_active VARCHAR(1) DEFAULT 'Y',\n\t\t\t\t  event_status VARCHAR(2) DEFAULT 'A',\n\t\t\t\t  conf_mail TEXT,\n\t\t\t\t  use_coupon_code VARCHAR(1) DEFAULT 'N',\n\t\t\t\t  use_groupon_code VARCHAR(1) DEFAULT 'N',\n\t\t\t\t  category_id TEXT,\n\t\t\t\t  coupon_id TEXT,\n\t\t\t\t  tax_percentage FLOAT,\n\t\t\t\t  tax_mode INT(11),\n\t\t\t\t  member_only VARCHAR(1),\n\t\t\t\t\tpost_id INT(11) DEFAULT NULL,\n\t\t\t\t\tpost_type VARCHAR(50) DEFAULT NULL,\n\t\t\t\t\tcountry VARCHAR(200) DEFAULT NULL,\n\t\t\t\t\texternalURL VARCHAR(255) DEFAULT NULL,\n\t\t\t\t\tearly_disc VARCHAR(10) DEFAULT NULL,\n\t\t\t\t\tearly_disc_date VARCHAR(15) DEFAULT NULL,\n\t\t\t\t\tearly_disc_percentage VARCHAR(1) DEFAULT 'N',\n\t\t\t\t\tquestion_groups LONGTEXT NULL DEFAULT NULL,\n\t\t\t\t\titem_groups LONGTEXT NULL DEFAULT NULL,\n\t\t\t\t\tevent_type VARCHAR(250) DEFAULT NULL,\n\t\t\t\t\tallow_overflow VARCHAR (1) DEFAULT 'N',\n\t\t\t\t\toverflow_event_id INT(10) DEFAULT '0',\n\t\t\t\t\trecurrence_id int(11) DEFAULT '0',\n\t\t\t\t\temail_id int(11) DEFAULT '0',\n\t\t\t\t\talt_email TEXT,\n\t\t\t\t\tevent_meta LONGTEXT DEFAULT NULL,\n\t\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\t\trequire_pre_approval int(11) DEFAULT '0',\n\t\t\t\t\ttimezone_string VARCHAR(250) DEFAULT NULL,\n\t\t\t\t\tlikes int(22) DEFAULT NULL,\n\t\t\t\t\tticket_id int(22) DEFAULT '0',\n\t\t\t\t\tsubmitted datetime NOT NULL,\n\t\t\t\t PRIMARY KEY  (id),\n\t\t\t\t KEY event_code (event_code),\n\t\t\t\t KEY wp_user (wp_user),\n\t\t\t\t KEY event_name (event_name),\n\t\t\t\t KEY city (city),\n\t\t\t\t KEY state (state),\n\t\t\t\t KEY start_date (start_date),\n\t\t\t\t KEY end_date (end_date),\n\t\t\t\t KEY registration_start (registration_start),\n\t\t\t\t KEY registration_end (registration_end),\n\t\t\t\t KEY reg_limit (reg_limit),\n\t\t\t\t KEY event_status (event_status),\n\t\t\t\t KEY recurrence_id (recurrence_id),\n\t\t\t\t KEY submitted (submitted),\n  \t\t\t\t KEY likes (likes)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_meta";
    $sql = "emeta_id bigint(20) NOT NULL AUTO_INCREMENT,\n\t\t\t  event_id int(11) DEFAULT NULL,\n\t\t\t  meta_key varchar(255) DEFAULT NULL,\n\t\t\t  meta_value longtext,\n\t\t\t  date_added datetime DEFAULT NULL,\n  \t\t\t  PRIMARY KEY  (emeta_id),\n\t\t\t  KEY event_id (event_id),\n\t\t\t  KEY meta_key (meta_key)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_email";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\temail_name VARCHAR(100) DEFAULT NULL,\n\t\t\t\temail_subject VARCHAR(250) DEFAULT NULL,\n\t\t\t\temail_text TEXT,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY wp_user (wp_user)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_category_detail";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\tcategory_name VARCHAR(100) DEFAULT NULL,\n\t\t\t\tcategory_identifier VARCHAR(45) DEFAULT NULL,\n\t\t\t\tcategory_desc TEXT,\n\t\t\t\tcategory_meta TEXT,\n\t\t\t\tdisplay_desc VARCHAR (4) DEFAULT NULL,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\tKEY category_identifier (category_identifier),\n\t\t\t\tKEY wp_user (wp_user)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_category_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tcat_id int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY event_id (event_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_venue";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\tname VARCHAR(250) DEFAULT NULL,\n\t\t\t\tidentifier VARCHAR(26) DEFAULT '0',\n\t\t\t\taddress VARCHAR(250) DEFAULT NULL,\n\t\t\t\taddress2 VARCHAR(250) DEFAULT NULL,\n\t\t\t\tcity VARCHAR(250) DEFAULT NULL,\n\t\t\t\tstate VARCHAR(250) DEFAULT NULL,\n\t\t\t\tzip VARCHAR(250) DEFAULT NULL,\n\t\t\t\tcountry VARCHAR(250) DEFAULT NULL,\n\t\t\t\tmeta TEXT,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY identifier (identifier),\n\t\t\t\tKEY wp_user (wp_user)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_venue_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tvenue_id int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY event_id (event_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_locale";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t  name varchar(250) DEFAULT NULL,\n\t\t\t  identifier varchar(26) DEFAULT '0',\n\t\t\t  wp_user int(22) DEFAULT '1',\n\t\t\t  PRIMARY KEY  (id),\n\t\t\t  KEY identifier (identifier),\n\t\t\t  KEY wp_user (wp_user)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_locale_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tvenue_id int(11) DEFAULT NULL,\n\t\t\t\tlocale_id int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY venue_id (venue_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_personnel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tname VARCHAR(250) DEFAULT NULL,\n\t\t\t\trole VARCHAR(250) DEFAULT NULL,\n\t\t\t\tidentifier VARCHAR(26) DEFAULT '0',\n\t\t\t\temail TEXT,\n\t\t\t\tmeta TEXT,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY identifier (identifier),\n\t\t\t  \tKEY wp_user (wp_user)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_personnel_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tperson_id int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY event_id (event_id),\n\t\t\t  \tKEY person_id (person_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_discount_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tdiscount_id int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY event_id (event_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_start_end";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tstart_time varchar(10) DEFAULT NULL,\n\t\t\t\tend_time varchar(10) DEFAULT NULL,\n\t\t\t\treg_limit int (15) DEFAULT '0',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY event_id (event_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_prices";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tprice_type varchar(50) DEFAULT NULL,\n\t\t\t\tevent_cost decimal(20,2) NOT NULL DEFAULT '0.00',\n\t\t\t\tsurcharge decimal(10,2) NOT NULL DEFAULT '0.00',\n\t\t\t\tsurcharge_type varchar(10) DEFAULT NULL,\n\t\t\t\tmember_price_type varchar(50) DEFAULT NULL,\n\t\t\t\tmember_price decimal(20,2) NOT NULL DEFAULT '0.00',\n\t\t\t\tmax_qty int(7) DEFAULT '0',\n\t\t\t\tmax_qty_members int(7) DEFAULT '0',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY event_id (event_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_discount_codes";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tcoupon_code varchar(50) DEFAULT NULL,\n\t\t\t\tcoupon_code_price decimal(20,2) DEFAULT NULL,\n\t\t\t\tuse_percentage VARCHAR(1) DEFAULT NULL,\n\t\t\t\tcoupon_code_description TEXT,\n\t\t\t\teach_attendee VARCHAR(1) DEFAULT NULL,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY coupon_code (coupon_code),\n\t\t\t  \tKEY wp_user (wp_user)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_multi_event_registration_id_group";
    $sql = "primary_registration_id varchar(255) DEFAULT NULL,\n\t\t\tregistration_id varchar(255) DEFAULT NULL,\n\t\t\tKEY primary_registration_id (primary_registration_id),\n\t\t\tKEY registration_id (registration_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_question";
    $sql = "id int(11) unsigned NOT NULL auto_increment,\n\t\t\tsequence INT(11) NOT NULL default '0',\n\t\t\tquestion_type enum('TEXT','TEXTAREA','MULTIPLE','SINGLE','DROPDOWN') NOT NULL default 'TEXT',\n\t\t\tquestion text NOT NULL,\n\t\t\tsystem_name varchar(15) DEFAULT NULL,\n\t\t\tresponse text NULL,\n\t\t\trequired ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'N',\n\t\t\tprice_mod ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'N',\n\t\t\trequired_text text NULL,\n\t\t\tadmin_only ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'N',\n\t\t\twp_user int(22) DEFAULT '1',\n\t\t\tPRIMARY KEY  (id),\n\t\t\tKEY wp_user (wp_user),\n\t\t\tKEY system_name (system_name),\n\t\t\tKEY admin_only (admin_only)";
    $sql = apply_filters('espresso_filter_hook_events_question_sql', $sql);
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_qst_group";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tgroup_name VARCHAR(100) NOT NULL default 'NULL',\n\t\t\t\tgroup_identifier VARCHAR(45) NOT NULL default 'NULL',\n\t\t\t\tgroup_description TEXT,\n\t\t\t\tgroup_order int(11) DEFAULT '0',\n\t\t\t\tshow_group_name TINYINT( 1 ) NOT NULL DEFAULT '1',\n\t\t\t\tshow_group_description TINYINT( 1 ) NOT NULL DEFAULT '1',\n\t\t\t\tsystem_group TINYINT( 1 ) NOT NULL DEFAULT '0',\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY system_group (system_group),\n\t\t\t  \tKEY wp_user (wp_user)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_qst_group_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tgroup_id int(11)  NOT NULL,\n\t\t\t\tquestion_id int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY group_id (group_id),\n\t\t\t  \tKEY question_id (question_id)";
    event_espresso_run_install($table_name, '', $sql);
    $table_name = "events_answer";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\tregistration_id varchar(23) NOT NULL,\n\t\t\tattendee_id int(11) NOT NULL default '0',\n\t\t\tquestion_id int(11) NOT NULL default '0',\n\t\t\tanswer text NOT NULL,\n\t\t\tPRIMARY KEY  (id),\n\t\t\tKEY registration_id (registration_id),\n\t\t\tKEY attendee_id (attendee_id)";
    event_espresso_run_install($table_name, '', $sql);
    events_organization_tbl_install();
    event_espresso_install_system_names();
    event_espresso_create_upload_directories();
    event_espresso_update_shortcodes();
    event_espresso_update_attendee_data();
    espresso_update_attendee_qty();
    espresso_answer_fix();
    espresso_added_by_admin_session_id_fix();
    espresso_add_cancel_shortcode();
    espresso_ensure_event_status_is_not_blank();
    // grab espresso_db_update option
    $espresso_db_update = get_option('espresso_db_update', array());
    // make sure it's an array
    $espresso_db_update = is_array($espresso_db_update) ? $espresso_db_update : array($espresso_db_update);
    // add current EE version to list
    $espresso_db_update[] = EVENT_ESPRESSO_VERSION;
    // resave
    update_option('espresso_db_update', $espresso_db_update);
}
コード例 #2
0
function events_data_tables_install()
{
    $table_version = EVENT_ESPRESSO_VERSION;
    function event_espresso_install_system_names()
    {
        global $wpdb;
        $system_name_data = "SELECT system_name FROM " . $wpdb->prefix . "events_question";
        $system_names = $wpdb->get_results($system_name_data);
        foreach ($system_names as $system_name) {
            switch ($system_name->system_name) {
                case 'fname':
                    $fname = true;
                    break;
                case 'lname':
                    $lname = true;
                    break;
                case 'email':
                    $email = true;
                    break;
                case 'address':
                    $adress = true;
                    break;
                case 'address2':
                    $adress2 = true;
                    break;
                case 'city':
                    $city = true;
                    break;
                case 'state':
                    $state = true;
                    break;
                case 'zip':
                    $zip = true;
                    break;
                case 'phone':
                    $phone = true;
                    break;
            }
        }
        if ($fname == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'First Name', 'question_type' => 'TEXT', 'system_name' => 'fname', 'required' => 'Y', 'sequence' => '0'), array('%s', '%s', '%s', '%s', '%s'));
        }
        if ($lname == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Last Name', 'question_type' => 'TEXT', 'system_name' => 'lname', 'required' => 'Y', 'sequence' => '1'), array('%s', '%s', '%s', '%s', '%s'));
        }
        if ($email == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Email', 'question_type' => 'TEXT', 'system_name' => 'email', 'required' => 'Y', 'sequence' => '2'), array('%s', '%s', '%s', '%s', '%s'));
        }
        if ($adress == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Address', 'system_name' => 'address', 'sequence' => '3'), array('%s', '%s', '%s'));
        }
        if ($adress2 == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Address 2', 'system_name' => 'address2', 'sequence' => '3'), array('%s', '%s', '%s'));
        }
        if ($city == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'City', 'system_name' => 'city', 'sequence' => '4'), array('%s', '%s', '%s'));
        }
        if ($state == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'State', 'system_name' => 'state', 'sequence' => '5'), array('%s', '%s', '%s'));
        }
        if ($zip == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Zip', 'system_name' => 'zip', 'sequence' => '6'), array('%s', '%s', '%s'));
        }
        if ($zip == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Country', 'system_name' => 'country', 'sequence' => '6'), array('%s', '%s', '%s'));
        }
        if ($phone == false) {
            $wpdb->insert($wpdb->prefix . "events_question", array('question' => 'Phone', 'system_name' => 'phone', 'sequence' => '7'), array('%s', '%s', '%s'));
        }
        $system_group = $wpdb->get_row("SELECT system_group FROM " . $wpdb->prefix . "events_qst_group" . " WHERE system_group = 1");
        if ($wpdb->num_rows == 0) {
            $wpdb->insert($wpdb->prefix . "events_qst_group", array('group_name' => 'Personal Information', 'group_identifier' => sanitize_title_with_dashes('personal_information-' . time()), 'system_group' => 1), array('%s', '%s', '%d'));
            $personal_group_id = $wpdb->insert_id;
            $wpdb->insert($wpdb->prefix . "events_qst_group", array('group_name' => 'Address Information', 'group_identifier' => sanitize_title_with_dashes('address_information-' . time()), 'system_group' => 0), array('%s', '%s', '%d'));
            $address_group_id = $wpdb->insert_id;
            $system_name_data = "SELECT id, system_name FROM " . $wpdb->prefix . "events_question" . " where system_name IN ('fname', 'lname', 'email')";
            $system_names = $wpdb->get_results($system_name_data);
            foreach ($system_names as $system_name) {
                $wpdb->insert($wpdb->prefix . "events_qst_group_rel", array('group_id' => $personal_group_id, 'question_id' => $system_name->id), array('%d', '%d'));
            }
            $system_name_data = "SELECT id, system_name FROM " . $wpdb->prefix . "events_question" . " where system_name IN ('address', 'city', 'state', 'zip' )";
            $system_names = $wpdb->get_results($system_name_data);
            foreach ($system_names as $system_name) {
                $wpdb->insert($wpdb->prefix . "events_qst_group_rel", array('group_id' => $address_group_id, 'question_id' => $system_name->id), array('%d', '%d'));
            }
        }
    }
    function espresso_update_event_ids()
    {
        global $wpdb;
        $event_data = "SELECT id FROM " . $wpdb->prefix . "events_detail WHERE event_code='0' ";
        if ($wpdb->num_rows == 0) {
            $wpdb->update($wpdb->prefix . "events_detail", array('group_name' => 'Personal Information', 'group_identifier' => sanitize_title_with_dashes('personal_information-' . time()), 'system_group' => 1), array('%s', '%s', '%d'));
        }
    }
    function event_espresso_update_shortcodes()
    {
        global $wpdb;
        $wpdb->query("SELECT id FROM " . $wpdb->prefix . "posts " . " WHERE (post_content LIKE '%{ESPRESSO_EVENTS}%' AND `post_type` = 'page') OR (post_content LIKE '%{ESPRESSO_PAYMENTS}%'  AND `post_type` = 'page') OR (post_content LIKE '%{ESPRESSO_TXN_PAGE}%'  AND `post_type` = 'page') ");
        if ($wpdb->num_rows > 0) {
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{ESPRESSO_EVENTS}','[ESPRESSO_EVENTS]')");
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{ESPRESSO_PAYMENTS}','[ESPRESSO_PAYMENTS]')");
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{ESPRESSO_TXN_PAGE}','[ESPRESSO_TXN_PAGE]')");
        }
        $wpdb->query("SELECT id FROM " . $wpdb->prefix . "posts " . " WHERE (post_content LIKE '%{EVENTREGIS}%' AND `post_type` = 'page') OR (post_content LIKE '%{EVENTREGPAY}%' AND `post_type` = 'page') OR (post_content LIKE '%{EVENTPAYPALTXN}%' AND `post_type` = 'page') ");
        if ($wpdb->num_rows > 0) {
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{EVENTREGIS}','[ESPRESSO_EVENTS]')");
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{EVENTREGPAY}','[ESPRESSO_PAYMENTS]')");
            $wpdb->query("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content,'{EVENTPAYPALTXN}','[ESPRESSO_TXN_PAGE]')");
        }
    }
    function espresso_update_attendee_qty()
    {
        global $wpdb;
        $sql = "SELECT id FROM " . $wpdb->prefix . "events_attendee WHERE quantity = 0 ";
        $results = $wpdb->get_results($sql);
        if ($wpdb->num_rows > 0) {
            $update_attendee_qty = $wpdb->query("UPDATE " . $wpdb->prefix . "events_attendee SET quantity = 1 OR quantity = '' WHERE quantity = 0");
            do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, " sqldump = " . var_export($results, true) . " ] [ rows affected = " . var_export($update_attendee_qty, true));
        }
    }
    function events_organization_tbl_install()
    {
        global $wpdb;
        $table_name = $wpdb->prefix . "events_organization";
        //Check to see if upgrading from an earlier version.
        if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
            $payment_subject = __('Payment Received for [event_name]', 'event_espresso');
            $payment_message = __('<p>***This Is An Automated Response*** </p><p>Thank You [fname] [lname]</p>  <p>We have just  received a payment in the amount of [event_price] for your registration to [event_name].</p> <p>Transaction ID: [txn_id]</p>', 'event_espresso');
            $message = __('<p>***This is an automated response - Do Not Reply***</p> <p>Thank you [fname] [lname] for registering for [event].</p><p>This event starts at [start_time] on [start_date] and runs until [end_time] on [end_date].</p><p>Location:<br>[location]</p><p>Phone: [location_phone]</p><p>Google Map: [google_map_link]</p><p> We hope that you will find this event both informative and enjoyable. Should you have any questions, please contact [contact].</p><p>If you have not done so already, please submit your payment in the amount of [cost].</p><p>Click here to review your payment information [payment_url].</p><p>Thank You.</p>', 'event_espresso');
            $new_org_options = array('organization' => get_bloginfo('name'), 'organization_street1' => '123 West Somewhere', 'organization_street2' => '', 'organization_city' => 'Some City', 'organization_state' => 'AZ', 'organization_zip' => '84128', 'contact_email' => get_bloginfo('admin_email'), 'default_mail' => 'Y', 'paypal_id' => 'my_email@my_website.com', 'payment_subject' => $payment_subject, 'payment_message' => $payment_message, 'message' => $message, 'default_payment_status' => '', 'surcharge' => '0.00', 'country_id' => '', 'organization_country' => '64', 'currency_symbol' => '$', 'expire_on_registration_end' => 'Y', 'email_before_payment' => 'N', 'email_fancy_headers' => 'N', 'enable_default_style' => 'Y', 'event_ssl_active' => 'N', 'use_venue_manager' => 'Y');
            add_option('events_organization_settings', $new_org_options);
        } else {
            if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") == $table_name) {
                //If an earlier version is found
                $results = $wpdb->get_results("SELECT * FROM " . EVENTS_ORGANIZATION_TABLE . " WHERE id='1'");
                foreach ($results as $result) {
                    $org_id = $result->id;
                    $Organization = $result->organization;
                    $Organization_street1 = $result->organization_street1;
                    $Organization_street2 = $result->organization_street2;
                    $Organization_city = $result->organization_city;
                    $Organization_state = $result->organization_state;
                    $Organization_zip = $result->organization_zip;
                    $contact = $result->contact_email;
                    $registrar = $result->contact_email;
                    $paypal_id = $result->paypal_id;
                    $paypal_cur = $result->currency_format;
                    $event_page_id = $result->event_page_id;
                    $return_url = $result->return_url;
                    $cancel_return = $result->cancel_return;
                    $notify_url = $result->notify_url;
                    $use_sandbox = $result->use_sandbox;
                    $image_url = $result->image_url;
                    $default_mail = $result->default_mail;
                    $payment_subject = $result->payment_subject;
                    $payment_message = $result->payment_message;
                    $message = $result->message;
                }
                switch ($paypal_cur) {
                    case 'USD':
                    case 'HKD':
                    case 'NZD':
                    case 'SGD':
                        $currency_symbol = '$';
                        break;
                    case 'AUD':
                        $currency_symbol = 'A $';
                        break;
                    case 'GBP':
                        $currency_symbol = '&pound;';
                        break;
                    case 'CAD':
                        $currency_symbol = 'C $';
                        break;
                    case 'EUR':
                        $currency_symbol = 'Euro: ';
                        break;
                    case 'JPY':
                        $currency_symbol = '&yen;';
                        break;
                    default:
                        $currency_symbol = '$';
                        break;
                }
                $org_options = array('organization' => $Organization, 'organization_street1' => $Organization_street1, 'organization_street2' => $Organization_street2, 'organization_city' => $Organization_city, 'organization_state' => $Organization_state, 'organization_zip' => $Organization_zip, 'contact_email' => $contact, 'paypal_id' => $paypal_id, 'currency_format' => $paypal_cur, 'currency_symbol' => $currency_symbol, 'event_page_id' => $event_page_id, 'return_url' => $return_url, 'cancel_return' => $cancel_return, 'notify_url' => $notify_url, 'use_sandbox' => $use_sandbox, 'image_url' => $image_url, 'default_mail' => $default_mail, 'payment_subject' => $payment_subject, 'payment_message' => $payment_message, 'message' => $message, 'country_id' => $country_id, 'expire_on_registration_end' => 'Y', 'email_before_payment' => 'N', 'use_personnel_manager' => 'Y', 'use_venue_manager' => 'Y', 'enable_default_style' => 'Y', 'selected_style' => 'event_espresso_style.css', 'show_pending_payment_options' => 'Y', 'show_reg_footer' => 'Y');
                add_option('events_organization_settings', $org_options);
            }
        }
    }
    $table_name = "events_attendee";
    $sql = " id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t  registration_id VARCHAR(23) DEFAULT '0',\n\t\t\t\t\t  lname VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  fname VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  address VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  address2 VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  city VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  state VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  zip VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  country_id VARCHAR(128) DEFAULT NULL,\n\t\t\t\t\t  organization_name VARCHAR(50) DEFAULT NULL,\n\t\t\t\t\t  vat_number VARCHAR(20) DEFAULT NULL,\n\t\t\t\t\t  email VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  phone VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  date timestamp NOT NULL default CURRENT_TIMESTAMP,\n\t\t\t\t\t  payment VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  payment_status VARCHAR(45) DEFAULT 'Incomplete',\n\t\t\t\t\t  txn_type VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  txn_id VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  amount_pd decimal(20,2) DEFAULT '0.00',\n\t\t\t\t\t  total_cost decimal(20,2) DEFAULT '0.00',\n\t\t\t\t\t  price_option VARCHAR(100) DEFAULT NULL,\n\t\t\t\t\t  coupon_code VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  quantity VARCHAR(5) DEFAULT '0',\n\t\t\t\t\t  payment_date VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  event_id VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  event_time VARCHAR(15) DEFAULT NULL,\n\t\t\t\t\t  end_time VARCHAR(15) DEFAULT NULL,\n\t\t\t\t\t  start_date VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  end_date VARCHAR(45) DEFAULT NULL,\n\t\t\t\t\t  attendee_session VARCHAR(250) DEFAULT NULL,\n\t\t\t\t\t  transaction_details TEXT,\n\t\t\t\t\t  pre_approve INT(11) DEFAULT '1',\n\t\t\t\t\t  checked_in INT(1) DEFAULT '0',\n\t\t\t\t\t  checked_in_quantity INT(11) DEFAULT '0',\n\t\t\t\t\t  hashSalt VARCHAR(250) DEFAULT NULL,\n\t\t\t\t\tPRIMARY KEY  (id),\n\t\t\t\t\tKEY `registration_id` (`registration_id`),\n\t\t\t\t\tKEY `event_id` (`event_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_attendee_meta";
    $sql = "ameta_id bigint(20) NOT NULL AUTO_INCREMENT,\n\t\t\t  attendee_id int(11) DEFAULT NULL,\n\t\t\t  meta_key varchar(255) DEFAULT NULL,\n\t\t\t  meta_value longtext,\n\t\t\t  date_added datetime DEFAULT NULL,\n  \t\t\t  PRIMARY KEY  (ameta_id),\n\t\t\t  KEY `attendee_id` (`attendee_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_detail";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t  event_code VARCHAR(26) DEFAULT '0',\n\t\t\t\t  event_name VARCHAR(100) DEFAULT NULL,\n\t\t\t\t  event_desc TEXT,\n\t\t\t\t  display_desc VARCHAR (1) DEFAULT 'Y',\n\t\t\t\t  display_reg_form VARCHAR (1) DEFAULT 'Y',\n\t\t\t\t  event_identifier VARCHAR(75) DEFAULT NULL,\n\t\t\t\t  start_date VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  end_date VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  registration_start VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  registration_end VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  registration_startT VARCHAR (15) DEFAULT NULL,\n  \t\t\t\t  registration_endT VARCHAR (15) DEFAULT NULL,\n\t\t\t\t  visible_on VARCHAR(15) DEFAULT NULL,\n\t\t\t\t  address TEXT,\n\t\t\t\t  address2 TEXT,\n\t\t\t\t  city VARCHAR(100) DEFAULT NULL,\n\t\t\t\t  state VARCHAR(100) DEFAULT NULL,\n\t\t\t\t  zip VARCHAR(11) DEFAULT NULL,\n\t\t\t\t  phone VARCHAR(15) DEFAULT NULL,\n\t\t\t\t  venue_title VARCHAR(250) DEFAULT NULL,\n\t\t\t\t  venue_url VARCHAR(250) DEFAULT NULL,\n\t\t\t\t  venue_image TEXT,\n\t\t\t\t  venue_phone VARCHAR(15) DEFAULT NULL,\n\t\t\t\t  virtual_url VARCHAR(250) DEFAULT NULL,\n\t\t\t\t  virtual_phone VARCHAR(15) DEFAULT NULL,\n\t\t\t\t  reg_limit VARCHAR (25) DEFAULT '999999',\n\t\t\t\t  allow_multiple VARCHAR (15) DEFAULT 'N',\n\t\t\t\t  additional_limit INT(10) DEFAULT '5',\n\t\t\t\t  send_mail VARCHAR(2) DEFAULT 'Y',\n\t\t\t\t  is_active VARCHAR(1) DEFAULT 'Y',\n\t\t\t\t  event_status VARCHAR(1) DEFAULT 'A',\n\t\t\t\t  conf_mail TEXT,\n\t\t\t\t  use_coupon_code VARCHAR(1) DEFAULT 'N',\n\t\t\t\t  use_groupon_code VARCHAR(1) DEFAULT 'N',\n\t\t\t\t  category_id TEXT,\n\t\t\t\t  coupon_id TEXT,\n\t\t\t\t  tax_percentage FLOAT,\n\t\t\t\t  tax_mode INT(11),\n\t\t\t\t  member_only VARCHAR(1),\n\t\t\t\t\tpost_id INT(11) DEFAULT NULL,\n\t\t\t\t\tpost_type VARCHAR(50) DEFAULT NULL,\n\t\t\t\t\tcountry VARCHAR(200) DEFAULT NULL,\n\t\t\t\t\texternalURL VARCHAR(255) DEFAULT NULL,\n\t\t\t\t\tearly_disc VARCHAR(10) DEFAULT NULL,\n\t\t\t\t\tearly_disc_date VARCHAR(15) DEFAULT NULL,\n\t\t\t\t\tearly_disc_percentage VARCHAR(1) DEFAULT 'N',\n\t\t\t\t\tquestion_groups LONGTEXT NULL DEFAULT NULL,\n\t\t\t\t\titem_groups LONGTEXT NULL DEFAULT NULL,\n\t\t\t\t\tevent_type VARCHAR(250) DEFAULT NULL,\n\t\t\t\t\tallow_overflow VARCHAR (1) DEFAULT 'N',\n\t\t\t\t\toverflow_event_id INT(10) DEFAULT '0',\n\t\t\t\t\trecurrence_id int(11) DEFAULT '0',\n\t\t\t\t\temail_id int(11) DEFAULT '0',\n\t\t\t\t\talt_email TEXT,\n\t\t\t\t\tevent_meta LONGTEXT DEFAULT NULL,\n\t\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\t\trequire_pre_approval int(11) DEFAULT '0',\n\t\t\t\t\ttimezone_string VARCHAR(250) DEFAULT NULL,\n\t\t\t\t\tlikes int(22) DEFAULT NULL,\n\t\t\t\t\tsubmitted datetime NOT NULL,\n\t\t\t\t PRIMARY KEY  (`id`),\n\t\t\t\t KEY `event_code` (`event_code`),\n\t\t\t\t KEY `wp_user` (`wp_user`),\n\t\t\t\t KEY `event_name` (`event_name`),\n\t\t\t\t KEY `city` (`city`),\n\t\t\t\t KEY `state` (`state`),\n\t\t\t\t KEY `start_date` (`start_date`),\n\t\t\t\t KEY `end_date` (`end_date`),\n\t\t\t\t KEY `registration_start` (`registration_start`),\n\t\t\t\t KEY `registration_end` (`registration_end`),\n\t\t\t\t KEY `reg_limit` (`reg_limit`),\n\t\t\t\t KEY `event_status` (`event_status`),\n\t\t\t\t KEY `recurrence_id` (`recurrence_id`),\n\t\t\t\t KEY `submitted` (`submitted`),\n  \t\t\t\t KEY `likes` (`likes`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_meta";
    $sql = "emeta_id bigint(20) NOT NULL AUTO_INCREMENT,\n\t\t\t  event_id int(11) DEFAULT NULL,\n\t\t\t  meta_key varchar(255) DEFAULT NULL,\n\t\t\t  meta_value longtext,\n\t\t\t  date_added datetime DEFAULT NULL,\n  \t\t\t  PRIMARY KEY  (emeta_id),\n\t\t\t  KEY `event_id` (`event_id`),\n\t\t\t  KEY `meta_key` (`meta_key`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_email";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\temail_name VARCHAR(100) DEFAULT NULL,\n\t\t\t\temail_subject VARCHAR(250) DEFAULT NULL,\n\t\t\t\temail_text TEXT,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tUNIQUE KEY id (id),\n\t\t\t\tKEY `wp_user` (`wp_user`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_category_detail";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\tcategory_name VARCHAR(100) DEFAULT NULL,\n\t\t\t\tcategory_identifier VARCHAR(45) DEFAULT NULL,\n\t\t\t\tcategory_desc TEXT,\n\t\t\t\tdisplay_desc VARCHAR (4) DEFAULT NULL,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tUNIQUE KEY id (id),\n\t\t\t\tKEY `category_identifier` (`category_identifier`),\n\t\t\t\tKEY `wp_user` (`wp_user`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_category_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tcat_id int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY `event_id` (`event_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_venue";
    $sql = "id int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\tname VARCHAR(250) DEFAULT NULL,\n\t\t\t\tidentifier VARCHAR(26) DEFAULT '0',\n\t\t\t\taddress VARCHAR(250) DEFAULT NULL,\n\t\t\t\taddress2 VARCHAR(250) DEFAULT NULL,\n\t\t\t\tcity VARCHAR(250) DEFAULT NULL,\n\t\t\t\tstate VARCHAR(250) DEFAULT NULL,\n\t\t\t\tzip VARCHAR(250) DEFAULT NULL,\n\t\t\t\tcountry VARCHAR(250) DEFAULT NULL,\n\t\t\t\tmeta TEXT,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tUNIQUE KEY id (id),\n\t\t\t  \tKEY `identifier` (`identifier`),\n\t\t\t\tKEY `wp_user` (`wp_user`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_venue_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tvenue_id int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY `event_id` (`event_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_locale";
    $sql = "`id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t  `name` varchar(250) DEFAULT NULL,\n\t\t\t  `identifier` varchar(26) DEFAULT '0',\n\t\t\t  `wp_user` int(22) DEFAULT '1',\n\t\t\t  UNIQUE KEY `id` (`id`),\n\t\t\t  KEY `identifier` (`identifier`),\n\t\t\t  KEY `wp_user` (`wp_user`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_locale_rel";
    $sql = "`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`venue_id` int(11) DEFAULT NULL,\n\t\t\t\t`locale_id` int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (`id`),\n\t\t\t  \tKEY `venue_id` (`venue_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_personnel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tname VARCHAR(250) DEFAULT NULL,\n\t\t\t\trole VARCHAR(250) DEFAULT NULL,\n\t\t\t\tidentifier VARCHAR(26) DEFAULT '0',\n\t\t\t\temail TEXT,\n\t\t\t\tmeta TEXT,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tUNIQUE KEY id (id),\n\t\t\t  \tKEY `identifier` (`identifier`),\n\t\t\t  \tKEY `wp_user` (`wp_user`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_personnel_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tperson_id int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY `event_id` (`event_id`),\n\t\t\t  \tKEY `person_id` (`person_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_discount_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tdiscount_id int(11) DEFAULT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY `event_id` (`event_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_start_end";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tstart_time varchar(10) DEFAULT NULL,\n\t\t\t\tend_time varchar(10) DEFAULT NULL,\n\t\t\t\treg_limit int (15) DEFAULT '0',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY `event_id` (`event_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_prices";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tevent_id int(11) DEFAULT NULL,\n\t\t\t\tprice_type varchar(50) DEFAULT NULL,\n\t\t\t\tevent_cost decimal(20,2) NOT NULL DEFAULT '0.00',\n\t\t\t\tsurcharge decimal(10,2) NOT NULL DEFAULT '0.00',\n\t\t\t\tsurcharge_type varchar(10) DEFAULT NULL,\n\t\t\t\tmember_price_type varchar(50) DEFAULT NULL,\n\t\t\t\tmember_price decimal(20,2) NOT NULL DEFAULT '0.00',\n\t\t\t\tmax_qty int(7) DEFAULT '0',\n\t\t\t\tmax_qty_members int(7) DEFAULT '0',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY `event_id` (`event_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_discount_codes";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tcoupon_code varchar(50) DEFAULT NULL,\n\t\t\t\tcoupon_code_price decimal(20,2) DEFAULT NULL,\n\t\t\t\tuse_percentage VARCHAR(1) DEFAULT NULL,\n\t\t\t\tcoupon_code_description TEXT,\n\t\t\t\teach_attendee VARCHAR(1) DEFAULT NULL,\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY `coupon_code` (`coupon_code`),\n\t\t\t  \tKEY `wp_user` (`wp_user`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_multi_event_registration_id_group";
    $sql = "primary_registration_id varchar(255) DEFAULT NULL,\n\t\t\tregistration_id varchar(255) DEFAULT NULL  ";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_attendee_cost";
    $sql = "attendee_id int(11) DEFAULT NULL,\n\t\t\tcost decimal(20,2) DEFAULT '0.00',\n\t\t\tquantity int(11) DEFAULT NULL,\n\t\t\tKEY `attendee_id` (`attendee_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    events_organization_tbl_install();
    $table_name = "events_question";
    $sql = "id int(11) unsigned NOT NULL auto_increment,\n\t\t\tsequence INT(11) NOT NULL default '0',\n\t\t\tquestion_type enum('TEXT','TEXTAREA','MULTIPLE','SINGLE','DROPDOWN') NOT NULL default 'TEXT',\n\t\t\tquestion text NOT NULL,\n\t\t\tsystem_name varchar(15) DEFAULT NULL,\n\t\t\tresponse text NULL,\n\t\t\trequired ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'N',\n\t\t\trequired_text text NULL,\n\t\t\tadmin_only ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'N',\n\t\t\twp_user int(22) DEFAULT '1',\n\t\t\tPRIMARY KEY  (id),\n\t\t\tKEY `wp_user` (`wp_user`),\n\t\t\tKEY `system_name` (`system_name`),\n\t\t\tKEY `admin_only` (`admin_only`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_qst_group";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tgroup_name VARCHAR(100) NOT NULL default 'NULL',\n\t\t\t\tgroup_identifier VARCHAR(45) NOT NULL default 'NULL',\n\t\t\t\tgroup_description TEXT,\n\t\t\t\tgroup_order int(11) DEFAULT '0',\n\t\t\t\tshow_group_name TINYINT( 1 ) NOT NULL DEFAULT '1',\n\t\t\t\tshow_group_description TINYINT( 1 ) NOT NULL DEFAULT '1',\n\t\t\t\tsystem_group TINYINT( 1 ) NOT NULL DEFAULT '0',\n\t\t\t\twp_user int(22) DEFAULT '1',\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY `system_group` (`system_group`),\n\t\t\t  \tKEY `wp_user` (`wp_user`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_qst_group_rel";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tgroup_id int(11)  NOT NULL,\n\t\t\t\tquestion_id int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY  (id),\n\t\t\t  \tKEY `group_id` (`group_id`),\n\t\t\t  \tKEY `question_id` (`question_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    $table_name = "events_answer";
    $sql = "id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\tregistration_id varchar(23) NOT NULL,\n\t\t\tattendee_id int(11) NOT NULL default '0',\n\t\t\tquestion_id int(11) NOT NULL default '0',\n\t\t\tanswer text NOT NULL,\n\t\t\tPRIMARY KEY  (id),\n\t\t\tKEY `registration_id` (`registration_id`),\n\t\t\tKEY `attendee_id` (`attendee_id`)";
    event_espresso_run_install($table_name, $table_version, $sql);
    event_espresso_install_system_names();
    event_espresso_create_upload_directories();
    event_espresso_update_shortcodes();
    event_espresso_update_attendee_data();
    espresso_update_attendee_qty();
}