install_blog [ WordPress Function ]
install_blog ( $blog_id, $blog_title = '' )
| Parameters: |
|
| Uses: | |
| Defined at: |
|
Soorgelijke functies: insert_blog, install_blog_defaults, uninstall_plugin, install_dashboard, install_network
Install an empty blog.
Creates the new blog tables and options. If calling this function directly, be sure to use switch_to_blog() first, so that $wpdb points to the new blog.
Source
<?php
function install_blog($blog_id, $blog_title = '') {
global $wpdb, $table_prefix, $wp_roles;
$wpdb->suppress_errors();
// Cast for security
$blog_id = (int) $blog_id;
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") )
die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');
$wpdb->suppress_errors(false);
$url = get_blogaddress_by_id($blog_id);
// Set everything up
make_db_current_silent( 'blog' );
populate_options();
populate_roles();
$wp_roles->_init();
// fix url.
update_option('siteurl', $url);
update_option('home', $url);
update_option('fileupload_url', $url . "files" );
update_option('upload_path', UPLOADBLOGSDIR . "/$blog_id/files");
update_option('blogname', stripslashes( $blog_title ) );
update_option('admin_email', '');
$wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') );
// remove all perms
$wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'user_level' ) );
$wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'capabilities' ) );
$wpdb->suppress_errors( false );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- WPMU Functions/install blog « WordPress Codex
Description. Installs an empty blog at the specified id with an optionally specified title. Parameters. $blog_id: (integer) (required) The id of the blog to be installed.
codex.wordpress.org - Function Reference/install blog « WordPress Codex
Description. Install an empty blog. Creates the new blog tables and options. If calling this function directly, be sure to use switch_to_blog() first, so that $wpdb ...
codex.wordpress.org - #16486 (multisite install_blog() should honor UPLOADBLOGSDIR ...
multisite install_blog() should honor UPLOADBLOGSDIR ... Currently (3.0.4), wp- includes/ms-functions.php's install_blog() just sets 'upload_path' to a ...
core.trac.wordpress.org - install_blog | A HitchHackers guide through WordPress
Feb 12, 2011 ... function install_blog($blog_id, $blog_title = '') { global $wpdb, $table_prefix, $ wp_roles; $wpdb->suppress_errors(); // Cast for security $blog_id ...
hitchhackerguide.com