bp_new_site( int $blog_id, int $user_id, string $domain, string $path, int $site_id, array $meta )

When a new site is created in a multisite installation, run the activation routine on that site.

Description

Parameters

$blog_id

(int) (Required) ID of the blog being installed to.

$user_id

(int) (Required) ID of the user the install is for.

$domain

(string) (Required) Domain to use with the install.

$path

(string) (Required) Path to use with the install.

$site_id

(int) (Required) ID of the site being installed to.

$meta

(array) (Required) Metadata to use with the site creation.

Source

File: bp-core/admin/bp-core-admin-actions.php

function bp_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {

	// Bail if plugin is not network activated.
	if ( ! is_plugin_active_for_network( buddypress()->basename ) )
		return;

	// Switch to the new blog.
	switch_to_blog( $blog_id );

	/**
	 * Fires the activation routine for a new site created in a multisite installation.
	 *
	 * @since BuddyPress 1.7.0
	 *
	 * @param int    $blog_id ID of the blog being installed to.
	 * @param int    $user_id ID of the user the install is for.
	 * @param string $domain  Domain to use with the install.
	 * @param string $path    Path to use with the install.
	 * @param int    $site_id ID of the site being installed to.
	 * @param array  $meta    Metadata to use with the site creation.
	 */
	do_action( 'bp_new_site', $blog_id, $user_id, $domain, $path, $site_id, $meta );

	// Restore original blog.
	restore_current_blog();
}

Changelog

Changelog
Version Description
BuddyPress 1.7.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.