当前位置: 首页>>代码示例>>PHP>>正文


PHP wpmu_create_blog函数代码示例

本文整理汇总了PHP中wpmu_create_blog函数的典型用法代码示例。如果您正苦于以下问题:PHP wpmu_create_blog函数的具体用法?PHP wpmu_create_blog怎么用?PHP wpmu_create_blog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wpmu_create_blog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: msxmlrpc_create_blog

/**
 * Creates a new blog calling wpmu_create_blog
 * the wpmu_create_blog parameters are:
 * $domain  The domain of the new blog.
 * $path    The path of the new blog.
 * $title   The title of the new blog.
 * $user_id The user id of the user account who will be the blog admin. (you can use an email instead of the user_id. If so, a new user will be created)
 * $meta    Other meta information.
 * $site_id The site_id of the blog to be created.
 *
 * @param array $args Array with username, password and wpmu_create_blog function parameters
 * @return mixed The new blog id or an error message
 */
function msxmlrpc_create_blog($args)
{
    $parameters = check_arguments($args);
    if (!is_array($parameters)) {
        return $parameters;
    }
    // if the user_id is the user's e-mail
    if (!is_int($parameters['user_id'])) {
        if (!($user_id = get_user_id_from_string($parameters['user_id']))) {
            $error = wpmu_validate_user_signup($parameters['path'], $parameters['user_id']);
            if (is_wp_error($error)) {
                return new IXR_Error(500, $error->get_error_message());
            }
            $user_id = wpmu_create_user($parameters['path'], wp_generate_password(), $parameters['user_id']);
        }
        $parameters['user_id'] = $user_id;
    }
    if (get_blog_id($parameters['domain'], $parameters['path']) !== false) {
        return new IXR_Error(500, __("Site already exists."));
    }
    if (!isset($parameters['meta'])) {
        $parameters['meta'] = "";
    }
    if (!isset($parameters['site_id'])) {
        $parameters['site_id'] = 1;
    }
    return wpmu_create_blog($parameters['domain'], $parameters['path'], $parameters['title'], $parameters['user_id'], $parameters['meta'], $parameters['site_id']);
}
开发者ID:renanivo,项目名称:WP-Multisite-XML-RPC,代码行数:41,代码来源:multisite-xml-rpc.php

示例2: createSubDirectorySite

 public static function createSubDirectorySite($dir = '/mysite/', $title = 'Multisite Subdir Test')
 {
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     $blog_id = wpmu_create_blog('example.org', $dir, $title, 1);
     switch_to_blog($blog_id);
     return $blog_id;
 }
开发者ID:Butterwell,项目名称:timber,代码行数:7,代码来源:test-timber-multisite.php

示例3: createSubDirectorySite

 function createSubDirectorySite()
 {
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     $blog_id = wpmu_create_blog('example.org', '/mysite/', 'Multisite Test', 1);
     $this->assertGreaterThan(1, $blog_id);
     switch_to_blog($blog_id);
     return $blog_id;
 }
开发者ID:pensesmart,项目名称:timber,代码行数:8,代码来源:test-timber-image-multisite.php

