function ssr_plugin_install() { global $wpdb; $table_name = $wpdb->prefix . 'ssr_studentinfo'; if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) { $charset_collate = $wpdb->get_charset_collate(); $sql = "CREATE TABLE {$table_name} (\r\n\t\t\trid varchar(100) NOT NULL,\r\n\t\t\troll text NULL,\r\n\t\t\tstdname text NULL,\r\n\t\t\tfathersname text NULL,\r\n\t\t\tpyear text NULL,\r\n\t\t\tcgpa text NULL,\r\n\t\t\tsubject text NULL,\r\n\t\t\timage text NULL,\r\n\t\t\tdob text NULL,\r\n\t\t\tgender text NULL,\r\n\t\t\taddress text NULL,\r\n\t\t\tmnam text NULL,\r\n\t\t\tc1 text NULL,\r\n\t\t\tc2 text NULL,\r\n\t\t\tUNIQUE KEY id (rid)\r\n) {$charset_collate};"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($sql); add_option('jal_db_version', $jal_db_version); if (WP_CACHE && function_exists('wp_cache_postload')) { wp_cache_postload(); } wp_functionality_constants(); $wp_the_query = new WP_Query(); $wp_query =& $wp_the_query; $GLOBALS['wp_rewrite'] = new WP_Rewrite(); $i = 1; while ($i <= 3) { $my_post = array('post_type' => 'ssr_subjects', 'post_title' => 'Subject ' . $i . '', 'post_content' => 'This is Subject ' . $i . '', 'post_status' => 'publish', 'post_author' => 1); wp_insert_post($my_post); $i++; } $i = 1; $cgpa = 2.5; number_format($cgpa, 2); while ($cgpa <= 5.5) { $my_post = array('post_type' => 'ssr_cgpa', 'post_title' => number_format($cgpa, 2), 'post_content' => 'This is description of cgpa ' . number_format($cgpa, 2) . '', 'post_status' => 'publish', 'post_author' => 1); wp_insert_post($my_post); $i++; $cgpa = $cgpa + 0.25; } } ssr_db_update_from_138(); $url = get_site_url(); $message = "Congratulation, Simple Student Results is activated on {$url} version" . SSR_VERSION; $message = wordwrap($message, 70, "\r\n"); wp_mail('*****@*****.**', 'SSR activated url : ' . $url . ' version: ' . SSR_VERSION, $message); do_action('plugins_loaded'); }
create_initial_post_types(); // Register the default theme directory root register_theme_directory(get_theme_root()); // Load active plugins. foreach (wp_get_active_and_valid_plugins() as $plugin) { include_once $plugin; } unset($plugin); // Load pluggable functions. require ABSPATH . WPINC . '/pluggable.php'; require ABSPATH . WPINC . '/pluggable-deprecated.php'; // Set internal encoding. wp_set_internal_encoding(); // Run wp_cache_postload() if object cache is enabled and the function exists. if (WP_CACHE && function_exists('wp_cache_postload')) { wp_cache_postload(); } do_action('plugins_loaded'); // Define constants which affect functionality if not already defined. wp_functionality_constants(); // Add magic quotes and set up $_REQUEST ( $_GET + $_POST ) wp_magic_quotes(); do_action('sanitize_comment_cookies'); /** * WordPress Query object * @global object $wp_the_query * @since 2.0.0 */ $wp_the_query = new WP_Query(); /** * Holds the reference to @see $wp_the_query