Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/16/2016 02:17:57 PM (11 years ago)
Author:
djpaul
Message:

Emails: for user/site registrations emails, set recipient name to their user_login.

For multisite and for BP_SIGNUPS_SKIP_USER_CREATION , when the user account isn't created yet, we can't fetch the user's display name. Instead, use their user_login name in the email greeting.

Fixes #6913

Props imath

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-functions.php

    r10511 r10597  
    18401840                 */
    18411841                if ( apply_filters( 'bp_core_signup_send_activation_key', true, $user_id, $user_email, $activation_key, $usermeta ) ) {
    1842                         bp_core_signup_send_validation_email( $user_id, $user_email, $activation_key );
     1842                        bp_core_signup_send_validation_email( $user_id, $user_email, $activation_key, $user_login );
    18431843                }
    18441844        }
     
    22002200 * Send activation email to a newly registered user.
    22012201 *
    2202  * @param int    $user_id    ID of the new user.
    2203  * @param string $user_email Email address of the new user.
    2204  * @param string $key        Activation key.
    2205  */
    2206 function bp_core_signup_send_validation_email( $user_id, $user_email, $key ) {
     2202 * @since  2.5.0 Add the $user_login parameter.
     2203 *
     2204 * @param int|bool $user_id    ID of the new user, false if BP_SIGNUPS_SKIP_USER_CREATION is true.
     2205 * @param string   $user_email Email address of the new user.
     2206 * @param string   $key        Activation key.
     2207 * @param string   $user_login Optional. The user login name.
     2208 */
     2209function bp_core_signup_send_validation_email( $user_id, $user_email, $key, $user_login = '' ) {
    22072210        $args = array(
    22082211                'tokens' => array(
     
    22142217                ),
    22152218        );
    2216         bp_send_email( 'core-user-registration', $user_id, $args );
     2219
     2220        if ( $user_id ) {
     2221                $to = $user_id;
     2222        } else {
     2223                $to = array( array( $user_email => $user_login ) );
     2224        }
     2225
     2226        bp_send_email( 'core-user-registration', $to, $args );
    22172227}
    22182228
Note: See TracChangeset for help on using the changeset viewer.