bp_core_signup_send_validation_email

Send activation email to a newly registered user.

Description

bp_core_signup_send_validation_email( (int|bool) $user_id, (string) $user_email, (string) $key, (string) $user_login = '' ); 

Parameters (4)

0. $user_id (int|bool)
ID of the new user, false if BP_SIGNUPS_SKIP_USER_CREATION is true.
1. $user_email (string)
Email address of the new user.
2. $key (string)
Activation key.
3. $user_login — Optional. (string) => ''
The user login name.

Usage

  1. if ( !function_exists( 'bp_core_signup_send_validation_email' ) ) { 
  2. require_once '/bp-members/bp-members-functions.php'; 
  3.  
  4. // ID of the new user, false if BP_SIGNUPS_SKIP_USER_CREATION is true. 
  5. $user_id = null; 
  6.  
  7. // Email address of the new user. 
  8. $user_email = ''; 
  9.  
  10. // Activation key. 
  11. $key = ''; 
  12.  
  13. // Optional. The user login name. 
  14. $user_login = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bp_core_signup_send_validation_email($user_id, $user_email, $key, $user_login); 
  18.  

Defined (1)

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

/bp-members/bp-members-functions.php  
  1. function bp_core_signup_send_validation_email( $user_id, $user_email, $key, $user_login = '' ) { 
  2. $args = array( 
  3. 'tokens' => array( 
  4. 'activate.url' => esc_url( trailingslashit( bp_get_activation_page() ) . "{$key}/" ),  
  5. 'key' => $key,  
  6. 'user.email' => $user_email,  
  7. 'user.id' => $user_id,  
  8. ),  
  9. ); 
  10.  
  11. if ( $user_id ) { 
  12. $to = $user_id; 
  13. } else { 
  14. $to = array( array( $user_email => $user_login ) ); 
  15.  
  16. bp_send_email( 'core-user-registration', $to, $args );