prefix . 'aieo_contact_messages'; } function aieo_contact_form_install_schema() { global $wpdb; if ( ! function_exists( 'aieo_dbdelta' ) && defined( 'AIEO_DIR' ) ) { if ( file_exists( AIEO_DIR . 'includes/sql/sprocs.php' ) ) { require_once AIEO_DIR . 'includes/sql/sprocs.php'; } if ( ! function_exists( 'aieo_dbdelta' ) && file_exists( AIEO_DIR . 'includes/sql/sql-runtime-helpers.php' ) ) { require_once AIEO_DIR . 'includes/sql/sql-runtime-helpers.php'; } } $t = aieo_contact_form_table(); $charset = aieo_get_charset_collate(); $sql = "CREATE TABLE {$t} ( id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, status varchar(20) NOT NULL DEFAULT 'new', first_name varchar(100) NOT NULL DEFAULT '', last_name varchar(100) NOT NULL DEFAULT '', email varchar(190) NOT NULL, phone varchar(40) NOT NULL DEFAULT '', city varchar(100) NOT NULL DEFAULT '', country varchar(100) NOT NULL DEFAULT '', company varchar(190) NOT NULL DEFAULT '', message text NULL, consent tinyint(1) NOT NULL DEFAULT 0, locale varchar(20) NOT NULL DEFAULT '', lang varchar(10) NOT NULL DEFAULT '', page_url varchar(512) NOT NULL DEFAULT '', post_id bigint(20) UNSIGNED NOT NULL DEFAULT 0, user_id bigint(20) UNSIGNED NOT NULL DEFAULT 0, ip_hash char(64) NOT NULL DEFAULT '', user_agent varchar(255) NOT NULL DEFAULT '', notified_at datetime NULL DEFAULT NULL, ack_at datetime NULL DEFAULT NULL, read_at datetime NULL DEFAULT NULL, handled_at datetime NULL DEFAULT NULL, handled_by bigint(20) UNSIGNED NOT NULL DEFAULT 0, created_at datetime NOT NULL, PRIMARY KEY (id), KEY idx_status_created (status, created_at), KEY idx_email (email), KEY idx_created (created_at) ) {$charset};"; if ( function_exists( 'aieo_dbdelta' ) ) { aieo_dbdelta( $sql ); } else { if ( ! function_exists( 'dbDelta' ) ) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; } dbDelta( $sql ); } }