Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/23/2010 12:01:04 PM (14 years ago)
Author:
apeatling
Message:

Fixes #2043

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-core/bp-core-activation.php

    r2697 r2773  
    7676add_action( 'wp', 'bp_core_screen_activation', 3 );
    7777
     78/***
     79 * bp_core_filter_user_welcome_email()
     80 *
     81 * Replace the generated password in the welcome email.
     82 * This will not filter when the site admin registers a user.
     83 */
     84function bp_core_filter_user_welcome_email( $welcome_email ) {
     85    /* Don't touch the email if we don't have a custom registration template */
     86    if ( '' == locate_template( array( 'registration/register.php' ), false ) && '' == locate_template( array( 'register.php' ), false ) )
     87        return $welcome_email;
     88
     89    return str_replace( 'PASSWORD', __( '[User Set]', 'buddypress' ), $welcome_email );
     90}
     91if ( !is_admin() && empty( $_GET['e'] ) )
     92    add_filter( 'update_welcome_user_email', 'bp_core_filter_user_welcome_email' );
    7893
    7994/***
    80  * bp_core_disable_welcome_email()
     95 * bp_core_filter_blog_welcome_email()
    8196 *
    82  * Since the user now chooses their password, sending it over clear-text to an
    83  * email address is no longer necessary. It's also a terrible idea security wise.
    84  *
    85  * The only exception to this is when an admin has generated an account for a user.
    86  *
    87  * This will only disable the email if a custom registration template is being used.
     97 * Replace the generated password in the welcome email.
     98 * This will not filter when the site admin registers a user.
    8899 */
    89 function bp_core_disable_welcome_email() {
     100function bp_core_filter_blog_welcome_email( $welcome_email, $blog_id, $user_id, $password ) {
     101    /* Don't touch the email if we don't have a custom registration template */
    90102    if ( '' == locate_template( array( 'registration/register.php' ), false ) && '' == locate_template( array( 'register.php' ), false ) )
    91         return true;
     103        return $welcome_email;
    92104
    93     return false;
     105    return str_replace( $password, __( '[User Set]', 'buddypress' ), $welcome_email );
    94106}
    95107if ( !is_admin() && empty( $_GET['e'] ) )
    96     add_filter( 'wpmu_welcome_user_notification', 'bp_core_disable_welcome_email' );
     108    add_filter( 'update_welcome_email', 'bp_core_filter_blog_welcome_email', 10, 4 );
    97109
    98110// Notify user of signup success.
Note: See TracChangeset for help on using the changeset viewer.