示例4: create_object

 function create_object($args)
 {
     global $wpdb;
     $meta = isset($args['meta']) ? $args['meta'] : array('public' => 1);
     $user_id = isset($args['user_id']) ? $args['user_id'] : get_current_user_id();
     // temp tables will trigger db errors when we attempt to reference them as new temp tables
     $suppress = $wpdb->suppress_errors();
     $blog = wpmu_create_blog($args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id']);
     $wpdb->suppress_errors($suppress);
     // Tell WP we're done installing.
     wp_installing(false);
     return $blog;
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:13,代码来源:class-wp-unittest-factory-for-blog.php

示例5: create_object

 function create_object($args)
 {
     /**
      * @var \wpdb $wpdb
      */
     global $wpdb;
     $meta = isset($args['meta']) ? $args['meta'] : array();
     $user_id = isset($args['user_id']) ? $args['user_id'] : get_current_user_id();
     // temp tables will trigger db errors when we attempt to reference them as new temp tables
     $suppress = $wpdb->suppress_errors();
     $blog = wpmu_create_blog($args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id']);
     $wpdb->suppress_errors($suppress);
     return $blog;
 }
开发者ID:artofwp,项目名称:wp-testing,代码行数:14,代码来源:WP_UnitTest_Factory_For_Blog.php

示例6: jb_create_blog

function jb_create_blog($domain, $title)
{
    global $wpdb;
    //	$wpdb->db_connect();
    $domain = $domain . "." . HOST;
    $n = wpmu_create_blog($domain, '/', $title, '1', array('public' => 1), '1');
    if (!is_int($n)) {
        if (DEBUG) {
            printf("Could not create blog " . $domain . "!");
        }
        return -1;
    }
    if (DEBUG) {
        printf("Created blog number: %d\n", $n);
    }
    return $n;
}
开发者ID:jonasbjork,项目名称:wpmigrate,代码行数:17,代码来源:functions.php

示例7: _createObject

 /**
  * Generates a new blog.
  *
  * @since 1.0.0
  *
  * @access protected
  * @global \wpdb $wpdb The database connection.
  * @param array $args The array of arguments to use during a new blog creation.
  * @return int|\WP_Error The newly created blog's ID on success, otherwise a WP_Error object.
  */
 protected function _createObject($args)
 {
     global $wpdb;
     $meta = isset($args['meta']) ? $args['meta'] : array();
     $user_id = isset($args['user_id']) ? $args['user_id'] : get_current_user_id();
     // temp tables will trigger db errors when we attempt to reference them as new temp tables
     $suppress = $wpdb->suppress_errors();
     $blog = wpmu_create_blog($args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id']);
     $wpdb->suppress_errors($suppress);
     if ($blog && !is_wp_error($blog)) {
         $this->_debug('Generated blog ID: ' . $blog);
     } elseif (is_wp_error($blog)) {
         $this->_debug('Blog generation failed with message [%s] %s', $blog->get_error_code(), $blog->get_error_messages());
     } else {
         $this->_debug('Blog generation failed');
     }
     return $blog;
 }
开发者ID:gedex,项目名称:wp-codeception,代码行数:28,代码来源:Blog.php

示例8: create_site

 /**
  * Creates new MLP site for the provided language
  *
  * @param string $language
  *
  * @return int
  */
 public function create_site($language)
 {
     if ($this->site_exists($language)) {
         return -1;
     }
     $active = (int) $language['active'];
     $lng_code = $language['language_code'];
     $is_multisite_on_subdomain = $this->check_is_subdomain_multisite_running();
     $current_site = get_current_site();
     $domain = $is_multisite_on_subdomain ? $lng_code . $current_site->domain : $current_site->domain;
     $path = $is_multisite_on_subdomain ? "/" : "/" . $lng_code;
     $user_id = get_current_user_id();
     $this->set_or_update_post_obj($language, $current_site);
     $blog_id = wpmu_create_blog($domain, $path, "My " . $language['translated_name'] . " site", $user_id, array('public' => $active, 'lang_id' => $language['id']), $current_site->id);
     if (0 < $blog_id) {
         $this->set_after_blog_created_vars($language, $current_site, $blog_id);
         //$this->network_new_site_controler->update( $blog_id );
         Wpml2mlp_Helper::update_flag($blog_id, $language['country_flag_url']);
     }
     return $blog_id;
 }
开发者ID:JonZiemlich,项目名称:wpml2mlp,代码行数:28,代码来源:Wpml2mlp_Site_Creator.php

示例9: ns_wp_create_site

/**
 * Create site
 */
function ns_wp_create_site($site_name, $site_title, $logfile)
{
    $user = apply_filters('ns_wp_create_site_admin', wp_get_current_user());
    $site_meta = apply_filters('ns_wp_create_site_meta', array("public" => 1));
    // use wp's built in wpmu_validate_blog_signup validation for all new site vars
    // also, use a test on  a known valid name/title to filter out any validation errors added by other plugins via the wpmu_validate_blog_signup filter
    $baseline_validation = wpmu_validate_blog_signup('1000000', 'NS Cloner Test');
    $site_data = wpmu_validate_blog_signup($site_name, $site_title, $user);
    $site_errors = array_diff($baseline_validation['errors']->get_error_messages(), $site_data['errors']->get_error_messages());
    if (!empty($site_errors) && false) {
        ns_log_write(array("Error creating site with name '{$site_name}' and title '{$site_title}'. One or more problems errors detected by WP:", $site_errors), $logfile);
        return false;
    }
    $site_id = wpmu_create_blog($site_data["domain"], $site_data["path"], $site_title, $site_data["user"]->ID, $site_meta, get_current_site()->id);
    if (!is_wp_error($site_id)) {
        ns_log_write("New site with name '{$site_name}' and title '{$site_title}' (" . get_site_url($site_id) . ") successfully created!", $logfile);
        return $site_id;
    } else {
        ns_log_write("Error creating site with domain '{$site_name}' and path '{$site_title}' - " . $site_id->get_error_message(), $logfile);
        return false;
    }
}
开发者ID:AlexanderDolgan,项目名称:ojahuri,代码行数:25,代码来源:ns-wp-utils.php

示例10: test_sends_stats_data_on_heartbeat_on_multisite

 public function test_sends_stats_data_on_heartbeat_on_multisite()
 {
     global $wpdb;
     if (!is_multisite()) {
         $this->markTestSkipped('Run it in multi site mode');
     }
     $user_id = $this->factory->user->create();
     $mu_blog_user_id = $this->factory->user->create();
     // create a different blog
     $suppress = $wpdb->suppress_errors();
     $other_blog_id = wpmu_create_blog('foo.com', '', "My Blog", $user_id);
     $wpdb->suppress_errors($suppress);
     // create a user from within that blog (won't be synced)
     switch_to_blog($other_blog_id);
     add_user_to_blog($other_blog_id, $mu_blog_user_id, 'administrator');
     $heartbeat = Jetpack_Heartbeat::init();
     $heartbeat->cron_exec();
     $this->sender->do_sync();
     $action = $this->server_event_storage->get_most_recent_event('jetpack_sync_heartbeat_stats');
     restore_current_blog();
     $this->assertEquals(JETPACK__VERSION, $action->args[0]['version']);
     $this->assertFalse(isset($action->args[0]['users']));
 }
开发者ID:automattic,项目名称:jetpack,代码行数:23,代码来源:test_class.jetpack-sync-modules-stats.php

示例11: bp_blogs_validate_blog_signup

/**
 * Process a blog registration submission.
 *
 * Passes submitted values to {@link wpmu_create_blog()}.
 *
 * @return bool True on success, false on failure.
 */
function bp_blogs_validate_blog_signup()
{
    global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path, $current_site;
    if (!check_admin_referer('bp_blog_signup_form')) {
        return false;
    }
    $current_user = wp_get_current_user();
    if (!is_user_logged_in()) {
        die;
    }
    $result = bp_blogs_validate_blog_form();
    extract($result);
    if ($errors->get_error_code()) {
        unset($_POST['submit']);
        bp_show_blog_signup_form($blogname, $blog_title, $errors);
        return false;
    }
    $public = (int) $_POST['blog_public'];
    $meta = apply_filters('signup_create_blog_meta', array('lang_id' => 1, 'public' => $public));
    // depreciated
    /**
     * Filters the default values for Blog meta.
     *
     * @since BuddyPress (1.0.0)
     *
     * @param array $meta {
     *      string $value  Default blog language ID.
     *      string $public Default public status.
     * }
     */
    $meta = apply_filters('add_signup_meta', $meta);
    // If this is a subdomain install, set up the site inside the root domain.
    if (is_subdomain_install()) {
        $domain = $blogname . '.' . preg_replace('|^www\\.|', '', $current_site->domain);
    }
    wpmu_create_blog($domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid);
    bp_blogs_confirm_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
    return true;
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:46,代码来源:bp-blogs-template.php

示例12: step3

function step3()
{
    global $wpdb, $current_site, $dirs, $wpmu_version;
    $base = stripslashes(dirname($_SERVER["SCRIPT_NAME"]));
    if ($base != "/") {
        $base .= "/";
    }
    $domain = get_clean_basedomain();
    $email = $wpdb->escape($_POST['email']);
    if ($email == '') {
        die('You must enter an email address!');
    }
    // set up site tables
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'site_name', '" . $wpdb->escape($_POST['weblog_title']) . "')");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'admin_email', '" . $email . "')");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'admin_user_id', '1')");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'registration', 'none')");
    $wpdb->query("INSERT INTO " . $wpdb->site . " ( id, domain, path ) VALUES ( NULL, '{$domain}', '{$base}' )");
    $wpdb->query("INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (1, 'Uncategorized', 'uncategorized', NOW())");
    $wpdb->query("INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (2, 'Blogroll', 'blogroll', NOW())");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'upload_filetypes', 'jpg jpeg png gif mp3 mov avi wmv midi mid pdf' )");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'blog_upload_space', '10' )");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'fileupload_maxk', '1500' )");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'site_admins', '" . serialize(array('admin')) . "' )");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'allowedthemes', '" . serialize(array('classic' => 1, 'default' => 1)) . "' )");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'illegal_names', '" . serialize(array("www", "web", "root", "admin", "main", "invite", "administrator")) . "' )");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'welcome_email', 'Dear User,\n\nYour new SITE_NAME blog has been successfully set up at:\nBLOG_URL\n\nYou can log in to the administrator account with the following information:\nUsername: USERNAME\nPassword: PASSWORD\nLogin Here: BLOG_URLwp-login.php\n\nWe hope you enjoy your new blog.\nThanks!\n\n--The Team @ SITE_NAME')");
    $wpdb->query("INSERT INTO " . $wpdb->sitemeta . " (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'first_post', 'Welcome to <a href=\"SITE_URL\">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' )");
    $weblog_title = stripslashes($_POST['weblog_title']);
    $pass = substr(md5(rand()), 5, 12);
    $user_id = wpmu_create_user('admin', $pass, $email);
    $current_site->domain = $domain;
    $current_site->path = $base;
    $current_site->site_name = ucfirst($domain);
    wpmu_create_blog($domain, $base, $weblog_title, $user_id, array('blog_public' => 1, 'public' => 1));
    update_blog_option(1, 'template', 'home');
    update_blog_option(1, 'stylesheet', 'home');
    if (constant('VHOST') == 'yes') {
        update_blog_option(1, 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
    } else {
        update_blog_option(1, 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/');
    }
    update_blog_option(1, 'rewrite_rules', '');
    $msg = "Your new WordPress MU site has been created at\nhttp://{$domain}{$base}\n\nLogin details:\nUsername: admin\nPassword: {$pass}\nLogin: http://{$domain}{$base}wp-login.php\n";
    wp_mail($email, "Your new WordPress MU site is ready!", $msg, "From: wordpress@" . $_SERVER['HTTP_HOST']);
    ?>
	<h2>Installation Finished!</h2>
	<p>Congratulations! <br />Your <a href='http://<?php 
    echo $domain . $base;
    ?>
'>WordPress &micro; site</a> has been configured.</p>
	<p>You can <a class="button" href='wp-login.php'>log in</a> using the username "admin" and password <?php 
    echo $pass;
    ?>
</p>
	
	<h2>Directory Permissions</h2>
	<p>Please remember to reset the permissions on the following directories:
		<ul>
		<?php 
    reset($dirs);
    foreach ((array) $dirs as $dir) {
        echo "<li>{$dir}</li>";
    }
    ?>
		</ul>
	</p>
	<p>You can probably use the following command to fix the permissions but check with your host if it doubt:
		<br />
		<code>chmod&nbsp;755&nbsp;
			<?php 
    reset($dirs);
    foreach ((array) $dirs as $dir) {
        echo "{$dir}&nbsp;";
    }
    ?>
		</code>
	</p>
	
	<h2>Further reading</h2>
	<p>
		<ul>
			<li>If you run into problems, please search the <a href='http://mu.wordpress.org/forums/'>WordPress &micro; Forums</a> where you will most likely find a solution. Please don't post there before searching. It's not polite.</li>
			<li>There is also the <a href='http://trac.mu.wordpress.org/'>WordPress &micro; Trac</a>. That's our bug tracker.</li>
		</ul>
	</p>
	<p>Thanks for installing WordPress &micro;!<br /><br />Donncha<br /><code>wpmu version: <?php 
    echo $wpmu_version;
    ?>
</code></p>
	<?php 
}
开发者ID:joelglennwright,项目名称:agencypress,代码行数:92,代码来源:index-install.php

示例13: lti_parse_request_OLD


//.........这里部分代码省略.........
                    $msg .= "<p> {$erroMsg}</p>";
                }
                $msg .= "</p>";
            }
            wp_die($msg);
        }
        $uinfo = get_user_by('login', $userkey);
    }
    //Eliminem del blog Principal (si no es admin) http://jira.uoc.edu/jira/browse/BLOGA-218
    if (!$is_admin) {
        $user = new WP_User($uinfo->ID);
        $user->remove_all_caps();
    }
    $_SERVER['REMOTE_USER'] = $userkey;
    $password = md5($uinfo->user_pass);
    // User is now authorized; force WordPress to use the generated password
    //login, set cookies, and set current user
    wp_authenticate($userkey, $password);
    wp_set_auth_cookie($user->ID, false);
    wp_set_current_user($user->ID, $userkey);
    $siteUrl = substr(get_option("siteurl"), 7);
    // - "http://"
    $siteUrlArray = explode("/", $siteUrl);
    $domain = $siteUrlArray[0];
    unset($siteUrlArray[0]);
    //error_log("og LTI domain: ". $domain);
    $course = $blogType->getCoursePath($context, $siteUrlArray, $domain);
    if (isset($context->info[RESOURCE_LINK_ID]) && $context->info[RESOURCE_LINK_ID]) {
        $course .= '-' . $context->info[RESOURCE_LINK_ID];
    }
    $course = sanitize_user($course, true);
    //Bug wordpress doesn't get stye sheet if has a dot
    $course = str_replace('.', '_', $course);
    $path_base = "/" . implode("/", $siteUrlArray) . "/" . $course;
    $path_base = str_replace('//', '/', $path_base);
    $path = $path_base . "/";
    $path = str_replace('//', '/', $path);
    $blog_created = false;
    $overwrite_plugins_theme = isset($context->info[OVERWRITE_PLUGINS_THEME]) ? $context->info[OVERWRITE_PLUGINS_THEME] == 1 : false;
    $overwrite_roles = isset($context->info[OVERWRITE_ROLES]) ? $context->info[OVERWRITE_ROLES] == 1 : false;
    $blog_id = domain_exists($domain, $path);
    $blog_is_new = false;
    if (!isset($blog_id)) {
        $title = __("Blog ") . $blogType->getCourseName($context);
        $blog_is_new = true;
        $meta = $blogType->getMetaBlog($context);
        $old_site_language = get_site_option('WPLANG');
        $blogType->setLanguage($context);
        $blog_id = wpmu_create_blog($domain, $path, $title, $user_id, $meta);
        update_site_option('WPLANG', $old_site_language);
        $blogType->checkErrorCreatingBlog($blog_id, $path);
        $blog_created = true;
    }
    // Connect the user to the blog
    if (isset($blog_id)) {
        switch_to_blog($blog_id);
        ob_start();
        if ($overwrite_plugins_theme || $blog_created) {
            $blogType->loadPlugins();
            $blogType->changeTheme();
        }
        //Agafem el rol anterior
        $old_role = null;
        if (!$blog_created && !$overwrite_roles) {
            $old_role_array = get_usermeta($user->id, 'wp_' . $blog_id . '_capabilities');
            if (count($old_role_array) > 0) {
                foreach ($old_role_array as $key => $value) {
                    if ($value == true) {
                        $old_role = $key;
                    }
                }
            }
        }
        remove_user_from_blog($uinfo->ID, $blog_id);
        $obj = new stdClass();
        $obj->blog_id = $blog_id;
        $obj->userkey = $userkey;
        $obj->path_base = $path_base;
        $obj->domain = $domain;
        $obj->context = $context;
        $obj->uinfoID = $uinfo->ID;
        $obj->blog_is_new = $blog_is_new;
        if ($overwrite_roles || $old_role == null) {
            $obj->role = $blogType->roleMapping($context->info[FIELD_ROLE_UOC_CAMPUS], $context->info);
        } else {
            $obj->role = $old_role;
        }
        $blogType->postActions($obj);
        add_user_to_blog($blog_id, $uinfo->ID, $obj->role);
        //Si posem el restore_current_blog ens va al principi
        //    	restore_current_blog();
        ob_end_clean();
    }
    $redirecturl = get_option("siteurl");
    //error_log("og LTI redirect URL: ".$redirecturl);
    $redirecturl = str_replace("http://", "https://", $redirecturl);
    //error_log("og LTI new redirect URL: ".$redirecturl);
    wp_redirect($redirecturl);
    exit;
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:101,代码来源:IMSBasicLTI.php

