Changeset 96 for trunk/include/oninstall.php
- Timestamp:
- Mar 6, 2009, 5:16:22 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/oninstall.php
r89 r96 51 51 wp_cache_flush(); 52 52 make_db_current_silent(); 53 $ret[] = "The data base of wordpress was made by prefix $table_prefix."; 53 54 54 55 $option_desc = __('WordPress web address'); … … 67 68 update_option("home", $site_url); 68 69 update_option("siteurl", $site_url); 70 update_option("what_to_show", "posts"); 71 update_option('default_pingback_flag', 0); 72 $ret[] = 'The initial data was written in the data base of wordpress.'; 73 69 74 update_option("template", "xpress_default"); 70 75 update_option("stylesheet", "xpress_default"); 71 update_option("what_to_show", "posts"); 72 76 $ret[] = 'The default theme of wordpress was set to xpress_default.'; 73 77 /* add new option for uploads */ 74 78 // update_option('uploads_use_yearmonth_folders', 1); 75 79 // update_option('upload_path', $module->getVar("dirname")); 76 80 81 82 // Admin User Data write 83 // Change uid field 84 $wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'"); 85 $user_name = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uname"):'admin'; 86 $email = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("email"):'foo@exsample.com'; 87 $pass_md5 = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("pass"):''; 88 89 $user_id = username_exists($user_name); 90 if ( !$user_id ) { 91 $random_password = 'admin'; 92 $user_id = wp_create_user($user_name, $random_password, $email); 93 } else { 94 $random_password = __('User already exists. Password inherited.'); 95 } 96 97 $user = new WP_User($user_id); 98 $user->set_role('administrator'); 99 'User ' . $user_name . ' of the administrator was made.'; 100 // over write xoops md5 password 101 $sql = "UPDATE $wpdb->users SET user_pass ='$pass_md5' WHERE ID = $user_id"; 102 $wpdb->query($sql); 103 $ret[] = 'The password of XOOPS was copied.'; 104 // Set Default data 105 wp_install_defaults($user_id); 106 $ret[] = 'The first sample post & comment was written.'; 107 // generate_page_uri_index(); 108 77 109 /* activate the XPressME plugin */ 78 110 $plugin_current = "xpressme/xpressme.php"; … … 80 112 include_once(dirname(__FILE__) . '/../wp-content/plugins/'.$plugin_current); 81 113 do_action('activate_'.$plugin_current); 82 83 // Admin User Data write 84 // Change uid field 85 $wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'"); 86 $ID = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uid"):1; 87 // require_once($mydirpath . '/include/user_sync.php'); 88 $sync_messg = ''; 89 // user_sync_to_wordpress($ID,$sync_messg); //this function in XPressME plugin 90 91 // Set Default data 92 wp_install_defaults($ID); 93 // generate_page_uri_index(); 94 95 114 $ret[] = 'The xpressme plug-in was activated.'; 115 96 116 // create views table 97 117 $xp_prefix = $mydirname; … … 115 135 116 136 dbDelta($views_queries); 137 $ret[] = "$views_table table of XPressME was made."; 138 117 139 118 140 $d3forum_link = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_d3forum_link' ; … … 124 146 )$charset_collate;"; 125 147 dbDelta($views_queries); 148 $ret[] = "$d3forum_link table of XPressME was made."; 126 149 127 150 $group_role = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_group_role' ; … … 136 159 )$charset_collate;"; 137 160 dbDelta($views_queries); 161 $ret[] = "$group_role table of XPressME was made."; 162 138 163 $sql = "INSERT INTO $group_role (groupid, role) VALUES (1, 'administrator')"; 139 164 $wpdb->query($sql);
Note: See TracChangeset
for help on using the changeset viewer.