Changeset 3403 for trunk/bp-activity.php
- Timestamp:
- 11/12/2010 10:35:06 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r3373 r3403 136 136 bp_core_load_template( apply_filters( 'bp_activity_template_mention_activity', 'members/single/home' ) ); 137 137 } 138 139 /** 140 * bp_activity_remove_screen_notifications() 141 * 142 * Removes activity notifications from the notification menu when a user clicks on them and 143 * is taken to a specific screen. 144 * 145 * @package BuddyPress Activity 146 */ 147 function bp_activity_remove_screen_notifications() { 148 global $bp; 149 150 bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->activity->id, 'new_at_mention' ); 151 } 152 add_action( 'bp_activity_screen_my_activity', 'bp_activity_remove_screen_notifications' ); 153 add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_screen_notifications' ); 154 add_action( 'bp_activity_screen_mentions', 'bp_activity_remove_screen_notifications' ); 138 155 139 156 function bp_activity_screen_single_activity_permalink() { … … 484 501 } 485 502 add_action( 'wp', 'bp_activity_action_favorites_feed', 3 ); 503 504 /** 505 * bp_activity_format_notifications() 506 * 507 * Formats notifications related to activity 508 * 509 * @package BuddyPress Activity 510 * @param $action The type of activity item. Just 'new_at_mention' for now 511 * @param $item_id The activity id 512 * @param $secondary_item_id In the case of at-mentions, this is the mentioner's id 513 * @param $total_items The total number of notifications to format 514 */ 515 function bp_activity_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) { 516 global $bp; 517 518 switch ( $action ) { 519 case 'new_at_mention': 520 $activity_id = $item_id; 521 $poster_user_id = $secondary_item_id; 522 523 $at_mention_link = $bp->loggedin_user->domain . $bp->activity->slug . '/mentions/'; 524 $at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), $bp->loggedin_user->userdata->user_nicename ); 525 526 if ( (int)$total_items > 1 ) { 527 return apply_filters( 'bp_activity_multiple_at_mentions_notification', '<a href="' . $at_mention_link . '" title="' . $at_mention_title . '">' . sprintf( __( 'You have %1$d new activity mentions', 'buddypress' ), (int)$total_items ) . '</a>', $at_mention_link, $total_items, $activity_id, $poster_user_id ); 528 } else { 529 $user_fullname = bp_core_get_user_displayname( $poster_user_id ); 530 531 return apply_filters( 'bp_activity_single_at_mentions_notification', '<a href="' . $at_mention_link . '" title="' . $at_mention_title . '">' . sprintf( __( '%1$s mentioned you in an activity update', 'buddypress' ), $user_fullname ) . '</a>', $at_mention_link, $total_items, $activity_id, $poster_user_id ); 532 } 533 break; 534 } 535 536 do_action( 'activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items ); 537 538 return false; 539 } 486 540 487 541 /********************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.