bp_core_filter_blog_welcome_email

Replace the generated password in the welcome email with '[User Set]'.

Description

(string) bp_core_filter_blog_welcome_email( (string) $welcome_email, (int) $blog_id, (int) $user_id, (string) $password ); 

On a standard BP installation, users who register themselves also set their own passwords. Therefore there is no need for the insecure practice of emailing the plaintext password to the user in the welcome email.

This filter will not fire when a user is registered by the site admin.

Returns (string)

Filtered $welcome_email with $password replaced by '[User Set]'.

Parameters (4)

0. $welcome_email (string)
Complete email passed through WordPress.
1. $blog_id (int)
ID of the blog user is joining.
2. $user_id (int)
ID of the user joining.
3. $password (string)
Password of user.

Usage

  1. if ( !function_exists( 'bp_core_filter_blog_welcome_email' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-filters.php'; 
  3.  
  4. // Complete email passed through WordPress. 
  5. $welcome_email = ''; 
  6.  
  7. // ID of the blog user is joining. 
  8. $blog_id = -1; 
  9.  
  10. // ID of the user joining. 
  11. $user_id = -1; 
  12.  
  13. // Password of user. 
  14. $password = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bp_core_filter_blog_welcome_email($welcome_email, $blog_id, $user_id, $password); 
  18.  

Defined (1)

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

/bp-core/bp-core-filters.php  
  1. function bp_core_filter_blog_welcome_email( $welcome_email, $blog_id, $user_id, $password ) { 
  2.  
  3. // Don't touch the email when a user is registered by the site admin. 
  4. if ( ( is_admin() || is_network_admin() ) &&buddypress)->members->admin->signups_page != get_current_screen()->id ) { 
  5. return $welcome_email; 
  6.  
  7. // Don't touch the email if we don't have a custom registration template. 
  8. return $welcome_email; 
  9.  
  10. // [User Set] Replaces $password in welcome email; Represents value set by user 
  11. return str_replace( $password, __( '[User Set]', buddypress ), $welcome_email );