Skip to:
Content

BuddyPress.org

Ticket #6687: 6687.patch

File 6687.patch, 2.0 KB (added by imath, 9 years ago)
  • src/bp-activity/bp-activity-functions.php

    diff --git src/bp-activity/bp-activity-functions.php src/bp-activity/bp-activity-functions.php
    index 9e5ab42..3e7ac28 100644
    function bp_activity_find_mentions( $content ) { 
    132132function bp_activity_clear_new_mentions( $user_id ) {
    133133        bp_delete_user_meta( $user_id, 'bp_new_mention_count' );
    134134        bp_delete_user_meta( $user_id, 'bp_new_mentions'      );
     135
     136        /**
     137         * Fires once mentions has been cleared for a given user.
     138         *
     139         * @since  ?
     140         *
     141         * @param  int $user_id
     142         */
     143        do_action( 'bp_activity_clear_new_mentions', $user_id );
    135144}
    136145
    137146/**
  • src/bp-activity/bp-activity-notifications.php

    diff --git src/bp-activity/bp-activity-notifications.php src/bp-activity/bp-activity-notifications.php
    index e2b233c..542726c 100644
    add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notifi 
    501501 *
    502502 * @uses bp_notifications_mark_all_notifications_by_type()
    503503 */
    504 function bp_activity_remove_screen_notifications() {
     504function bp_activity_remove_screen_notifications( $user_id = 0 ) {
    505505        if ( ! bp_is_active( 'notifications' ) ) {
    506506                return;
    507507        }
    508508
    509509        // Only mark read if you're looking at your own mentions.
    510         if ( ! bp_is_my_profile() ) {
    511                 return;
     510        if ( bp_is_my_profile() || (int) $user_id === (int) bp_loggedin_user_id() ) {
     511                bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->activity->id, 'new_at_mention' );
    512512        }
    513 
    514         bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->activity->id, 'new_at_mention' );
    515513}
    516 add_action( 'bp_activity_screen_mentions', 'bp_activity_remove_screen_notifications' );
     514add_action( 'bp_activity_screen_mentions', 'bp_activity_remove_screen_notifications', 10, 0 );
     515add_action( 'bp_activity_clear_new_mentions', 'bp_activity_remove_screen_notifications', 10, 1 );
    517516
    518517/**
    519518 * Mark at-mention notification as read when user visits the activity with the mention.