bp_blogs_validate_blog_signup

Process a blog registration submission.

Description

bp_blogs_validate_blog_signup(); 

Passes submitted values to .


Usage

  1. if ( !function_exists( 'bp_blogs_validate_blog_signup' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_blogs_validate_blog_signup(); 
  7.  

Defined (1)

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

/bp-blogs/bp-blogs-template.php  
  1. function bp_blogs_validate_blog_signup() { 
  2. global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path, $current_site; 
  3.  
  4. if ( !check_admin_referer( 'bp_blog_signup_form' ) ) 
  5. return false; 
  6.  
  7. $current_user = wp_get_current_user(); 
  8.  
  9. if( !is_user_logged_in() ) 
  10. die(); 
  11.  
  12. extract($result); 
  13.  
  14. if ( $errors->get_error_code() ) { 
  15. unset($_POST['submit']); 
  16. bp_show_blog_signup_form( $blogname, $blog_title, $errors ); 
  17. return false; 
  18.  
  19. $public = (int) $_POST['blog_public']; 
  20.  
  21. // Depreciated. 
  22. $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); 
  23.  
  24. /** 
  25. * Filters the default values for Blog meta. 
  26. * @since 1.0.0 
  27. * @param array $meta { 
  28. * string $value Default blog language ID. 
  29. * string $public Default public status. 
  30. * } 
  31. */ 
  32. $meta = apply_filters( 'add_signup_meta', $meta ); 
  33.  
  34. // If this is a subdomain install, set up the site inside the root domain. 
  35. $domain = $blogname . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); 
  36.  
  37. $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); 
  38. bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id ); 
  39. return true;