Function Reference: geodir_event_tables_install
Summary
Geo Directory Event Database Install *
Description
Plugin install database tables
Package
GeoDirectory Events
Actions
‘geodir_after_custom_detail_table_create’ [Line: 74]
Filters
‘geodir_before_event_detail_table_create’ [Line: 71]
‘geodir_before_event_schedule_table_create’ [Line: 87]
Source File
geodir_event_tables_install() is located in geodir_event_manager/gdevents-admin/gdevents_db_install.php [Line: 15]
Source Code
function geodir_event_tables_install() { global $wpdb; $wpdb->hide_errors(); $collate = ''; if($wpdb->has_cap( 'collation' )) { if(!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset"; if(!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate"; } require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); // rename db for multisite if($wpdb->query("SHOW TABLES LIKE 'geodir_gd_event_detail'")>0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_gd_event_detail'")==0){$wpdb->query("RENAME TABLE geodir_gd_event_detail TO ".$wpdb->prefix."geodir_gd_event_detail");} if($wpdb->query("SHOW TABLES LIKE 'geodir_event_schedule'")>0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_event_schedule'")==0){$wpdb->query("RENAME TABLE geodir_event_schedule TO ".$wpdb->prefix."geodir_event_schedule");} // Check schedule_id exists and make it auto increment if it does not so we can use dbDelta in the future if($wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_event_schedule'")>0){geodir_add_column_if_not_exist($wpdb->prefix."geodir_event_schedule", "schedule_id", "int(11) PRIMARY KEY AUTO_INCREMENT NOT NULL");} $event_detail = "CREATE TABLE ".EVENT_DETAIL_TABLE." ( post_id int(11) NOT NULL, post_title text NULL DEFAULT NULL, post_status varchar(20) NULL DEFAULT NULL, default_category INT NULL DEFAULT NULL, post_tags text NULL DEFAULT NULL, geodir_link_business varchar(10) NULL DEFAULT NULL, post_location_id int(11) NOT NULL, marker_json text NULL DEFAULT NULL, claimed ENUM( '1', '0' ) NULL DEFAULT '0', businesses ENUM( '1', '0' ) NULL DEFAULT '0', is_featured ENUM( '1', '0' ) NULL DEFAULT '0', featured_image VARCHAR( 254 ) NULL DEFAULT NULL, paid_amount DOUBLE NOT NULL DEFAULT '0', package_id INT(11) NOT NULL DEFAULT '1', alive_days INT(11) NOT NULL DEFAULT '0', paymentmethod varchar(30) NULL DEFAULT NULL, expire_date VARCHAR( 25 ) NULL DEFAULT NULL, is_recurring TINYINT( 1 ) NOT NULL DEFAULT '0', recurring_dates TEXT NOT NULL, event_reg_desc text NULL DEFAULT NULL, event_reg_fees varchar(200) NULL DEFAULT NULL, submit_time varchar(15) NULL DEFAULT NULL, submit_ip varchar(254) NULL DEFAULT NULL, overall_rating float(11) DEFAULT NULL, rating_count INT(11) DEFAULT '0', rsvp_count INT(11) DEFAULT '0', post_locations VARCHAR( 254 ) NULL DEFAULT NULL, post_latitude varchar(20) NULL, post_longitude varchar(20) NULL, post_dummy ENUM( '1', '0' ) NULL DEFAULT '0', PRIMARY KEY (post_id)) $collate "; $event_detail = apply_filters('geodir_before_event_detail_table_create', $event_detail); dbDelta($event_detail); do_action('geodir_after_custom_detail_table_create', 'gd_event', EVENT_DETAIL_TABLE); $event_schedule = "CREATE TABLE ".EVENT_SCHEDULE." ( schedule_id int(11) AUTO_INCREMENT NOT NULL, event_id int(11) NOT NULL, event_date datetime NOT NULL, event_enddate DATE NOT NULL, event_starttime time, event_endtime time, all_day TINYINT( 1 ) NOT NULL DEFAULT '0', recurring TINYINT( 1 ) NOT NULL DEFAULT '0', PRIMARY KEY (schedule_id)) $collate "; $event_schedule = apply_filters('geodir_before_event_schedule_table_create', $event_schedule); dbDelta($event_schedule); update_option( 'geodir_event_recurring_feature', '1' ); }