wpmu_signup_user

Record user signup information for future activation.

Description

wpmu_signup_user( (string) $user, (string) $user_email, (array) $meta = array() ); 

This function is used when user registration is open but new site registration is not.

Parameters (3)

0. $user (string)
The user's requested login name.
1. $user_email (string)
The user's email address.
2. $meta — Optional. (array) => array()
By default, this is an empty array.

Usage

  1. if ( !function_exists( 'wpmu_signup_user' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-functions.php'; 
  3.  
  4. // The user's requested login name. 
  5. $user = ''; 
  6.  
  7. // The user's email address. 
  8. $user_email = ''; 
  9.  
  10. // By default, this is an empty array. 
  11. $meta = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = wpmu_signup_user($user, $user_email, $meta); 
  15.  

Defined (1)

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

/wp-includes/ms-functions.php  
  1. function wpmu_signup_user( $user, $user_email, $meta = array() ) { 
  2. global $wpdb; 
  3.  
  4. // Format data 
  5. $user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) ); 
  6. $user_email = sanitize_email( $user_email ); 
  7. $key = substr( md5( time() . rand() . $user_email ), 0, 16 ); 
  8. $meta = serialize($meta); 
  9.  
  10. $wpdb->insert( $wpdb->signups, array( 
  11. 'domain' => '',  
  12. 'path' => '',  
  13. 'title' => '',  
  14. 'user_login' => $user,  
  15. 'user_email' => $user_email,  
  16. 'registered' => current_time('mysql', true),  
  17. 'activation_key' => $key,  
  18. 'meta' => $meta 
  19. ) ); 
  20.  
  21. /** 
  22. * Fires after a user's signup information has been written to the database. 
  23. * @since 4.4.0 
  24. * @param string $user The user's requested login name. 
  25. * @param string $user_email The user's email address. 
  26. * @param string $key The user's activation key 
  27. * @param array $meta Additional signup meta. By default, this is an empty array. 
  28. */ 
  29. do_action( 'after_signup_user', $user, $user_email, $key, $meta );