示例14: validate_another_blog_signup

/**
 * Validate a new blog signup
 *
 * @since MU
 *
 * @return null|boolean True if blog signup was validated, false if error.
 *                      The function halts all execution if the user is not logged in.
 */
function validate_another_blog_signup() {
	global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
	$current_user = wp_get_current_user();
	if ( ! is_user_logged_in() ) {
		die();
	}

	$result = validate_blog_form();

	// Extracted values set/overwrite globals.
	$domain = $result['domain'];
	$path = $result['path'];
	$blogname = $result['blogname'];
	$blog_title = $result['blog_title'];
	$errors = $result['errors'];

	if ( $errors->get_error_code() ) {
		signup_another_blog($blogname, $blog_title, $errors);
		return false;
	}

	$public = (int) $_POST['blog_public'];

	$blog_meta_defaults = array(
		'lang_id' => 1,
		'public'  => $public
	);

	/**
	 * Filter the new site meta variables.
	 *
	 * @since MU
	 * @deprecated 3.0.0 Use the 'add_signup_meta' filter instead.
	 *
	 * @param array $blog_meta_defaults An array of default blog meta variables.
	 */
	$meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults );
	/**
	 * Filter the new default site meta variables.
	 *
	 * @since 3.0.0
	 *
	 * @param array $meta {
	 *     An array of default site meta variables.
	 *
	 *     @type int $lang_id     The language ID.
	 *     @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
	 * }
	 */
	$meta = apply_filters( 'add_signup_meta', $meta_defaults );

	wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
	confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
	return true;
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:63,代码来源:wp-signup.php

