Skip to:
Content

BuddyPress.org

Ticket #5789: 5789.02.patch

File 5789.02.patch, 2.1 KB (added by r-a-y, 11 years ago)
  • src/bp-core/bp-core-filters.php

     
    248248 *         by '[User Set]'.
    249249 */
    250250function bp_core_filter_user_welcome_email( $welcome_email ) {
    251 
    252251        // Don't touch the email when a user is registered by the site admin
    253         if ( is_admin() )
     252        if ( is_admin() ) {
    254253                return $welcome_email;
     254        }
     255
     256        // On "Users > Add New" admin page, an admin created a new user.
     257        // Let the regular welcome email through, which has the user's password.
     258        if ( strpos( bp_get_requested_url(), 'wp-activate.php' ) !== false ) {
     259                return $welcome_email;
     260        }
    255261
    256262        // Don't touch the email if we don't have a custom registration template
    257         if ( ! bp_has_custom_signup_page() )
     263        if ( ! bp_has_custom_signup_page() ) {
    258264                return $welcome_email;
     265        }
    259266
    260267        // [User Set] Replaces 'PASSWORD' in welcome email; Represents value set by user
    261268        return str_replace( 'PASSWORD', __( '[User Set]', 'buddypress' ), $welcome_email );
     
    278285 * @return string Filtered $welcome_email with $password replaced by '[User Set]'.
    279286 */
    280287function bp_core_filter_blog_welcome_email( $welcome_email, $blog_id, $user_id, $password ) {
    281 
    282288        // Don't touch the email when a user is registered by the site admin.
    283         if ( is_admin() )
     289        if ( is_admin() ) {
    284290                return $welcome_email;
     291        }
    285292
    286293        // Don't touch the email if we don't have a custom registration template
    287         if ( ! bp_has_custom_signup_page() )
     294        if ( ! bp_has_custom_signup_page() ) {
    288295                return $welcome_email;
     296        }
    289297
    290298        // [User Set] Replaces $password in welcome email; Represents value set by user
    291299        return str_replace( $password, __( '[User Set]', 'buddypress' ), $welcome_email );
     
    350358 * @return bool True on success, false on failure.
    351359 */
    352360function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
     361        // Don't touch the email when a user is registered by the site admin.
     362        if ( is_admin() ) {
     363                return $user;
     364        }
    353365
    354366        // Set up activation link
    355367        $activate_url = bp_get_activation_page() . "?key=$key";