bbp_new_site

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

Description

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

Parameters (6)

0. $blog_id (int)
The blog id.
1. $user_id (int)
The user id.
2. $domain (string)
The domain.
3. $path (string)
The path.
4. $site_id (int)
The site id.
5. $meta (array())
The meta.

Usage

  1. if ( !function_exists( 'bbp_new_site' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/admin/actions.php'; 
  3.  
  4. // The blog id. 
  5. $blog_id = -1; 
  6.  
  7. // The user id. 
  8. $user_id = -1; 
  9.  
  10. // The domain. 
  11. $domain = ''; 
  12.  
  13. // The path. 
  14. $path = ''; 
  15.  
  16. // The site id. 
  17. $site_id = -1; 
  18.  
  19. // The meta. 
  20. $meta = null; 
  21.  
  22. // NOTICE! Understand what this does before running. 
  23. $result = bbp_new_site($blog_id, $user_id, $domain, $path, $site_id, $meta); 
  24.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/actions.php  
  1. function bbp_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { 
  2.  
  3. // Bail if plugin is not network activated 
  4. if ( ! is_plugin_active_for_network(bbpress)->basename ) ) 
  5. return; 
  6.  
  7. // Switch to the new blog 
  8. switch_to_blog( $blog_id ); 
  9.  
  10. // Do the bbPress activation routine 
  11. do_action( 'bbp_new_site', $blog_id, $user_id, $domain, $path, $site_id, $meta ); 
  12.  
  13. // restore original blog 
  14. restore_current_blog();