*/ class Ace_User_Management_Activator { /** * Short Description. (use period) * * Long Description. * * @since 1.0.0 */ public static function activate() { global $wpdb; $tableName = $wpdb->prefix."ace_reset_password"; if( count( $wpdb->get_results( 'SHOW TABLE LINK "$tableName"')) == null){ $sqlCreateTable = " CREATE TABLE `$tableName` ( `id` int(20) NOT NULL AUTO_INCREMENT, `user_id` int(20) NOT NULL, `email` varchar(100) NOT NULL, `randomCode` varchar(100) NOT NULL, `currentTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 "; require_once (ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sqlCreateTable); } $tableName2 = $wpdb->prefix."ace_register_fields"; if( count( $wpdb->get_results( 'SHOW TABLE LINK "$tableName2"')) == null ){ $sqlCreateTable2 = " CREATE TABLE `$tableName2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `input_label` varchar(255) NOT NULL, `input_placeholder` varchar(255) NOT NULL, `input_name` varchar(255) NOT NULL, `input_type` varchar(255) NOT NULL, `dropdown_options` varchar(255) NOT NULL, `sortby` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1"; require_once (ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sqlCreateTable2); } $pages = [ 'ace-register' => ['Registration', '[ace-registration-public-form]'], 'ace-login' => ['Login', '[ace-login-public-form]'], 'ace-forgetpass' => ['Forget password', '[ace-forget-password]'], 'ace-confirm-password' => ['Confirm Password', '[ace-random-code-page]'], 'ace-profile' => ['Profile', '[ace-profile-page]'] ]; $page_ids = []; foreach ($pages as $slug => $data) { $existing_page = get_page_by_path($slug); if (!$existing_page) { $page = [ 'post_title' => $data[0], 'post_name' => $slug, 'post_content' => $data[1], 'post_status' => 'publish', 'post_slug' => $slug, 'post_type' => 'page' ]; $page_id = wp_insert_post($page); $page_ids["{$slug}_page_id"] = $page_id; } } if (!empty($page_ids)) { add_option('ace_auto_page_create', $page_ids); } } }