示例15: create_new_multisite

 public static function create_new_multisite($user_id, $config, $lead, $password)
 {
     global $current_site;
     $form = RGFormsModel::get_form_meta($lead['form_id']);
     $ms_options = rgars($config, 'meta/multisite_options');
     $is_update_feed = rgars($config, 'meta/feed_type') == 'update';
     $user = new WP_User($user_id);
     $password_field = rgars($config, 'meta/password');
     $set_password = $password_field && rgar($lead, $password_field);
     $password = $password ? $password : rgar($lead, $password_field);
     // @review, verify what this is doing and notate here
     if (!$set_password) {
         remove_filter('update_welcome_email', 'bp_core_filter_blog_welcome_email');
     }
     // is create site option enabled?
     if (!rgar($ms_options, 'create_site')) {
         return false;
     }
     $site_data = self::get_site_data($lead, $form, $config, $is_update_feed);
     if (!$site_data) {
         return false;
     }
     // create the new site!
     $meta = apply_filters('gform_user_registration_new_site_meta', array('public' => 1), $form, $lead, $config, $user_id, $is_update_feed);
     $blog_id = wpmu_create_blog($site_data['domain'], $site_data['path'], $site_data['title'], $user_id, $meta, $current_site->id);
     if (is_wp_error($blog_id)) {
         return false;
     }
     // add entry ID to site meta for new site
     GFUserData::update_site_meta($blog_id, 'entry_id', $lead['id']);
     if (!is_super_admin($user_id) && get_user_option('primary_blog', $user_id) == $current_site->blog_id) {
         update_user_option($user_id, 'primary_blog', $blog_id, true);
     }
     if (rgar($ms_options, 'site_role')) {
         $user = new WP_User($user_id, null, $blog_id);
         $user->set_role(rgar($ms_options, 'site_role'));
     }
     $root_role = rgar($ms_options, 'root_role');
     // if no root role, remove user from current site
     if (!$root_role) {
         remove_user_from_blog($user_id);
     } else {
         if ($root_role == 'gfur_preserve_role') {
         } else {
             $user = new WP_User($user_id);
             $user->set_role($root_role);
         }
     }
     self::log_debug("Calling wpmu_welcome_notification to send multisite welcome - blog_id: {$blog_id} user_id: {$user_id}");
     wpmu_welcome_notification($blog_id, $user_id, $password, $site_data['title'], array('public' => 1));
     self::log_debug("Done with wpmu_welcome_notification");
     do_action('gform_site_created', $blog_id, $user_id, $lead, $config, $password);
     // return new blog ID
     return $blog_id;
 }
开发者ID:Inteleck,项目名称:hwc,代码行数:55,代码来源:userregistration.php


注:本文中的wpmu_create_blog函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。