Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/01/2019 02:33:56 AM (9 months ago)
Author:
boonebgorges
Message:

Use display name as salutation in signup emails.

Previously, the user login was used, because the display name was not
yet saved in the database. However, we can generally extract the user's
provided display name from the signup's meta fields.

Fixes #8056.

File:
1 edited

Legend:

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

    r11829 r12349  
    17421742         */
    17431743        if ( apply_filters( 'bp_core_signup_send_activation_key', true, $user_id, $user_email, $activation_key, $usermeta ) ) {
    1744             bp_core_signup_send_validation_email( $user_id, $user_email, $activation_key, $user_login );
     1744            $salutation = $user_login;
     1745            if ( isset( $usermeta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
     1746                $salutation = $usermeta[ 'field_' . bp_xprofile_fullname_field_id() ];
     1747            }
     1748
     1749            bp_core_signup_send_validation_email( $user_id, $user_email, $activation_key, $salutation );
    17451750        }
    17461751    }
     
    21592164 * @since 1.2.2
    21602165 * @since 2.5.0 Add the $user_login parameter.
     2166 * @since 5.0.0 Change $user_login parameter to more general $salutation.
    21612167 *
    21622168 * @param int|bool $user_id    ID of the new user, false if BP_SIGNUPS_SKIP_USER_CREATION is true.
    2163  * @param string   $user_email Email address of the new user.
    2164  * @param string   $key        Activation key.
    2165  * @param string   $user_login Optional. The user login name.
    2166  */
    2167 function bp_core_signup_send_validation_email( $user_id, $user_email, $key, $user_login = '' ) {
     2169 * @param string   $user_email   Email address of the new user.
     2170 * @param string   $key          Activation key.
     2171 * @param string   $salutation   Optional. The name to be used as a salutation in the email.
     2172 */
     2173function bp_core_signup_send_validation_email( $user_id, $user_email, $key, $salutation = '' ) {
    21682174    $args = array(
    21692175        'tokens' => array(
     
    21752181    );
    21762182
    2177     if ( $user_id ) {
    2178         $to = $user_id;
    2179     } else {
    2180         $to = array( array( $user_email => $user_login ) );
    2181     }
     2183    $to = array( array( $user_email => $salutation ) );
    21822184
    21832185    bp_send_email( 'core-user-registration', $to, $args );
Note: See TracChangeset for help on using the changeset viewer.