Changeset 7529
- Timestamp:
- 11/08/2013 05:09:31 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-screens.php
r7402 r7529 134 134 * @since BuddyPress (1.5) 135 135 * 136 * @global object $bp BuddyPress global settings 137 * @uses bp_core_delete_notifications_by_type() 136 * @uses bp_core_mark_all_notifications_by_type() 138 137 */ 139 138 function bp_activity_remove_screen_notifications() { 140 global $bp; 141 142 bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->activity->id, 'new_at_mention' ); 139 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), buddypress()->activity->id, 'new_at_mention' ); 143 140 } 144 141 add_action( 'bp_activity_screen_my_activity', 'bp_activity_remove_screen_notifications' ); -
trunk/bp-friends/bp-friends-cache.php
r6342 r7529 24 24 25 25 function friends_clear_friend_notifications() { 26 global $bp; 27 28 if ( isset( $_GET['new'] ) ) 29 bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->friends->id, 'friendship_accepted' ); 26 if ( isset( $_GET['new'] ) ) { 27 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_accepted' ); 28 } 30 29 } 31 30 add_action( 'bp_activity_screen_my_activity', 'friends_clear_friend_notifications' ); -
trunk/bp-friends/bp-friends-screens.php
r6342 r7529 16 16 17 17 function friends_screen_my_friends() { 18 global $bp;19 18 20 19 // Delete any friendship acceptance notifications for the user when viewing a profile 21 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->friends->id, 'friendship_accepted' );20 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_accepted' ); 22 21 23 22 do_action( 'friends_screen_my_friends' ); … … 63 62 do_action( 'friends_screen_requests' ); 64 63 65 if ( isset( $_GET['new'] ) ) 66 bp_core_delete_notifications_by_type( bp_loggedin_user_id(), 'friends', 'friendship_request' ); 64 if ( isset( $_GET['new'] ) ) { 65 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), buddypress()->friends->id, 'friendship_request' ); 66 } 67 67 68 68 bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) ); -
trunk/bp-groups/bp-groups-screens.php
r7442 r7529 32 32 // Delete group request notifications for the user 33 33 if ( isset( $_GET['n'] ) ) { 34 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' );35 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' );36 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod' );37 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin' );34 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' ); 35 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' ); 36 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod' ); 37 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin' ); 38 38 } 39 39 … … 95 95 96 96 // Remove notifications 97 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), 'groups', 'group_invite' );97 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'group_invite' ); 98 98 99 99 do_action( 'groups_screen_group_invites', $group_id ); … … 110 110 111 111 if ( isset( $_GET['n'] ) ) { 112 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' );113 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' );114 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod' );115 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin' );112 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' ); 113 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' ); 114 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod' ); 115 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin' ); 116 116 } 117 117 … … 814 814 815 815 // Remove any screen notifications 816 bp_core_ delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'new_membership_request' );816 bp_core_mark_all_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'new_membership_request' ); 817 817 818 818 $request_action = (string)bp_action_variable( 1 ); -
trunk/bp-members/bp-members-notifications.php
r7522 r7529 147 147 * Delete all notifications for by type 148 148 * 149 * @since BuddyPress (1.0) 150 * @param int $user_id 151 * @param string $component_name 152 * @param string $component_action 153 * @return boolean True on success, false on fail 154 */ 155 function bp_core_delete_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false ) { 156 157 // Bail if notifications is not active 158 if ( ! bp_is_active( 'notifications' ) ) { 159 return false; 160 } 161 162 bp_notifications_delete_all_notifications_by_type( $item_id, $component_name, $component_action, $secondary_item_id ); 163 } 164 165 /** 166 * Mark all notifications read/unread for by type 167 * 149 168 * Used when clearing out notifications for an entire component 150 169 * 151 * @since BuddyPress (1. 0)152 * @param int $user_id 153 * @param string $component_name 154 * @param string $component_action 155 * @return boolean True on success, false on fail 156 */ 157 function bp_core_ delete_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id= false ) {158 159 // Bail if notifications is not active 160 if ( ! bp_is_active( 'notifications' ) ) { 161 return false; 162 } 163 164 bp_notifications_ delete_all_notifications_by_type( $item_id, $component_name, $component_action, $secondary_item_id);170 * @since BuddyPress (1.9) 171 * @param int $user_id 172 * @param string $component_name 173 * @param string $component_action 174 * @return boolean True on success, false on fail 175 */ 176 function bp_core_mark_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false, $is_new = false ) { 177 178 // Bail if notifications is not active 179 if ( ! bp_is_active( 'notifications' ) ) { 180 return false; 181 } 182 183 bp_notifications_mark_all_notifications_by_type( $item_id, $component_name, $component_action, $secondary_item_id, $is_new ); 165 184 } 166 185 -
trunk/bp-notifications/bp-notifications-functions.php
r7528 r7529 300 300 * 301 301 * @param int $user_id ID of the user whose notifications are being deleted. 302 * @param int $is_new 0 for read, 1 for unread303 * @param string $component_ name Name of the associated component.304 * @param string $component_action Name of the associated action.305 * @return bool True on success, false on failure. 306 */ 307 function bp_notifications_mark_notifications_by_type( $user_id, $ is_new, $component_name, $component_action) {302 * @param string $component_name Name of the associated component. 303 * @param string $component_action Name of the associated action. 304 * @param int $is_new 0 for read, 1 for unread 305 * @return bool True on success, false on failure. 306 */ 307 function bp_notifications_mark_notifications_by_type( $user_id, $component_name, $component_action, $is_new = false ) { 308 308 return BP_Notifications_Notification::delete( array( 309 309 'user_id' => $user_id, … … 324 324 * @param int $user_id ID of the user whose notifications are being deleted. 325 325 * @param int $item_id ID of the associated item. 326 * @param int $is_new 0 for read, 1 for unread327 326 * @param string $component_name Name of the associated component. 328 327 * @param string $component_action Name of the associated action. 329 328 * @param int $secondary_item_id ID of the secondary associated item. 330 * @return bool True on success, false on failure. 331 */ 332 function bp_notifications_mark_notifications_by_item_id( $user_id, $item_id, $is_new, $component_name, $component_action, $secondary_item_id = false ) { 329 * @param int $is_new 0 for read, 1 for unread 330 * @return bool True on success, false on failure. 331 */ 332 function bp_notifications_mark_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false, $is_new = false ) { 333 333 return BP_Notifications_Notification::delete( array( 334 334 'user_id' => $user_id, … … 353 353 * @param string $component_action Optional. Name of the associated action. 354 354 * @param int $secondary_item_id Optional. ID of the secondary associated item. 355 * @return bool True on success, false on failure. 356 */ 357 function bp_notifications_mark_all_notifications_by_type( $item_id, $is_new, $component_name, $component_action = false, $secondary_item_id = false ) { 355 * @param int $is_new 0 for read, 1 for unread 356 * @return bool True on success, false on failure. 357 */ 358 function bp_notifications_mark_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false, $is_new = false ) { 358 359 return BP_Notifications_Notification::delete( array( 359 360 'item_id' => $item_id, … … 380 381 * @param string $component_name Name of the associated component. 381 382 * @param string $component_action Name of the associated action. 382 * @return bool True on success, false on failure. 383 */ 384 function bp_notifications_mark_notifications_from_user( $user_id, $is_new, $component_name, $component_action ) { 383 * @param int $is_new 0 for read, 1 for unread 384 * @return bool True on success, false on failure. 385 */ 386 function bp_notifications_mark_notifications_from_user( $user_id, $component_name, $component_action, $is_new = false ) { 385 387 return BP_Notifications_Notification::delete( array( 386 388 'item_id' => $user_id,
Note: See TracChangeset
for help on using the changeset viewer.