Function Reference: geodir_event_add_field_in_table

Summary

This function has not been documented yet.

Source File

geodir_event_add_field_in_table() is located in geodir_event_manager/gdevents_hooks_actions.php [Line: 181]

Source Code

function geodir_event_add_field_in_table(){
	global $wpdb, $plugin_prefix;
	
	if ( !get_option( 'geodir_event_recurring_feature' ) ) {
		if ( !$wpdb->get_var( "SHOW COLUMNS FROM " . EVENT_DETAIL_TABLE . " WHERE field = 'is_recurring'" ) ) {
			$wpdb->query( "ALTER TABLE " . EVENT_DETAIL_TABLE . " ADD `is_recurring` TINYINT( 1 ) NOT NULL DEFAULT '0'" );
			
			$wpdb->query( "UPDATE " . EVENT_DETAIL_TABLE . " SET `is_recurring` = 1" );
		}
		
		if ( !$wpdb->get_var( "SHOW COLUMNS FROM " . EVENT_SCHEDULE . " WHERE field = 'event_enddate'" ) ) {
			$wpdb->query( "ALTER TABLE " . EVENT_SCHEDULE . " ADD `event_enddate` DATE NOT NULL" );
			$wpdb->query( "ALTER TABLE " . EVENT_SCHEDULE . " ADD `recurring` TINYINT( 1 ) NOT NULL DEFAULT '0'" );
		}
		if ( !$wpdb->get_var( "SHOW COLUMNS FROM " . EVENT_SCHEDULE . " WHERE field = 'all_day'" ) ) {
			$wpdb->query( "ALTER TABLE " . EVENT_SCHEDULE . " ADD `all_day` TINYINT( 1 ) NOT NULL DEFAULT '0'" );
		}
		
		update_option( 'geodir_event_recurring_feature', '1' );
	}
}