bp_core_activation_signup_user_notification

Notify new users of a successful registration (without blog).

Description

(bool|string) bp_core_activation_signup_user_notification( (string) $user, (string) $user_email, (string) $key, (array) $meta ); 

Returns (bool|string)

Returns false to stop original WPMU function from continuing.

Parameters (4)

0. $user (string)
The user's login name.
1. $user_email (string)
The user's email address.
2. $key (string)
The activation key created in wpmu_signup_user().
3. $meta (array)
By default, an empty array.

Usage

  1. if ( !function_exists( 'bp_core_activation_signup_user_notification' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-filters.php'; 
  3.  
  4. // The user's login name. 
  5. $user = ''; 
  6.  
  7. // The user's email address. 
  8. $user_email = ''; 
  9.  
  10. // The activation key created in wpmu_signup_user(). 
  11. $key = ''; 
  12.  
  13. // By default, an empty array. 
  14. $meta = array(); 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bp_core_activation_signup_user_notification($user, $user_email, $key, $meta); 
  18.  

Defined (1)

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

/bp-core/bp-core-filters.php  
  1. function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) { 
  2. if ( is_admin() ) { 
  3.  
  4. // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications. 
  5. if( in_array( get_current_screen()->id, array( 'user', 'user-network' ) ) ) { 
  6. // If the Super Admin want to skip confirmation email. 
  7. if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { 
  8. return false; 
  9.  
  10. // WordPress will manage the signup process. 
  11. } else { 
  12. return $user; 
  13.  
  14. /** 
  15. * There can be a case where the user was created without the skip confirmation 
  16. * And the super admin goes in pending accounts to resend it. In this case, as the 
  17. * meta['password'] is not set, the activation url must be WordPress one. 
  18. */ 
  19. } elseif (buddypress)->members->admin->signups_page == get_current_screen()->id ) { 
  20. $is_hashpass_in_meta = maybe_unserialize( $meta ); 
  21.  
  22. if ( empty( $is_hashpass_in_meta['password'] ) ) { 
  23. return $user; 
  24.  
  25. $user_id = 0; 
  26. $user_object = get_user_by( 'login', $user ); 
  27. if ( $user_object ) { 
  28. $user_id = $user_object->ID; 
  29.  
  30. $args = array( 
  31. 'tokens' => array( 
  32. 'activate.url' => esc_url( trailingslashit( bp_get_activation_page() ) . "{$key}/" ),  
  33. 'key' => $key,  
  34. 'user.email' => $user_email,  
  35. 'user.id' => $user_id,  
  36. ),  
  37. ); 
  38. bp_send_email( 'core-user-registration', array( array( $user_email => $user ) ), $args ); 
  39.  
  40. // Return false to stop the original WPMU function from continuing. 
  41. return false;