Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/01/2019 02:33:56 AM (6 years 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-core/bp-core-filters.php

    r12284 r12349  
    470470        ),
    471471    );
    472     bp_send_email( 'core-user-registration-with-blog', array( array( $user_email => $user ) ), $args );
     472
     473    $signups = BP_Signup::get(
     474        array(
     475            'user_login' => $user,
     476        )
     477    );
     478
     479    $salutation = $user;
     480    if ( $signups ) {
     481        $signup = $signups['signups'][0];
     482        if ( isset( $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
     483            $salutation = $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ];
     484        }
     485    }
     486
     487    bp_send_email( 'core-user-registration-with-blog', array( array( $user_email => $salutation ) ), $args );
    473488
    474489    // Return false to stop the original WPMU function from continuing.
     
    522537    if ( $user_object ) {
    523538        $user_id = $user_object->ID;
     539    }
     540
     541    $salutation = $user;
     542    if ( isset( $meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
     543        $salutation = $meta[ 'field_' . bp_xprofile_fullname_field_id() ];
     544    } elseif ( $user_id ) {
     545        $salutation = bp_core_get_user_displayname( $user_id );
    524546    }
    525547
     
    532554        ),
    533555    );
    534     bp_send_email( 'core-user-registration', array( array( $user_email => $user ) ), $args );
     556    bp_send_email( 'core-user-registration', array( array( $user_email => $salutation ) ), $args );
    535557
    536558    // Return false to stop the original WPMU function from continuing.
Note: See TracChangeset for help on using the changeset viewer.