Skip to:
Content

BuddyPress.org

Changeset 10479


Ignore:
Timestamp:
01/27/2016 09:15:07 PM (9 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.

Location:
trunk/src
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-notifications.php

    r10457 r10479  
    4141 */
    4242function bp_activity_at_message_notification( $activity_id, $receiver_user_id ) {
     43    $notifications = BP_Core_Notification::get_all_for_user( $receiver_user_id, 'all' );
    4344
    4445    // Don't leave multiple notifications for the same activity item.
    45     $notifications = BP_Core_Notification::get_all_for_user( $receiver_user_id, 'all' );
    46 
    4746    foreach( $notifications as $notification ) {
    4847        if ( $activity_id == $notification->item_id ) {
     
    5150    }
    5251
    53     $activity = new BP_Activity_Activity( $activity_id );
    54 
    55     $subject = '';
    56     $message = '';
    57     $content = '';
     52    $activity     = new BP_Activity_Activity( $activity_id );
     53    $email_type   = 'activity-at-message';
     54    $group_name   = '';
     55    $message_link = bp_activity_get_permalink( $activity_id );
     56    $poster_name  = bp_core_get_user_displayname( $activity->user_id );
     57
     58    remove_filter( 'bp_get_activity_content_body', 'convert_smilies' );
     59    remove_filter( 'bp_get_activity_content_body', 'wpautop' );
     60    remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
     61
     62    /** This filter is documented in bp-activity/bp-activity-template.php */
     63    $content = apply_filters( 'bp_get_activity_content_body', $activity->content );
     64
     65    add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
     66    add_filter( 'bp_get_activity_content_body', 'wpautop' );
     67    add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
    5868
    5969    // Now email the user with the contents of the message (if they have enabled email notifications).
    6070    if ( 'no' != bp_get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) {
    61         $poster_name = bp_core_get_user_displayname( $activity->user_id );
    62 
    63         $message_link  = bp_activity_get_permalink( $activity_id );
    64         $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    65         $settings_link = bp_core_get_user_domain( $receiver_user_id ) . $settings_slug . '/notifications/';
    66 
    67         $poster_name = stripslashes( $poster_name );
    68         $content = bp_activity_filter_kses( strip_tags( stripslashes( $activity->content ) ) );
    69 
    70         // Set up and send the message.
    71         $ud       = bp_core_get_core_userdata( $receiver_user_id );
    72         $to       = $ud->user_email;
    73         $subject  = bp_get_email_subject( array( 'text' => sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name ) ) );
    74 
    7571        if ( bp_is_active( 'groups' ) && bp_is_group() ) {
    76             $message = sprintf( __(
    77 '%1$s mentioned you in the group "%2$s":
    78 
    79 "%3$s"
    80 
    81 To view and respond to the message, log in and visit: %4$s
    82 
    83 ---------------------
    84 ', 'buddypress' ), $poster_name, bp_get_current_group_name(), $content, $message_link );
    85         } else {
    86             $message = sprintf( __(
    87 '%1$s mentioned you in an update:
    88 
    89 "%2$s"
    90 
    91 To view and respond to the message, log in and visit: %3$s
    92 
    93 ---------------------
    94 ', 'buddypress' ), $poster_name, $content, $message_link );
     72            $email_type = 'groups-at-message';
     73            $group_name = bp_get_current_group_name();
    9574        }
    9675
    97         // Only show the disable notifications line if the settings component is enabled.
    98         if ( bp_is_active( 'settings' ) ) {
    99             $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    100         }
    101 
    102         /**
    103          * Filters the user email that the @mention notification will be sent to.
    104          *
    105          * @since 1.2.0
    106          *
    107          * @param string $to User email the notification is being sent to.
    108          */
    109         $to      = apply_filters( 'bp_activity_at_message_notification_to', $to );
    110 
    111         /**
    112          * Filters the @mention notification subject that will be sent to user.
    113          *
    114          * @since 1.2.0
    115          *
    116          * @param string $subject     Email notification subject text.
    117          * @param string $poster_name Name of the person who made the @mention.
    118          */
    119         $subject = apply_filters( 'bp_activity_at_message_notification_subject', $subject, $poster_name );
    120 
    121         /**
    122          * Filters the @mention notification message that will be sent to user.
    123          *
    124          * @since 1.2.0
    125          *
    126          * @param string $message       Email notification message text.
    127          * @param string $poster_name   Name of the person who made the @mention.
    128          * @param string $content       Content of the @mention.
    129          * @param string $message_link  URL permalink for the activity message.
    130          * @param string $settings_link URL permalink for the user's notification settings area.
    131          */
    132         $message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link );
    133 
    134         wp_mail( $to, $subject, $message );
    135     }
    136 
    137     /**
    138      * Fires after the sending of an @mention email notification.
    139      *
    140      * @since 1.5.0
    141      *
    142      * @param BP_Activity_Activity $activity         Activity Item object.
    143      * @param string               $subject          Email notification subject text.
    144      * @param string               $message          Email notification message text.
    145      * @param string               $content          Content of the @mention.
    146      * @param int                  $receiver_user_id The ID of the user who is receiving the update.
    147      */
    148     do_action( 'bp_activity_sent_mention_email', $activity, $subject, $message, $content, $receiver_user_id );
     76        $args = array(
     77            'tokens' => array(
     78                'activity'         => $activity,
     79                'usermessage'      => wp_strip_all_tags( $content ),
     80                'group.name'       => $group_name,
     81                'mentioned.url'    => $message_link,
     82                'poster.name'      => $poster_name,
     83                'receiver-user.id' => $receiver_user_id,
     84            ),
     85        );
     86
     87        bp_send_email( $email_type, $receiver_user_id, $args );
     88    }
    14989}
    15090
     
    15393 *
    15494 * @since 1.2.0
     95 * @since 2.5.0 Updated to use new email APIs.
    15596 *
    15697 * @uses bp_get_user_meta()
     
    177118 * @param int   $commenter_id The ID of the user who posted the comment.
    178119 * @param array $params       {@link bp_activity_new_comment()}.
    179  * @return bool
    180120 */
    181121function bp_activity_new_comment_notification( $comment_id = 0, $commenter_id = 0, $params = array() ) {
    182 
    183     // Set some default parameters.
    184     $activity_id = 0;
    185     $parent_id   = 0;
    186 
    187     extract( $params );
    188 
    189     $original_activity = new BP_Activity_Activity( $activity_id );
     122    $original_activity = new BP_Activity_Activity( $params['activity_id'] );
     123    $poster_name       = bp_core_get_user_displayname( $commenter_id );
     124    $thread_link       = bp_activity_get_permalink( $params['activity_id'] );
     125
     126    remove_filter( 'bp_get_activity_content_body', 'convert_smilies' );
     127    remove_filter( 'bp_get_activity_content_body', 'wpautop' );
     128    remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
     129
     130    /** This filter is documented in bp-activity/bp-activity-template.php */
     131    $content = apply_filters( 'bp_get_activity_content_body', $params['content'] );
     132
     133    add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
     134    add_filter( 'bp_get_activity_content_body', 'wpautop' );
     135    add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
    190136
    191137    if ( $original_activity->user_id != $commenter_id && 'no' != bp_get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) {
    192         $poster_name   = bp_core_get_user_displayname( $commenter_id );
    193         $thread_link   = bp_activity_get_permalink( $activity_id );
    194         $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    195         $settings_link = bp_core_get_user_domain( $original_activity->user_id ) . $settings_slug . '/notifications/';
    196 
    197         $poster_name = stripslashes( $poster_name );
    198         $content = bp_activity_filter_kses( stripslashes($content) );
    199 
    200         // Set up and send the message.
    201         $ud      = bp_core_get_core_userdata( $original_activity->user_id );
    202         $to      = $ud->user_email;
    203         $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name ) ) );
    204         $message = sprintf( __(
    205 '%1$s replied to one of your updates:
    206 
    207 "%2$s"
    208 
    209 To view your original update and all comments, log in and visit: %3$s
    210 
    211 ---------------------
    212 ', 'buddypress' ), $poster_name, $content, $thread_link );
    213 
    214         // Only show the disable notifications line if the settings component is enabled.
    215         if ( bp_is_active( 'settings' ) ) {
    216             $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    217         }
    218 
    219         /**
    220          * Filters the user email that the new comment notification will be sent to.
    221          *
    222          * @since 1.2.0
    223          *
    224          * @param string $to User email the notification is being sent to.
    225          */
    226         $to = apply_filters( 'bp_activity_new_comment_notification_to', $to );
    227 
    228         /**
    229          * Filters the new comment notification subject that will be sent to user.
    230          *
    231          * @since 1.2.0
    232          *
    233          * @param string $subject     Email notification subject text.
    234          * @param string $poster_name Name of the person who made the comment.
    235          */
    236         $subject = apply_filters( 'bp_activity_new_comment_notification_subject', $subject, $poster_name );
    237 
    238         /**
    239          * Filters the new comment notification message that will be sent to user.
    240          *
    241          * @since 1.2.0
    242          *
    243          * @param string $message       Email notification message text.
    244          * @param string $poster_name   Name of the person who made the comment.
    245          * @param string $content       Content of the comment.
    246          * @param string $thread_link   URL permalink for the activity thread.
    247          * @param string $settings_link URL permalink for the user's notification settings area.
    248          */
    249         $message = apply_filters( 'bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link );
    250 
    251         wp_mail( $to, $subject, $message );
    252 
    253         /**
    254          * Fires after the sending of a reply to an update email notification.
    255          *
    256          * @since 1.5.0
    257          *
    258          * @param int    $user_id      ID of the original activity item author.
    259          * @param string $subject      Email notification subject text.
    260          * @param string $message      Email notification message text.
    261          * @param int    $comment_id   ID for the newly received comment.
    262          * @param int    $commenter_id ID of the user who made the comment.
    263          * @param array  $params       Arguments used with the original activity comment.
    264          */
    265         do_action( 'bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params );
    266     }
     138        $args = array(
     139            'tokens' => array(
     140                'comment.id'                => $comment_id,
     141                'commenter.id'              => $commenter_id,
     142                'usermessage'               => wp_strip_all_tags( $content ),
     143                'original_activity.user_id' => $original_activity->user_id,
     144                'poster.name'               => $poster_name,
     145                'thread.url'                => esc_url( $thread_link ),
     146            ),
     147        );
     148
     149        bp_send_email( 'activity-comment', $original_activity->user_id, $args );
     150    }
     151
    267152
    268153    /*
     
    270155     * author of the immediate parent comment.
    271156     */
    272     if ( empty( $parent_id ) || ( $activity_id == $parent_id ) ) {
    273         return false;
    274     }
    275 
    276     $parent_comment = new BP_Activity_Activity( $parent_id );
     157    if ( empty( $params['parent_id'] ) || ( $params['activity_id'] == $params['parent_id'] ) ) {
     158        return;
     159    }
     160
     161    $parent_comment = new BP_Activity_Activity( $params['parent_id'] );
    277162
    278163    if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != bp_get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) {
    279         $poster_name   = bp_core_get_user_displayname( $commenter_id );
    280         $thread_link   = bp_activity_get_permalink( $activity_id );
    281         $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    282         $settings_link = bp_core_get_user_domain( $parent_comment->user_id ) . $settings_slug . '/notifications/';
    283 
    284         // Set up and send the message.
    285         $ud       = bp_core_get_core_userdata( $parent_comment->user_id );
    286         $to       = $ud->user_email;
    287         $subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name ) ) );
    288 
    289         $poster_name = stripslashes( $poster_name );
    290         $content = bp_activity_filter_kses( stripslashes( $content ) );
    291 
    292 $message = sprintf( __(
    293 '%1$s replied to one of your comments:
    294 
    295 "%2$s"
    296 
    297 To view the original activity, your comment and all replies, log in and visit: %3$s
    298 
    299 ---------------------
    300 ', 'buddypress' ), $poster_name, $content, $thread_link );
    301 
    302         // Only show the disable notifications line if the settings component is enabled.
    303         if ( bp_is_active( 'settings' ) ) {
    304             $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    305         }
    306 
    307         /**
    308          * Filters the user email that the new comment reply notification will be sent to.
    309          *
    310          * @since 1.2.0
    311          *
    312          * @param string $to User email the notification is being sent to.
    313          */
    314         $to = apply_filters( 'bp_activity_new_comment_notification_comment_author_to', $to );
    315 
    316         /**
    317          * Filters the new comment reply notification subject that will be sent to user.
    318          *
    319          * @since 1.2.0
    320          *
    321          * @param string $subject     Email notification subject text.
    322          * @param string $poster_name Name of the person who made the comment reply.
    323          */
    324         $subject = apply_filters( 'bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name );
    325 
    326         /**
    327          * Filters the new comment reply notification message that will be sent to user.
    328          *
    329          * @since 1.2.0
    330          *
    331          * @param string $message       Email notification message text.
    332          * @param string $poster_name   Name of the person who made the comment reply.
    333          * @param string $content       Content of the comment reply.
    334          * @param string $settings_link URL permalink for the user's notification settings area.
    335          * @param string $thread_link   URL permalink for the activity thread.
    336          */
    337         $message = apply_filters( 'bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content, $settings_link, $thread_link );
    338 
    339         wp_mail( $to, $subject, $message );
    340 
    341         /**
    342          * Fires after the sending of a reply to a reply email notification.
    343          *
    344          * @since 1.5.0
    345          *
    346          * @param int    $user_id      ID of the parent activity item author.
    347          * @param string $subject      Email notification subject text.
    348          * @param string $message      Email notification message text.
    349          * @param int    $comment_id   ID for the newly received comment.
    350          * @param int    $commenter_id ID of the user who made the comment.
    351          * @param array  $params       Arguments used with the original activity comment.
    352          */
    353         do_action( 'bp_activity_sent_reply_to_reply_email', $parent_comment->user_id, $subject, $message, $comment_id, $commenter_id, $params );
     164        $args = array(
     165            'tokens' => array(
     166                'comment.id'             => $comment_id,
     167                'commenter.id'           => $commenter_id,
     168                'usermessage'            => wp_strip_all_tags( $content ),
     169                'parent-comment-user.id' => $parent_comment->user_id,
     170                'poster.name'            => $poster_name,
     171                'thread.url'             => esc_url( $thread_link ),
     172            ),
     173        );
     174
     175        bp_send_email( 'activity-comment-author', $parent_comment->user_id, $args );
    354176    }
    355177}
  • trunk/src/bp-core/bp-core-filters.php

    r10477 r10479  
    241241}
    242242add_filter( 'nav_menu_css_class', 'bp_core_menu_highlight_nav_menu_item', 10, 2 );
    243 
    244 /**
    245  * Set "From" name in outgoing email to the site name.
    246  *
    247  * @uses bp_get_option() fetches the value for a meta_key in the wp_X_options table.
    248  *
    249  * @return string The blog name for the root blog.
    250  */
    251 function bp_core_email_from_name_filter() {
    252 
    253     /**
    254      * Filters the "From" name in outgoing email to the site name.
    255      *
    256      * @since 1.2.0
    257      *
    258      * @param string $value Value to set the "From" name to.
    259      */
    260     return apply_filters( 'bp_core_email_from_name_filter', bp_get_option( 'blogname', 'WordPress' ) );
    261 }
    262 add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );
    263243
    264244/**
     
    434414 * WP's default welcome email with a BuddyPress-specific message.
    435415 *
    436  * @see wpmu_signup_blog_notification() for a description of parameters.
    437  *
    438416 * @param string $domain     The new blog domain.
    439417 * @param string $path       The new blog path.
     
    442420 * @param string $user_email The user's email address.
    443421 * @param string $key        The activation key created in wpmu_signup_blog().
    444  * @param array  $meta       By default, contains the requested privacy setting and
    445  *                           lang_id.
    446  * @return bool True on success, false on failure.
    447  */
    448 function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) {
    449 
    450     // Set up activation link.
    451     $activate_url = bp_get_activation_page() ."?key=$key";
    452     $activate_url = esc_url( $activate_url );
    453 
    454     // Email contents.
    455     $message = sprintf( __( "%1\$s,\n\n\n\nThanks for registering! To complete the activation of your account and blog, please click the following link:\n\n%2\$s\n\n\n\nAfter you activate, you can visit your blog here:\n\n%3\$s", 'buddypress' ), $user, $activate_url, esc_url( "http://{$domain}{$path}" ) );
    456     $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Activate %s', 'buddypress' ), 'http://' . $domain . $path ) ) );
    457 
    458     /**
    459      * Filters the email that the notification is going to upon successful registration with blog.
    460      *
    461      * @since 1.2.0
    462      *
    463      * @param string $user_email The user's email address.
    464      * @param string $domain     The new blog domain.
    465      * @param string $path       The new blog path.
    466      * @param string $title      The site title.
    467      * @param string $user       The user's login name.
    468      * @param string $user_email The user's email address.
    469      * @param string $key        The activation key created in wpmu_signup_blog().
    470      * @param array  $meta       Array of meta values for the created site.
    471      */
    472     $to      = apply_filters( 'bp_core_activation_signup_blog_notification_to',   $user_email, $domain, $path, $title, $user, $user_email, $key, $meta );
    473 
    474     /**
    475      * Filters the subject that the notification uses upon successful registration with blog.
    476      *
    477      * @since 1.2.0
    478      *
    479      * @param string $subject    The subject to use.
    480      * @param string $domain     The new blog domain.
    481      * @param string $path       The new blog path.
    482      * @param string $title      The site title.
    483      * @param string $user       The user's login name.
    484      * @param string $user_email The user's email address.
    485      * @param string $key        The activation key created in wpmu_signup_blog().
    486      * @param array  $meta       Array of meta values for the created site.
    487      */
    488     $subject = apply_filters( 'bp_core_activation_signup_blog_notification_subject', $subject, $domain, $path, $title, $user, $user_email, $key, $meta );
    489 
    490     /**
    491      * Filters the message that the notification uses upon successful registration with blog.
    492      *
    493      * @since 1.2.0
    494      *
    495      * @param string $message    The message to use.
    496      * @param string $domain     The new blog domain.
    497      * @param string $path       The new blog path.
    498      * @param string $title      The site title.
    499      * @param string $user       The user's login name.
    500      * @param string $user_email The user's email address.
    501      * @param string $key        The activation key created in wpmu_signup_blog().
    502      * @param array  $meta       Array of meta values for the created site.
    503      */
    504     $message = apply_filters( 'bp_core_activation_signup_blog_notification_message', $message, $domain, $path, $title, $user, $user_email, $key, $meta );
    505 
    506     // Send the email.
    507     wp_mail( $to, $subject, $message );
    508 
    509     // Set up the $admin_email to pass to the filter.
    510     $admin_email = bp_get_option( 'admin_email' );
    511 
    512     /**
    513      * Fires after the sending of the notification to new users for successful registration with blog.
    514      *
    515      * @since 1.5.0
    516      *
    517      * @param string $admin_email Admin Email address for the site.
    518      * @param string $subject     Subject used in the notification email.
    519      * @param string $message     Message used in the notification email.
    520      * @param string $domain      The new blog domain.
    521      * @param string $path        The new blog path.
    522      * @param string $title       The site title.
    523      * @param string $user        The user's login name.
    524      * @param string $user_email  The user's email address.
    525      * @param string $key         The activation key created in wpmu_signup_blog().
    526      * @param array  $meta        Array of meta values for the created site.
    527      */
    528     do_action( 'bp_core_sent_blog_signup_email', $admin_email, $subject, $message, $domain, $path, $title, $user, $user_email, $key, $meta );
     422 * @return bool              Returns false to stop original WPMU function from continuing.
     423 */
     424function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key ) {
     425    $args = array(
     426        'tokens' => array(
     427            'activate-site.url' => esc_url( bp_get_activation_page() . '?key=' . urlencode( $key ) ),
     428            'domain'            => $domain,
     429            'key_blog'          => $key,
     430            'path'              => $path,
     431            'user-site.url'     => esc_url( "http://{$domain}{$path}" ),
     432            'title'             => $title,
     433            'user.email'        => $user_email,
     434        ),
     435    );
     436    bp_send_email( 'core-user-registration-with-blog', $user_email, $args );
    529437
    530438    // Return false to stop the original WPMU function from continuing.
    531439    return false;
    532440}
    533 add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 7 );
     441add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 6 );
    534442
    535443/**
     
    542450 * @param string $key        The activation key created in wpmu_signup_user().
    543451 * @param array  $meta       By default, an empty array.
    544  * @return bool|string True on success, false on failure.
     452 * @return bool|string       Returns false to stop original WPMU function from continuing.
    545453 */
    546454function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
    547 
    548455    if ( is_admin() ) {
     456
    549457        // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications.
    550458        if( in_array( get_current_screen()->id, array( 'user', 'user-network' ) ) ) {
     
    558466            }
    559467
    560         /**
     468        /*
    561469         * There can be a case where the user was created without the skip confirmation
    562470         * And the super admin goes in pending accounts to resend it. In this case, as the
     
    572480    }
    573481
    574     // Set up activation link.
    575     $activate_url = bp_get_activation_page() . "?key=$key";
    576     $activate_url = esc_url( $activate_url );
    577 
    578     // Email contents.
    579     $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 );
    580     $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) );
    581 
    582     /**
    583      * Filters the email that the notification is going to upon successful registration without blog.
    584      *
    585      * @since 1.2.0
    586      *
    587      * @param string $user_email The user's email address.
    588      * @param string $user       The user's login name.
    589      * @param string $user_email The user's email address.
    590      * @param string $key        The activation key created in wpmu_signup_blog().
    591      * @param array  $meta       Array of meta values for the created site.
    592      */
    593     $to      = apply_filters( 'bp_core_activation_signup_user_notification_to',   $user_email, $user, $user_email, $key, $meta );
    594 
    595     /**
    596      * Filters the subject that the notification uses upon successful registration without blog.
    597      *
    598      * @since 1.2.0
    599      *
    600      * @param string $subject    The subject to use.
    601      * @param string $user       The user's login name.
    602      * @param string $user_email The user's email address.
    603      * @param string $key        The activation key created in wpmu_signup_blog().
    604      * @param array  $meta       Array of meta values for the created site.
    605      */
    606     $subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta );
    607 
    608     /**
    609      * Filters the message that the notification uses upon successful registration without blog.
    610      *
    611      * @since 1.2.0
    612      *
    613      * @param string $message    The message to use.
    614      * @param string $user       The user's login name.
    615      * @param string $user_email The user's email address.
    616      * @param string $key        The activation key created in wpmu_signup_blog().
    617      * @param array  $meta       Array of meta values for the created site.
    618      */
    619     $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta );
    620 
    621     // Send the email.
    622     wp_mail( $to, $subject, $message );
    623 
    624     // Set up the $admin_email to pass to the filter.
    625     $admin_email = bp_get_option( 'admin_email' );
    626 
    627     /**
    628      * Fires after the sending of the notification to new users for successful registration without blog.
    629      *
    630      * @since 1.5.0
    631      *
    632      * @param string $admin_email Admin Email address for the site.
    633      * @param string $subject     Subject used in the notification email.
    634      * @param string $message     Message used in the notification email.
    635      * @param string $user        The user's login name.
    636      * @param string $user_email  The user's email address.
    637      * @param string $key         The activation key created in wpmu_signup_blog().
    638      * @param array  $meta        Array of meta values for the created site. Default empty array.
    639      */
    640     do_action( 'bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta );
     482    $args = array(
     483        'tokens' => array(
     484            'activate.url' => esc_url( trailingslashit( bp_get_activation_page() ) . "{$key}/" ),
     485            'key'          => $key,
     486            'user.email'   => $user_email,
     487        ),
     488    );
     489    bp_send_email( 'core-user-registration', $user_email, $args );
    641490
    642491    // Return false to stop the original WPMU function from continuing.
  • trunk/src/bp-core/bp-core-template.php

    r10425 r10479  
    10671067 *
    10681068 * @since 1.7.0
     1069 * @since 2.5.0 No longer used by BuddyPress, but not deprecated in case any existing plugins use it.
    10691070 *
    10701071 * @see https://buddypress.trac.wordpress.org/ticket/4401
  • trunk/src/bp-core/deprecated/1.5.php

    r10108 r10479  
    367367---------------------
    368368', 'buddypress' ), $poster_name, $group->name, $content, $message_link );
    369 
    370             $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    371369
    372370            /* Send the message */
  • trunk/src/bp-friends/bp-friends-notifications.php

    r10417 r10479  
    2222 * the user of whom friendship has been requested ($friend_id).
    2323 *
     24 * @since 1.0
     25 *
    2426 * @param int $friendship_id ID of the friendship object.
    2527 * @param int $initiator_id  ID of the user who initiated the request.
    2628 * @param int $friend_id     ID of the request recipient.
    27  * @return bool
    2829 */
    2930function friends_notification_new_request( $friendship_id, $initiator_id, $friend_id ) {
    30 
    31     $initiator_name = bp_core_get_user_displayname( $initiator_id );
    32 
    33     if ( 'no' == bp_get_user_meta( (int) $friend_id, 'notification_friends_friendship_request', true ) )
    34         return false;
    35 
    36     $ud                = get_userdata( $friend_id );
    37     $all_requests_link = bp_core_get_user_domain( $friend_id ) . bp_get_friends_slug() . '/requests/';
    38     $settings_slug     = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    39     $settings_link     = trailingslashit( bp_core_get_user_domain( $friend_id ) .  $settings_slug . '/notifications' );
    40     $initiator_link    = bp_core_get_user_domain( $initiator_id );
    41 
    42     // Set up and send the message.
    43     $to       = $ud->user_email;
    44     $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name ) ) );
    45     $message  = sprintf( __(
    46 '%1$s wants to add you as a friend.
    47 
    48 To view all of your pending friendship requests: %2$s
    49 
    50 To view %3$s\'s profile: %4$s
    51 
    52 ---------------------
    53 ', 'buddypress' ), $initiator_name, $all_requests_link, $initiator_name, $initiator_link );
    54 
    55     // Only show the disable notifications line if the settings component is enabled.
    56     if ( bp_is_active( 'settings' ) ) {
    57         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    58     }
    59 
    60     /**
    61      * Filters the email address for who is getting the friend request.
    62      *
    63      * @since 1.2.0
    64      *
    65      * @param string $to Email address for who is getting the friend request.
    66      */
    67     $to      = apply_filters( 'friends_notification_new_request_to', $to );
    68 
    69     /**
    70      * Filters the subject for the friend request email.
    71      *
    72      * @since 1.2.0
    73      *
    74      * @param string $subject        Subject line to be used in friend request email.
    75      * @param string $initiator_name Name of the person requesting friendship.
    76      */
    77     $subject = apply_filters( 'friends_notification_new_request_subject', $subject, $initiator_name );
    78 
    79     /**
    80      * Filters the message for the friend request email.
    81      *
    82      * @since 1.2.0
    83      *
    84      * @param string $message           Message to be used in friend request email.
    85      * @param string $initiator_name    Name of the person requesting friendship.
    86      * @param string $initiator_link    Profile link of person requesting friendship.
    87      * @param string $all_requests_link User's friends request management link.
    88      * @param string $settings_link     Email recipient's settings management link.
    89      */
    90     $message = apply_filters( 'friends_notification_new_request_message', $message, $initiator_name, $initiator_link, $all_requests_link, $settings_link );
    91 
    92     wp_mail( $to, $subject, $message );
    93 
    94     /**
    95      * Fires after the new friend request email is sent.
    96      *
    97      * @since 1.5.0
    98      *
    99      * @param int    $friend_id     ID of the request recipient.
    100      * @param string $subject       Text for the friend request subject field.
    101      * @param string $message       Text for the friend request message field.
    102      * @param int    $friendship_id ID of the friendship object.
    103      * @param int    $initiator_id  ID of the friendship requester.
    104      */
    105     do_action( 'bp_friends_sent_request_email', $friend_id, $subject, $message, $friendship_id, $initiator_id );
     31    if ( 'no' == bp_get_user_meta( (int) $friend_id, 'notification_friends_friendship_request', true ) ) {
     32        return;
     33    }
     34
     35    $args = array(
     36        'tokens' => array(
     37            'friend-requests.url' => esc_url( bp_core_get_user_domain( $friend_id ) . bp_get_friends_slug() . '/requests/' ),
     38            'friend.id'           => $friend_id,
     39            'friendship.id'       => $friendship_id,
     40            'initiator.id'        => $initiator_id,
     41            'initiator.url'       => esc_url( bp_core_get_user_domain( $initiator_id ) ),
     42            'initiator.name'      => bp_core_get_user_displayname( $initiator_id ),
     43        ),
     44    );
     45    bp_send_email( 'friends-request', $friend_id, $args );
    10646}
    10747add_action( 'friends_friendship_requested', 'friends_notification_new_request', 10, 3 );
     
    11252 * When a friendship request is accepted, an email and a BP notification are
    11353 * sent to the user who requested the friendship ($initiator_id).
     54 *
     55 * @since 1.0
    11456 *
    11557 * @param int $friendship_id ID of the friendship object.
    11658 * @param int $initiator_id  ID of the user who initiated the request.
    11759 * @param int $friend_id     ID of the request recipient.
    118  * @return bool
    11960 */
    12061function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) {
    121 
    122     $friend_name = bp_core_get_user_displayname( $friend_id );
    123 
    124     if ( 'no' == bp_get_user_meta( (int) $initiator_id, 'notification_friends_friendship_accepted', true ) )
    125         return false;
    126 
    127     $ud            = get_userdata( $initiator_id );
    128     $friend_link   = bp_core_get_user_domain( $friend_id );
    129     $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    130     $settings_link = trailingslashit( bp_core_get_user_domain( $initiator_id ) . $settings_slug . '/notifications' );
    131 
    132     // Set up and send the message.
    133     $to       = $ud->user_email;
    134     $subject  = bp_get_email_subject( array( 'text' => sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name ) ) );
    135     $message  = sprintf( __(
    136 '%1$s accepted your friend request.
    137 
    138 To view %2$s\'s profile: %3$s
    139 
    140 ---------------------
    141 ', 'buddypress' ), $friend_name, $friend_name, $friend_link );
    142 
    143     // Only show the disable notifications line if the settings component is enabled.
    144     if ( bp_is_active( 'settings' ) ) {
    145         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    146     }
    147 
    148     /**
    149      * Filters the email address for whose friend request got accepted.
    150      *
    151      * @since 1.2.0
    152      *
    153      * @param string $to Email address for whose friend request got accepted.
    154      */
    155     $to      = apply_filters( 'friends_notification_accepted_request_to', $to );
    156 
    157     /**
    158      * Filters the subject for the friend request accepted email.
    159      *
    160      * @since 1.2.0
    161      *
    162      * @param string $subject     Subject line to be used in friend request accepted email.
    163      * @param string $friend_name Name of the person who accepted the friendship request.
    164      */
    165     $subject = apply_filters( 'friends_notification_accepted_request_subject', $subject, $friend_name );
    166 
    167     /**
    168      * Filters the message for the friend request accepted email.
    169      *
    170      * @since 1.2.0
    171      *
    172      * @param string $message       Message to be used in friend request email.
    173      * @param string $friend_name   Name of the person who accepted the friendship request.
    174      * @param string $friend_link   Profile link of person who accepted the friendship request.
    175      * @param string $settings_link Email recipient's settings management link.
    176      */
    177     $message = apply_filters( 'friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link );
    178 
    179     wp_mail( $to, $subject, $message );
    180 
    181     /**
    182      * Fires after the friend request accepted email is sent.
    183      *
    184      * @since 1.5.0
    185      *
    186      * @param int    $initiator_id  ID of the friendship requester.
    187      * @param string $subject       Text for the friend request subject field.
    188      * @param string $message       Text for the friend request message field.
    189      * @param int    $friendship_id ID of the friendship object.
    190      * @param int    $friend_id     ID of the request recipient.
    191      */
    192     do_action( 'bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id );
     62    if ( 'no' == bp_get_user_meta( (int) $initiator_id, 'notification_friends_friendship_accepted', true ) ) {
     63        return;
     64    }
     65
     66    $args = array(
     67        'tokens' => array(
     68            'friend.id'      => $friend_id,
     69            'friendship.url' => esc_url( bp_core_get_user_domain( $friend_id ) ),
     70            'friend.name'    => bp_core_get_user_displayname( $friend_id ),
     71            'friendship.id'  => $friendship_id,
     72            'initiator.id'   => $initiator_id,
     73        ),
     74    );
     75    bp_send_email( 'friends-request-accepted', $initiator_id, $args );
    19376}
    19477add_action( 'friends_friendship_accepted', 'friends_notification_accepted_request', 10, 3 );
  • trunk/src/bp-groups/bp-groups-notifications.php

    r10417 r10479  
    2525 */
    2626function groups_notification_group_updated( $group_id = 0, $old_group = null ) {
    27 
    2827    $group = groups_get_group( array( 'group_id' => $group_id ) );
    2928
     
    3332        if ( $group->name !== $old_group->name ) {
    3433            $changed[] = sprintf(
    35                 _x( '* Name changed from "%s" to "%s"', 'Group update email text', 'buddypress' ),
     34                _x( '* Name changed from "%s" to "%s".', 'Group update email text', 'buddypress' ),
    3635                esc_html( $old_group->name ),
    3736                esc_html( $group->name )
     
    4140        if ( $group->description !== $old_group->description ) {
    4241            $changed[] = sprintf(
    43                 _x( '* Description changed from "%s" to "%s"', 'Group update email text', 'buddypress' ),
     42                _x( '* Description changed from "%s" to "%s".', 'Group update email text', 'buddypress' ),
    4443                esc_html( $old_group->description ),
    4544                esc_html( $group->description )
     
    5958    $changed_text = '';
    6059    if ( ! empty( $changed ) ) {
    61         $changed_text = "\n\n" . implode( "\n", $changed );
    62     }
    63 
    64     $subject  = bp_get_email_subject( array( 'text' => __( 'Group Details Updated', 'buddypress' ) ) );
     60        $changed_text = implode( "\n", $changed );
     61    }
     62
    6563    $user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
    66 
    6764    foreach ( (array) $user_ids as $user_id ) {
    6865
     
    7269        }
    7370
    74         $ud = bp_core_get_core_userdata( $user_id );
    75 
    76         // Set up and send the message.
    77         $to = $ud->user_email;
    78 
    79         $group_link    = bp_get_group_permalink( $group );
    80         $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    81         $settings_link = bp_core_get_user_domain( $user_id ) . $settings_slug . '/notifications/';
    82 
    83         $message = sprintf( __(
    84 'Group details for the group "%1$s" were updated: %2$s
    85 
    86 To view the group: %3$s
    87 
    88 ---------------------
    89 ', 'buddypress' ), $group->name, $changed_text, $group_link );
    90 
    91         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    92 
    93         /**
    94          * Filters the user email that the group update notification will be sent to.
    95          *
    96          * @since 1.2.0
    97          *
    98          * @param string $to User email the notification is being sent to.
    99          */
    100         $to      = apply_filters( 'groups_notification_group_updated_to', $to );
    101 
    102         /**
    103          * Filters the group update notification subject that will be sent to user.
    104          *
    105          * @since 1.2.0
    106          *
    107          * @param string          $subject Email notification subject text.
    108          * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
    109          */
    110         $subject = apply_filters_ref_array( 'groups_notification_group_updated_subject', array( $subject, &$group ) );
    111 
    112         /**
    113          * Filters the group update notification message that will be sent to user.
    114          *
    115          * @since 1.2.0
    116          *
    117          * @param string          $message       Email notification message text.
    118          * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
    119          * @param string          $group_link    URL permalink to the group that was updated.
    120          * @param string          $settings_link URL permalink for the user's notification settings area.
    121          */
    122         $message = apply_filters_ref_array( 'groups_notification_group_updated_message', array( $message, &$group, $group_link, $settings_link ) );
    123 
    124         wp_mail( $to, $subject, $message );
    125 
    126         unset( $message, $to );
     71        $args = array(
     72            'tokens' => array(
     73                'changed_text' => $changed_text,
     74                'group'        => $group,
     75                'group.id'     => $group_id,
     76                'group.url'    => esc_url( bp_get_group_permalink( $group ) ),
     77                'group.name'   => $group->name,
     78            ),
     79        );
     80        bp_send_email( 'groups-details-updated', $user_id, $args );
    12781    }
    12882
     
    13387     *
    13488     * @since 1.5.0
     89     * @since 2.5.0 $subject has been unset and is deprecated.
    13590     *
    13691     * @param array  $user_ids Array of user IDs to notify about the update.
    137      * @param string $subject  Email notification subject text.
     92     * @param string $subject  Deprecated in 2.5; now an empty string.
    13893     * @param string $value    Empty string preventing PHP error.
    13994     * @param int    $group_id ID of the group that was updated.
    14095     */
    141     do_action( 'bp_groups_sent_updated_email', $user_ids, $subject, '', $group_id );
     96    do_action( 'bp_groups_sent_updated_email', $user_ids, '', '', $group_id );
    14297}
    14398
     
    151106 * @param int $group_id           ID of the group.
    152107 * @param int $membership_id      ID of the group membership object.
    153  * @return false|null False on failure.
    154108 */
    155109function groups_notification_new_membership_request( $requesting_user_id = 0, $admin_id = 0, $group_id = 0, $membership_id = 0 ) {
     
    168122    // Bail if member opted out of receiving this email.
    169123    if ( 'no' === bp_get_user_meta( $admin_id, 'notification_groups_membership_request', true ) ) {
    170         return false;
    171     }
    172 
    173     // Username of the user requesting a membership: %1$s in mail.
    174     $requesting_user_name = bp_core_get_user_displayname( $requesting_user_id );
    175     $group                = groups_get_group( array( 'group_id' => $group_id ) );
    176 
    177     // Group Administrator user's data.
    178     $ud             = bp_core_get_core_userdata( $admin_id );
    179     $group_requests = bp_get_group_permalink( $group ) . 'admin/membership-requests';
    180 
    181     // Link to the user's profile who's requesting a membership: %3$s in mail.
    182     $profile_link   = bp_core_get_user_domain( $requesting_user_id );
    183 
    184     $settings_slug  = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    185     // Link to the group administrator email settings: %s in "disable notifications" part of the email.
    186     $settings_link  = bp_core_get_user_domain( $admin_id ) . $settings_slug . '/notifications/';
    187 
    188     // Fetch the message, if there's one to fetch.
    189     $membership = new BP_Groups_Member( false, false, $membership_id );
    190 
    191     // Set up and send the message.
    192     $to       = $ud->user_email;
    193     $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name ) ) );
    194 
    195     if ( ! empty( $membership->comments ) ) {
    196         $message = sprintf( __(
    197 '%1$s wants to join the group "%2$s".
    198 
    199 Message from %1$s: "%3$s"
    200 
    201 Because you are the administrator of this group, you must either accept or reject the membership request.
    202 
    203 To view all pending membership requests for this group, please visit:
    204 %4$s
    205 
    206 To view %5$s\'s profile: %6$s
    207 
    208 ---------------------
    209 ', 'buddypress' ), $requesting_user_name, $group->name, esc_html( $membership->comments ), $group_requests, $requesting_user_name, $profile_link );
    210 
    211     } else {
    212 
    213         $message = sprintf( __(
    214 '%1$s wants to join the group "%2$s".
    215 
    216 Because you are the administrator of this group, you must either accept or reject the membership request.
    217 
    218 To view all pending membership requests for this group, please visit:
    219 %3$s
    220 
    221 To view %4$s\'s profile: %5$s
    222 
    223 ---------------------
    224 ', 'buddypress' ), $requesting_user_name, $group->name, $group_requests, $requesting_user_name, $profile_link );
    225     }
    226 
    227     // Only show the disable notifications line if the settings component is enabled.
    228     if ( bp_is_active( 'settings' ) ) {
    229         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    230     }
    231 
    232     /**
    233      * Filters the user email that the group membership request will be sent to.
    234      *
    235      * @since 1.2.0
    236      *
    237      * @param string $to User email the request is being sent to.
    238      */
    239     $to      = apply_filters( 'groups_notification_new_membership_request_to', $to );
    240 
    241     /**
    242      * Filters the group membership request subject that will be sent to user.
    243      *
    244      * @since 1.2.0
    245      *
    246      * @param string          $subject Membership request email subject text.
    247      * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
    248      */
    249     $subject = apply_filters_ref_array( 'groups_notification_new_membership_request_subject', array( $subject, &$group ) );
    250 
    251     /**
    252      * Filters the group membership request message that will be sent to user.
    253      *
    254      * @since 1.2.0
    255      *
    256      * @param string          $message              Membership request email message text.
    257      * @param BP_Groups_Group $group                Object holding the current group instance. Passed by reference.
    258      * @param string          $requesting_user_name Username of who is requesting membership.
    259      * @param string          $profile_link         URL permalink for the profile for the user requesting membership.
    260      * @param string          $group_requests       URL permalink for the group requests screen for group being requested membership to.
    261      * @param string          $settings_link        URL permalink for the user's notification settings area.
    262      */
    263     $message = apply_filters_ref_array( 'groups_notification_new_membership_request_message', array( $message, &$group, $requesting_user_name, $profile_link, $group_requests, $settings_link ) );
    264 
    265     wp_mail( $to, $subject, $message );
    266 
    267     /**
    268      * Fires after the notification is sent that a member has requested group membership.
    269      *
    270      * @since 1.5.0
    271      *
    272      * @param int    $admin_id           ID of the group administrator.
    273      * @param string $subject            Email notification subject text.
    274      * @param string $message            Email notification message text.
    275      * @param int    $requesting_user_id ID of the user requesting membership.
    276      * @param int    $group_id           ID of the group receiving membership request.
    277      * @param int    $membership_id      ID of the group membership object.
    278      */
    279     do_action( 'bp_groups_sent_membership_request_email', $admin_id, $subject, $message, $requesting_user_id, $group_id, $membership_id );
     124        return;
     125    }
     126
     127    $group = groups_get_group( array( 'group_id' => $group_id ) );
     128    $args  = array(
     129        'tokens' => array(
     130            'admin.id'             => $admin_id,
     131            'group'                => $group,
     132            'group.name'           => $group->name,
     133            'group.id'             => $group_id,
     134            'group-requests.url'   => esc_url( bp_get_group_permalink( $group ) . 'admin/membership-requests' ),
     135            'membership.id'        => $membership_id,
     136            'profile.url'          => esc_url( bp_core_get_user_domain( $requesting_user_id ) ),
     137            'requesting-user.id'   => $requesting_user_id,
     138            'requesting-user.name' => bp_core_get_user_displayname( $requesting_user_id ),
     139        ),
     140    );
     141    bp_send_email( 'groups-membership-request', $admin_id, $args );
    280142}
    281143
     
    289151 * @param bool $accepted           Optional. Whether the membership request was accepted.
    290152 *                                 Default: true.
    291  * @return false|null
    292153 */
    293154function groups_notification_membership_request_completed( $requesting_user_id = 0, $group_id = 0, $accepted = true ) {
     
    297158
    298159        // What type of acknowledgement.
    299         $type = ! empty( $accepted )
    300             ? 'membership_request_accepted'
    301             : 'membership_request_rejected';
     160        $type = ! empty( $accepted ) ? 'membership_request_accepted' : 'membership_request_rejected';
    302161
    303162        bp_notifications_add_notification( array(
     
    305164            'item_id'           => $group_id,
    306165            'component_name'    => buddypress()->groups->id,
    307             'component_action'  => $type
     166            'component_action'  => $type,
    308167        ) );
    309168    }
     
    311170    // Bail if member opted out of receiving this email.
    312171    if ( 'no' === bp_get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) ) {
    313         return false;
    314     }
    315 
    316     $group         = groups_get_group( array( 'group_id' => $group_id ) );
    317     $ud            = bp_core_get_core_userdata( $requesting_user_id );
    318     $group_link    = bp_get_group_permalink( $group );
    319     $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    320     $settings_link = bp_core_get_user_domain( $requesting_user_id ) . $settings_slug . '/notifications/';
    321     $to            = $ud->user_email;
    322 
    323     // Set up and send the message.
     172        return;
     173    }
     174
     175    $group = groups_get_group( array( 'group_id' => $group_id ) );
     176    $args  = array(
     177        'tokens' => array(
     178            'group'              => $group,
     179            'group.id'           => $group_id,
     180            'group.name'         => $group->name,
     181            'group.url'          => esc_url( bp_get_group_permalink( $group ) ),
     182            'requesting-user.id' => $requesting_user_id,
     183        ),
     184    );
     185
    324186    if ( ! empty( $accepted ) ) {
    325         $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group "%s" accepted', 'buddypress' ), $group->name ) ) );
    326         $message = sprintf( __(
    327 'Your membership request for the group "%1$s" has been accepted.
    328 
    329 To view the group please login and visit: %2$s
    330 
    331 ---------------------
    332 ', 'buddypress' ), $group->name, $group_link );
    333 
     187        bp_send_email( 'groups-membership-request-accepted', $requesting_user_id, $args );
    334188    } else {
    335         $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group "%s" rejected', 'buddypress' ), $group->name ) ) );
    336         $message = sprintf( __(
    337 'Your membership request for the group "%1$s" has been rejected.
    338 
    339 To submit another request please log in and visit: %2$s
    340 
    341 ---------------------
    342 ', 'buddypress' ), $group->name, $group_link );
    343     }
    344 
    345     // Only show the disable notifications line if the settings component is enabled.
    346     if ( bp_is_active( 'settings' ) ) {
    347         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    348     }
    349 
    350     /**
    351      * Filters the user email that the group membership request result will be sent to.
    352      *
    353      * @since 1.2.0
    354      *
    355      * @param string $to User email the request result is being sent to.
    356      */
    357     $to      = apply_filters( 'groups_notification_membership_request_completed_to', $to );
    358 
    359     /**
    360      * Filters the group membership request result subject that will be sent to user.
    361      *
    362      * @since 1.2.0
    363      *
    364      * @param string          $subject Membership request result email subject text.
    365      * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
    366      */
    367     $subject = apply_filters_ref_array( 'groups_notification_membership_request_completed_subject', array( $subject, &$group ) );
    368 
    369     /**
    370      * Filters the group membership request result message that will be sent to user.
    371      *
    372      * @since 1.2.0
    373      *
    374      * @param string          $message       Membership request result email message text.
    375      * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
    376      * @param string          $group_link    URL permalink for the group that was requested membership for.
    377      * @param string          $settings_link URL permalink for the user's notification settings area.
    378      */
    379     $message = apply_filters_ref_array( 'groups_notification_membership_request_completed_message', array( $message, &$group, $group_link, $settings_link ) );
    380 
    381     wp_mail( $to, $subject, $message );
    382 
    383     /**
    384      * Fires after the notification is sent that a membership has been approved.
    385      *
    386      * @since 1.5.0
    387      *
    388      * @param int    $requesting_user_id ID of the user whose membership was approved.
    389      * @param string $subject            Email notification subject text.
    390      * @param string $message            Email notification message text.
    391      * @param int    $group_id           ID of the group that was joined.
    392      */
    393     do_action( 'bp_groups_sent_membership_approved_email', $requesting_user_id, $subject, $message, $group_id );
     189        bp_send_email( 'groups-membership-request-rejected', $requesting_user_id, $args );
     190    }
    394191}
    395192add_action( 'groups_membership_accepted', 'groups_notification_membership_request_completed', 10, 3 );
     
    403200 * @param int $user_id  ID of the user.
    404201 * @param int $group_id ID of the group.
    405  * @return false|null False on failure.
    406202 */
    407203function groups_notification_promoted_member( $user_id = 0, $group_id = 0 ) {
     
    422218            'item_id'           => $group_id,
    423219            'component_name'    => buddypress()->groups->id,
    424             'component_action'  => $type
     220            'component_action'  => $type,
    425221        ) );
    426222    }
     
    428224    // Bail if admin opted out of receiving this email.
    429225    if ( 'no' === bp_get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) ) {
    430         return false;
    431     }
    432 
    433     $group         = groups_get_group( array( 'group_id' => $group_id ) );
    434     $ud            = bp_core_get_core_userdata($user_id);
    435     $group_link    = bp_get_group_permalink( $group );
    436     $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    437     $settings_link = bp_core_get_user_domain( $user_id ) . $settings_slug . '/notifications/';
    438 
    439     // Set up and send the message.
    440     $to       = $ud->user_email;
    441     $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'You have been promoted in the group: "%s"', 'buddypress' ), $group->name ) ) );
    442     $message  = sprintf( __(
    443 'You have been promoted to %1$s for the group: "%2$s".
    444 
    445 To view the group please visit: %3$s
    446 
    447 ---------------------
    448 ', 'buddypress' ), $promoted_to, $group->name, $group_link );
    449 
    450     // Only show the disable notifications line if the settings component is enabled.
    451     if ( bp_is_active( 'settings' ) ) {
    452         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    453     }
    454 
    455     /**
    456      * Filters the user email that the group promotion notification will be sent to.
    457      *
    458      * @since 1.2.0
    459      *
    460      * @param string $to User email the promotion notification is being sent to.
    461      */
    462     $to      = apply_filters( 'groups_notification_promoted_member_to', $to );
    463 
    464     /**
    465      * Filters the group promotion notification subject that will be sent to user.
    466      *
    467      * @since 1.2.0
    468      *
    469      * @param string          $subject Promotion notification email subject text.
    470      * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
    471      */
    472     $subject = apply_filters_ref_array( 'groups_notification_promoted_member_subject', array( $subject, &$group ) );
    473 
    474     /**
    475      * Filters the group promotion notification message that will be sent to user.
    476      *
    477      * @since 1.2.0
    478      *
    479      * @param string          $message       Promotion notification email message text.
    480      * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
    481      * @param string          $promoted_to   Role that the user was promoted to within the group.
    482      * @param string          $group_link    URL permalink for the group that the promotion was related to.
    483      * @param string          $settings_link URL permalink for the user's notification settings area.
    484      */
    485     $message = apply_filters_ref_array( 'groups_notification_promoted_member_message', array( $message, &$group, $promoted_to, $group_link, $settings_link ) );
    486 
    487     wp_mail( $to, $subject, $message );
    488 
    489     /**
    490      * Fires after the notification is sent that a member has been promoted.
    491      *
    492      * @since 1.5.0
    493      *
    494      * @param int    $user_id  ID of the user who was promoted.
    495      * @param string $subject  Email notification subject text.
    496      * @param string $message  Email notification message text.
    497      * @param int    $group_id ID of the group that the user is a member of.
    498      */
    499     do_action( 'bp_groups_sent_promoted_email', $user_id, $subject, $message, $group_id );
     226        return;
     227    }
     228
     229    $group = groups_get_group( array( 'group_id' => $group_id ) );
     230    $args  = array(
     231        'tokens' => array(
     232            'group'       => $group,
     233            'group.id'    => $group_id,
     234            'group.url'   => esc_url( bp_get_group_permalink( $group ) ),
     235            'group.name'  => $group->name,
     236            'promoted_to' => $promoted_to,
     237            'user.id'     => $user_id,
     238        ),
     239    );
     240    bp_send_email( 'groups-member-promoted', $user_id, $args );
    500241}
    501242add_action( 'groups_promoted_member', 'groups_notification_promoted_member', 10, 2 );
     
    509250 * @param BP_Groups_Member $member          Member object.
    510251 * @param int              $inviter_user_id ID of the user who sent the invite.
    511  * @return null|false False on failure.
    512252 */
    513253function groups_notification_group_invites( &$group, &$member, $inviter_user_id ) {
     
    519259
    520260    // @todo $inviter_ud may be used for caching, test without it
    521     $inviter_ud   = bp_core_get_core_userdata( $inviter_user_id );
    522     $inviter_name = bp_core_get_userlink( $inviter_user_id, true, false, true );
    523     $inviter_link = bp_core_get_user_domain( $inviter_user_id );
    524     $group_link   = bp_get_group_permalink( $group );
    525 
    526     // Setup the ID for the invited user.
     261    $inviter_ud      = bp_core_get_core_userdata( $inviter_user_id );
    527262    $invited_user_id = $member->user_id;
    528263
     
    533268            'item_id'          => $group->id,
    534269            'component_name'   => buddypress()->groups->id,
    535             'component_action' => 'group_invite'
     270            'component_action' => 'group_invite',
    536271        ) );
    537272    }
     
    539274    // Bail if member opted out of receiving this email.
    540275    if ( 'no' === bp_get_user_meta( $invited_user_id, 'notification_groups_invite', true ) ) {
    541         return false;
    542     }
    543 
    544     $invited_ud    = bp_core_get_core_userdata( $invited_user_id );
    545     $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    546     $settings_link = bp_core_get_user_domain( $invited_user_id ) . $settings_slug . '/notifications/';
    547     $invited_link  = bp_core_get_user_domain( $invited_user_id );
    548     $invites_link  = trailingslashit( $invited_link . bp_get_groups_slug() . '/invites' );
    549 
    550     // Set up and send the message.
    551     $to       = $invited_ud->user_email;
    552     $subject  = bp_get_email_subject( array( 'text' => sprintf( __( 'You have an invitation to the group: "%s"', 'buddypress' ), $group->name ) ) );
    553     $message  = sprintf( __(
    554 'One of your friends %1$s has invited you to the group: "%2$s".
    555 
    556 To view your group invites visit: %3$s
    557 
    558 To view the group visit: %4$s
    559 
    560 To view %5$s\'s profile visit: %6$s
    561 
    562 ---------------------
    563 ', 'buddypress' ), $inviter_name, $group->name, $invites_link, $group_link, $inviter_name, $inviter_link );
    564 
    565     // Only show the disable notifications line if the settings component is enabled.
    566     if ( bp_is_active( 'settings' ) ) {
    567         $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    568     }
    569 
    570     /**
    571      * Filters the user email that the group invite notification will be sent to.
    572      *
    573      * @since 1.2.0
    574      *
    575      * @param string $to User email the invite notification is being sent to.
    576      */
    577     $to      = apply_filters( 'groups_notification_group_invites_to', $to );
    578 
    579     /**
    580      * Filters the group invite notification subject that will be sent to user.
    581      *
    582      * @since 1.2.0
    583      *
    584      * @param string          $subject Invite notification email subject text.
    585      * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
    586      */
    587     $subject = apply_filters_ref_array( 'groups_notification_group_invites_subject', array( $subject, &$group ) );
    588 
    589     /**
    590      * Filters the group invite notification message that will be sent to user.
    591      *
    592      * @since 1.2.0
    593      *
    594      * @param string          $message       Invite notification email message text.
    595      * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
    596      * @param string          $inviter_name  Username for the person doing the inviting.
    597      * @param string          $inviter_link  Profile link for the person doing the inviting.
    598      * @param string          $invites_link  URL permalink for the invited user's invite management screen.
    599      * @param string          $group_link    URL permalink for the group that the invite was related to.
    600      * @param string          $settings_link URL permalink for the user's notification settings area.
    601      */
    602     $message = apply_filters_ref_array( 'groups_notification_group_invites_message', array( $message, &$group, $inviter_name, $inviter_link, $invites_link, $group_link, $settings_link ) );
    603 
    604     wp_mail( $to, $subject, $message );
    605 
    606     /**
    607      * Fires after the notification is sent that a member has been invited to a group.
    608      *
    609      * @since 1.5.0
    610      *
    611      * @param int             $invited_user_id  ID of the user who was invited.
    612      * @param string          $subject          Email notification subject text.
    613      * @param string          $message          Email notification message text.
    614      * @param BP_Groups_Group $group            Group object.
    615      */
    616     do_action( 'bp_groups_sent_invited_email', $invited_user_id, $subject, $message, $group );
     276        return;
     277    }
     278
     279    $invited_link = bp_core_get_user_domain( $invited_user_id ) . bp_get_groups_slug();
     280    $args         = array(
     281        'tokens' => array(
     282            'group'                => $group,
     283            'group.url'            => bp_get_group_permalink( $group ),
     284            'group.name'           => $group->name,
     285            'inviter-profile.id'   => $invited_user_id,
     286            'inviter-profile.name' => bp_core_get_userlink( $inviter_user_id, true, false, true ),
     287            'inviter-profile.url'  => bp_core_get_user_domain( $inviter_user_id ),
     288            'invites.url'          => esc_url( $invited_link . '/invites/' ),
     289        ),
     290    );
     291    bp_send_email( 'groups-invitation', $invited_user_id, $args );
    617292}
    618293
  • trunk/src/bp-loader.php

    r10475 r10479  
    507507            require( $this->plugin_dir . 'bp-core/deprecated/2.3.php' );
    508508            require( $this->plugin_dir . 'bp-core/deprecated/2.4.php' );
     509            require( $this->plugin_dir . 'bp-core/deprecated/2.5.php' );
    509510        }
    510511    }
  • 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
  • trunk/src/bp-messages/bp-messages-notifications.php

    r10417 r10479  
    2727 */
    2828function messages_notification_new_message( $raw_args = array() ) {
    29 
    30     // Cast possible $message object as an array.
    3129    if ( is_object( $raw_args ) ) {
    3230        $args = (array) $raw_args;
     
    4341    extract( $args );
    4442
    45     // Get the sender display name.
     43    if ( empty( $recipients ) ) {
     44        return;
     45    }
     46
    4647    $sender_name = bp_core_get_user_displayname( $sender_id );
    4748
    48     // Bail if no recipients.
    49     if ( ! empty( $recipients ) ) {
    50 
    51         foreach ( $recipients as $recipient ) {
    52 
    53             if ( $sender_id == $recipient->user_id || 'no' == bp_get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) ) {
    54                 continue;
    55             }
    56 
    57             // User data and links.
    58             $ud = get_userdata( $recipient->user_id );
    59 
    60             // Bail if user cannot be found.
    61             if ( empty( $ud ) ) {
    62                 continue;
    63             }
    64 
    65             $message_link  = bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() .'/';
    66             $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    67             $settings_link = bp_core_get_user_domain( $recipient->user_id ) . $settings_slug . '/notifications/';
    68 
    69             // Sender info.
    70             $sender_name   = stripslashes( $sender_name );
    71             $subject       = stripslashes( wp_filter_kses( $subject ) );
    72             $content       = stripslashes( wp_filter_kses( $message ) );
    73 
    74             // Set up and send the message.
    75             $email_to      = $ud->user_email;
    76             $email_subject = bp_get_email_subject( array( 'text' => sprintf( __( 'New message from %s', 'buddypress' ), $sender_name ) ) );
    77 
    78             $email_content = sprintf( __(
    79 '%1$s sent you a new message:
    80 
    81 Subject: %2$s
    82 
    83 "%3$s"
    84 
    85 To view and read your messages please log in and visit: %4$s
    86 
    87 ---------------------
    88 ', 'buddypress' ), $sender_name, $subject, $content, $message_link );
    89 
    90             // Only show the disable notifications line if the settings component is enabled.
    91             if ( bp_is_active( 'settings' ) ) {
    92                 $email_content .= sprintf( __( 'To disable these notifications, please log in and go to: %s', 'buddypress' ), $settings_link );
    93             }
    94 
    95             /**
    96              * Filters the user email that the message notification will be sent to.
    97              *
    98              * @since 1.2.0
    99              *
    100              * @param string  $email_to User email the notification is being sent to.
    101              * @param WP_User $ud       WP_User object of who is receiving the message.
    102              */
    103             $email_to      = apply_filters( 'messages_notification_new_message_to',      $email_to, $ud );
    104 
    105             /**
    106              * Filters the message notification subject that will be sent to user.
    107              *
    108              * @since 1.2.0
    109              *
    110              * @param string  $email_subject Email notification subject text.
    111              * @param string  $sender_name   Name of the person who sent the message.
    112              * @param WP_User $ud            WP_User object of who is receiving the message.
    113              */
    114             $email_subject = apply_filters( 'messages_notification_new_message_subject', $email_subject, $sender_name, $ud );
    115 
    116             /**
    117              * Filters the message notification message that will be sent to user.
    118              *
    119              * @since 1.2.0
    120              *
    121              * @param string  $email_content Email notification message text.
    122              * @param string  $sender_name   Name of the person who sent the message.
    123              * @param string  $subject       Email notification subject text.
    124              * @param string  $content       Content of the message.
    125              * @param string  $message_link  URL permalink for the message.
    126              * @param string  $settings_link URL permalink for the user's notification settings area.
    127              * @param WP_User $ud            WP_User object of who is receiving the message.
    128              */
    129             $email_content = apply_filters( 'messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud );
    130 
    131             wp_mail( $email_to, $email_subject, $email_content );
    132         }
     49    // Send an email to each recipient.
     50    foreach ( $recipients as $recipient ) {
     51        if ( $sender_id == $recipient->user_id || 'no' == bp_get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) ) {
     52            continue;
     53        }
     54
     55        // User data and links.
     56        $ud = get_userdata( $recipient->user_id );
     57        if ( empty( $ud ) ) {
     58            continue;
     59        }
     60
     61        $args = array(
     62            'tokens' => array(
     63                'usermessage' => wp_strip_all_tags( $message ),
     64                'message.url' => esc_url( bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() . '/' ),
     65                'sender.name' => $sender_name,
     66                'usersubject' => sanitize_text_field( $subject ),
     67            ),
     68        );
     69        bp_send_email( 'messages-unread', $ud, $args );
    13370    }
    13471
     
    13774     *
    13875     * @since 1.5.0
     76     * @deprecated 2.5.0 Use the filters in BP_Email.
     77     *                   $email_subject and $email_content arguments unset and deprecated.
    13978     *
    14079     * @param array  $recipients    User IDs of recipients.
    141      * @param string $email_subject Email notification subject text.
    142      * @param string $email_content Email notification message text.
    143      * @param array  $$args         Array of originally provided arguments.
     80     * @param string $email_subject Deprecated in 2.5; now an empty string.
     81     * @param string $email_content Deprecated in 2.5; now an empty string.
     82     * @param array  $args          Array of originally provided arguments.
    14483     */
    145     do_action( 'bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args );
     84    do_action( 'bp_messages_sent_notification_email', $recipients, '', '', $args );
    14685}
    14786add_action( 'messages_message_sent', 'messages_notification_new_message', 10 );
  • trunk/src/bp-settings/bp-settings-actions.php

    r10417 r10479  
    101101
    102102                    bp_update_user_meta( bp_displayed_user_id(), 'pending_email_change', $pending_email );
    103 
    104                     $email_text = sprintf(
    105                         __( 'Dear %1$s,
    106 
    107 You recently changed the email address associated with your account on %2$s.
    108 If this is correct, please click on the following link to complete the change:
    109 %3$s
    110 
    111 You can safely ignore and delete this email if you do not want to take this action or if you have received this email in error.
    112 
    113 This email has been sent to %4$s.
    114 
    115 Regards,
    116 %5$s
    117 %6$s', 'buddypress' ),
    118                         bp_core_get_user_displayname( bp_displayed_user_id() ),
    119                         bp_get_site_name(),
    120                         esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/?verify_email_change=' . $hash ),
    121                         $user_email,
    122                         bp_get_site_name(),
    123                         bp_get_root_domain()
     103                    $verify_link = bp_displayed_user_domain() . bp_get_settings_slug() . '/?verify_email_change=' . $hash;
     104
     105                    // Send the verification email
     106                    $args = array(
     107                        'tokens' => array(
     108                            'displayname'    => bp_core_get_user_displayname( bp_displayed_user_id() ),
     109                            'old-user.email' => $old_user_email,
     110                            'user.email'     => $user_email,
     111                            'verify.url'     => esc_url( $verify_link ),
     112                        ),
    124113                    );
    125 
    126                     /**
    127                      * Filter the email text sent when a user changes emails.
    128                      *
    129                      * @since 2.1.0
    130                      *
    131                      * @param string  $email_text     Text of the email.
    132                      * @param string  $new_user_email New user email that the
    133                      *                                current user has changed to.
    134                      * @param string  $old_user_email Existing email address
    135                      *                                for the current user.
    136                      * @param WP_User $update_user    Userdata object for the current user.
    137                      */
    138                     $content = apply_filters( 'bp_new_user_email_content', $email_text, $user_email, $old_user_email, $update_user );
    139 
    140                     // Send the verification email
    141                     wp_mail( $user_email, sprintf( __( '[%s] Verify your new email address', 'buddypress' ), wp_specialchars_decode( bp_get_site_name() ) ), $content );
     114                    bp_send_email( 'settings-verify-email-change', bp_displayed_user_id(), $args );
    142115
    143116                    // We mark that the change has taken place so as to ensure a
Note: See TracChangeset for help on using the changeset viewer.