Skip to:
Content

BuddyPress.org

Changeset 2501


Ignore:
Timestamp:
01/31/2010 05:25:57 PM (16 years ago)
Author:
apeatling
Message:

Allow notification of comment replies.

File:
1 edited

Legend:

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

    r2500 r2501  
    5454    $original_activity = new BP_Activity_Activity( $activity_id );
    5555
    56     /* Don't email comments on a member's own activity */
    57     if ( $original_activity->user_id == $commenter_id )
    58         return false;
    59 
    60     if ( 'no' != get_usermeta( $original_activity->user_id, 'notification_activity_new_reply' ) ) {
     56    if ( $original_activity->user_id != $commenter_id && 'no' != get_usermeta( $original_activity->user_id, 'notification_activity_new_reply' ) ) {
    6157        $poster_name = bp_core_get_user_displayname( $commenter_id );
    6258        $thread_link = bp_activity_get_permalink( $activity_id );
     
    8379        wp_mail( $to, $subject, $message );
    8480    }
     81
     82    /***
     83     * If this is a reply to another comment, send an email notification to the
     84     * author of the immediate parent comment.
     85     */
     86    if ( $activity_id == $parent_id )
     87        return false;
     88
     89    $parent_comment = new BP_Activity_Activity( $parent_id );
     90
     91    if ( $parent_comment->user_id != $commenter_id && 'no' != get_usermeta( $parent_comment->user_id, 'notification_activity_new_reply' ) ) {
     92        $poster_name = bp_core_get_user_displayname( $commenter_id );
     93        $thread_link = bp_activity_get_permalink( $activity_id );
     94        $settings_link = bp_core_get_user_domain( $parent_comment->user_id ) . 'settings/notifications/';
     95
     96        // Set up and send the message
     97        $ud = bp_core_get_core_userdata( $parent_comment->user_id );
     98        $to = $ud->user_email;
     99        $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s replied to one of your comments', 'buddypress' ), stripslashes_deep( $poster_name ) );
     100
     101$message = sprintf( __(
     102'%s replied to one of your comments:
     103
     104"%s"
     105
     106To view the original activity, your comment and all replies, log in and visit: %s
     107
     108---------------------
     109', 'buddypress' ), $poster_name, wp_filter_kses( stripslashes_deep( $content ) ), $thread_link );
     110
     111        $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
     112
     113        // Send it
     114        wp_mail( $to, $subject, $message );
     115    }
    85116}
    86117
Note: See TracChangeset for help on using the changeset viewer.