validate_another_blog_signup

Validate a new site signup.

Description

(null|bool) validate_another_blog_signup(); 

Returns (null|bool)

True if site signup was validated, false if error. The function halts all execution if the user is not logged in.


Usage

  1. if ( !function_exists( 'validate_another_blog_signup' ) ) { 
  2. require_once '/wp-signup.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = validate_another_blog_signup(); 
  7.  

Defined (1)

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

/wp-signup.php  
  1. function validate_another_blog_signup() { 
  2. global $wpdb, $blogname, $blog_title, $errors, $domain, $path; 
  3. $current_user = wp_get_current_user(); 
  4. if ( ! is_user_logged_in() ) { 
  5. die(); 
  6.  
  7. $result = validate_blog_form(); 
  8.  
  9. // Extracted values set/overwrite globals. 
  10. $domain = $result['domain']; 
  11. $path = $result['path']; 
  12. $blogname = $result['blogname']; 
  13. $blog_title = $result['blog_title']; 
  14. $errors = $result['errors']; 
  15.  
  16. if ( $errors->get_error_code() ) { 
  17. signup_another_blog($blogname, $blog_title, $errors); 
  18. return false; 
  19.  
  20. $public = (int) $_POST['blog_public']; 
  21.  
  22. $blog_meta_defaults = array( 
  23. 'lang_id' => 1,  
  24. 'public' => $public 
  25. ); 
  26.  
  27. // Handle the language setting for the new site. 
  28. if ( ! empty( $_POST['WPLANG'] ) ) { 
  29.  
  30.  
  31. if ( in_array( $_POST['WPLANG'], $languages ) ) { 
  32. $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) ); 
  33.  
  34. if ( $language ) { 
  35. $blog_meta_defaults['WPLANG'] = $language; 
  36.  
  37.  
  38. /** 
  39. * Filters the new site meta variables. 
  40. * Use the {@see 'add_signup_meta'} filter instead. 
  41. * @since MU 
  42. * @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead. 
  43. * @param array $blog_meta_defaults An array of default blog meta variables. 
  44. */ 
  45. $meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults ); 
  46.  
  47. /** 
  48. * Filters the new default site meta variables. 
  49. * @since 3.0.0 
  50. * @param array $meta { 
  51. * An array of default site meta variables. 
  52. * @type int $lang_id The language ID. 
  53. * @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false. 
  54. * } 
  55. */ 
  56. $meta = apply_filters( 'add_signup_meta', $meta_defaults ); 
  57.  
  58. $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); 
  59.  
  60. if ( is_wp_error( $blog_id ) ) { 
  61. return false; 
  62.  
  63. confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id ); 
  64. return true;