Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/27/2016 09:15:07 PM (11 years ago)
Author:
djpaul
Message:

Emails: refactor notification functions and use bp_send_email to send email.

Backwards compatibility is mostly maintained, though there are a few unavoidable instances where some data passed to filters is no longer sent (an empty string or equivalent is provided to avoid PHP Notices). These will be detailed in a post on bpdevel.wordpress.com in the feature to alert plugin developers.

See #6592. Props timersys, mercime, boonebgorges, hnla, DJPaul.

File:
1 edited

Legend:

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

    r10422 r10479  
    22052205 */
    22062206function bp_core_signup_send_validation_email( $user_id, $user_email, $key ) {
    2207         $activate_url = trailingslashit( bp_get_activation_page() ) . "{$key}/";
    2208         $activate_url = esc_url( $activate_url );
    2209 
    2210         $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress' ), $activate_url );
    2211         $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
    2212 
    2213         /**
    2214          * Filters the user email that the validation email will be sent to.
    2215          *
    2216          * @since 1.5.0
    2217          *
    2218          * @param string $user_email User email the notification is being sent to.
    2219          * @param int    $user_id    ID of the new user receiving email.
    2220          */
    2221         $to      = apply_filters( 'bp_core_signup_send_validation_email_to',     $user_email, $user_id                );
    2222 
    2223         /**
    2224          * Filters the validation email subject that will be sent to user.
    2225          *
    2226          * @since 1.5.0
    2227          *
    2228          * @param string $subject Email validation subject text.
    2229          * @param int    $user_id ID of the new user receiving email.
    2230          */
    2231         $subject = apply_filters( 'bp_core_signup_send_validation_email_subject', $subject,    $user_id                );
    2232 
    2233         /**
    2234          * Filters the validation email message that will be sent to user.
    2235          *
    2236          * @since 1.5.0
    2237          *
    2238          * @param string $message      Email validation message text.
    2239          * @param int    $user_id      ID of the new user receiving email.
    2240          * @param string $activate_url URL to use for activating account.
    2241          */
    2242         $message = apply_filters( 'bp_core_signup_send_validation_email_message', $message,    $user_id, $activate_url );
    2243 
    2244         wp_mail( $to, $subject, $message );
    2245 
    2246         /**
    2247          * Fires after the sending of activation email to a newly registered user.
    2248          *
    2249          * @since 1.5.0
    2250          *
    2251          * @param string $subject    Subject for the sent email.
    2252          * @param string $message    Message for the sent email.
    2253          * @param int    $user_id    ID of the new user.
    2254          * @param string $user_email Email address of the new user.
    2255          * @param string $key        Activation key.
    2256          */
    2257         do_action( 'bp_core_sent_user_validation_email', $subject, $message, $user_id, $user_email, $key );
     2207        $args = array(
     2208                'tokens' => array(
     2209                        'activate_url' => esc_url( trailingslashit( bp_get_activation_page() ) . "{$key}/" ),
     2210                        'key'          => $key,
     2211                        'user'         => '',
     2212                        'user.email'   => $user_email,
     2213                        'user.id'      => $user_id,
     2214                ),
     2215        );
     2216        bp_send_email( 'core-user-registration', $user_id, $args );
    22582217}
    22592218
Note: See TracChangeset for help on using the changeset viewer.