signup_blog

Setup the new site signup.

Description

signup_blog( (string) $user_name = '', (string) $user_email = '', (string) $blogname = '', (string) $blog_title = '', (string) $errors = '' ); 

Parameters (5)

0. $user_name — Optional. (string) => ''
The user name.
1. $user_email — Optional. (string) => ''
The user's email address.
2. $blogname — Optional. (string) => ''
The site name.
3. $blog_title — Optional. (string) => ''
The blog title.
4. $errors — Optional. (string) => ''
A WP_Error object containing existing errors. Defaults to empty string.

Usage

  1. if ( !function_exists( 'signup_blog' ) ) { 
  2. require_once '/wp-signup.php'; 
  3.  
  4. // The user name. 
  5. $user_name = ''; 
  6.  
  7. // The user's email address. 
  8. $user_email = ''; 
  9.  
  10. // The site name. 
  11. $blogname = ''; 
  12.  
  13. // The blog title. 
  14. $blog_title = ''; 
  15.  
  16. // A WP_Error object containing existing errors. Defaults to empty string. 
  17. $errors = ''; 
  18.  
  19. // NOTICE! Understand what this does before running. 
  20. $result = signup_blog($user_name, $user_email, $blogname, $blog_title, $errors); 
  21.  

Defined (1)

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

/wp-signup.php  
  1. function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') { 
  2. if ( !is_wp_error($errors) ) 
  3. $errors = new WP_Error(); 
  4.  
  5. $signup_blog_defaults = array( 
  6. 'user_name' => $user_name,  
  7. 'user_email' => $user_email,  
  8. 'blogname' => $blogname,  
  9. 'blog_title' => $blog_title,  
  10. 'errors' => $errors 
  11. ); 
  12.  
  13. /** 
  14. * Filters the default site creation variables for the site sign-up form. 
  15. * @since 3.0.0 
  16. * @param array $signup_blog_defaults { 
  17. * An array of default site creation variables. 
  18. * @type string $user_name The user username. 
  19. * @type string $user_email The user email address. 
  20. * @type string $blogname The blogname. 
  21. * @type string $blog_title The title of the site. 
  22. * @type WP_Error $errors A WP_Error object with possible errors relevant to new site creation variables. 
  23. * } 
  24. */ 
  25. $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults ); 
  26.  
  27. $user_name = $filtered_results['user_name']; 
  28. $user_email = $filtered_results['user_email']; 
  29. $blogname = $filtered_results['blogname']; 
  30. $blog_title = $filtered_results['blog_title']; 
  31. $errors = $filtered_results['errors']; 
  32.  
  33. if ( empty($blogname) ) 
  34. $blogname = $user_name; 
  35. ?> 
  36. <form id="setupform" method="post" action="wp-signup.php"> 
  37. <input type="hidden" name="stage" value="validate-blog-signup" /> 
  38. <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" /> 
  39. <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" /> 
  40. <?php 
  41. /** This action is documented in wp-signup.php */ 
  42. do_action( 'signup_hidden_fields', 'validate-site' ); 
  43. ?> 
  44. <?php show_blog_form($blogname, $blog_title, $errors); ?> 
  45. <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p> 
  46. </form> 
  47. <?php