Changeset 12776 for trunk/wp-admin/includes/upgrade.php
- Timestamp:
- 01/20/2010 08:09:41 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/upgrade.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/upgrade.php
r12756 r12776 97 97 */ 98 98 function wp_install_defaults($user_id) { 99 global $wpdb ;99 global $wpdb, $wp_rewrite, $current_site, $table_prefix; 100 100 101 101 // Default category … … 162 162 $first_post_guid = get_option('home') . '/?p=1'; 163 163 164 if ( is_multisite() ) { 165 $first_post = get_site_option( 'first_post' ); 166 167 if ( empty($first_post) ) 168 $first_post = stripslashes( __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ) ); 169 170 $first_post = str_replace( "SITE_URL", clean_url("http://" . $current_site->domain . $current_site->path), $first_post ); 171 $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post ); 172 } else { 173 $first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'); 174 } 175 164 176 $wpdb->insert( $wpdb->posts, array( 165 177 'post_author' => $user_id, 166 178 'post_date' => $now, 167 179 'post_date_gmt' => $now_gmt, 168 'post_content' => __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'),180 'post_content' => $first_post, 169 181 'post_excerpt' => '', 170 182 'post_title' => __('Hello world!'), … … 182 194 183 195 // Default comment 196 if ( is_multisite() ) { 197 $first_comment_author = get_site_option( 'first_comment_author' ); 198 $first_comment_url = get_site_option( 'first_comment_url' ); 199 $first_comment = get_site_option( 'first_comment' ); 200 } else { 201 $first_comment_author = __('Mr WordPress'); 202 $first_comment_url = 'http://wordpress.org/'; 203 $first_comment = __('Hi, this is a comment.<br />To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.'); 204 } 184 205 $wpdb->insert( $wpdb->comments, array( 185 206 'comment_post_ID' => 1, 186 'comment_author' => __('Mr WordPress'),207 'comment_author' => $first_comment_author, 187 208 'comment_author_email' => '', 188 209 'comment_author_url' => 'http://wordpress.org/', 189 210 'comment_date' => $now, 190 211 'comment_date_gmt' => $now_gmt, 191 'comment_content' => __('Hi, this is a comment.<br />To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.')212 'comment_content' => $first_comment 192 213 )); 214 193 215 // First Page 216 if ( is_multisite() && get_site_option( 'first_page' ) ) 217 $first_page = get_site_option( 'first_page' ); 218 else 219 $first_page = __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'); 194 220 $first_post_guid = get_option('home') . '/?page_id=2'; 195 221 $wpdb->insert( $wpdb->posts, array( … … 197 223 'post_date' => $now, 198 224 'post_date_gmt' => $now_gmt, 199 'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'),225 'post_content' => $first_page, 200 226 'post_excerpt' => '', 201 227 'post_title' => __('About'), … … 210 236 'post_content_filtered' => '' 211 237 )); 238 239 if ( is_multisite() ) { 240 // Flush rules to pick up the new page. 241 $wp_rewrite->init(); 242 $wp_rewrite->flush_rules(); 243 244 $user = new WP_User($user_id); 245 $wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') ); 246 247 // Remove all perms except for the login user. 248 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'user_level') ); 249 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities') ); 250 251 // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id. 252 if ( !is_super_admin( $user_id ) && $user_id != 1 ) 253 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $wpdb->base_prefix.'1_capabilities') ); 254 } 212 255 } 213 256 endif;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)