bp_core_filter_user_welcome_email

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

Description

(string) bp_core_filter_user_welcome_email( (string) $welcome_email ); 

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 the password replaced by '[User Set]'.

Parameters (1)

0. $welcome_email (string)
Complete email passed through WordPress.

Usage

  1. if ( !function_exists( 'bp_core_filter_user_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. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_filter_user_welcome_email($welcome_email); 
  9.  

Defined (1)

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

/bp-core/bp-core-filters.php  
  1. function bp_core_filter_user_welcome_email( $welcome_email ) { 
  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. if ( strpos( bp_get_requested_url(), 'wp-activate.php' ) !== false ) { 
  8. return $welcome_email; 
  9.  
  10. // Don't touch the email if we don't have a custom registration template. 
  11. return $welcome_email; 
  12.  
  13. // [User Set] Replaces 'PASSWORD' in welcome email; Represents value set by user 
  14. return str_replace( 'PASSWORD', __( '[User Set]', buddypress ), $welcome_email );