Changeset 7528
- Timestamp:
- 11/08/2013 04:52:07 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-notifications/bp-notifications-functions.php
r7521 r7528 195 195 } 196 196 197 /** Delete ********************************************************************/ 198 197 199 /** 198 200 * Delete notifications for a user by type. … … 287 289 } 288 290 291 /** Mark **********************************************************************/ 292 293 /** 294 * Mark notifications read/unread for a user by type. 295 * 296 * Used when clearing out notifications for a specific component when the user 297 * has visited that component. 298 * 299 * @since BuddyPress (1.9.0) 300 * 301 * @param int $user_id ID of the user whose notifications are being deleted. 302 * @param int $is_new 0 for read, 1 for unread 303 * @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 ) { 308 return BP_Notifications_Notification::delete( array( 309 'user_id' => $user_id, 310 'component_name' => $component_name, 311 'component_action' => $component_action, 312 'is_new' => $is_new 313 ) ); 314 } 315 316 /** 317 * Mark notifications read/unread for an item ID. 318 * 319 * Used when clearing out notifications for a specific component when the user 320 * has visited that component. 321 * 322 * @since BuddyPress (1.9.0) 323 * 324 * @param int $user_id ID of the user whose notifications are being deleted. 325 * @param int $item_id ID of the associated item. 326 * @param int $is_new 0 for read, 1 for unread 327 * @param string $component_name Name of the associated component. 328 * @param string $component_action Name of the associated action. 329 * @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 ) { 333 return BP_Notifications_Notification::delete( array( 334 'user_id' => $user_id, 335 'item_id' => $item_id, 336 'secondary_item_id' => $secondary_item_id, 337 'component_name' => $component_name, 338 'component_action' => $component_action, 339 'is_new' => $is_new 340 ) ); 341 } 342 343 /** 344 * Mark all notifications read/unread by type. 345 * 346 * Used when clearing out notifications for an entire component. 347 * 348 * @since BuddyPress (1.9.0) 349 * 350 * @param int $user_id ID of the user whose notifications are being deleted. 351 * @param int $is_new 0 for read, 1 for unread 352 * @param string $component_name Name of the associated component. 353 * @param string $component_action Optional. Name of the associated action. 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 ) { 358 return BP_Notifications_Notification::delete( array( 359 'item_id' => $item_id, 360 'secondary_item_id' => $secondary_item_id, 361 'component_name' => $component_name, 362 'component_action' => $component_action, 363 'is_new' => $is_new 364 ) ); 365 } 366 367 /** 368 * Mark all notifications read/unread from a user. 369 * 370 * Used when clearing out all notifications for a user, when deleted or spammed. 371 * 372 * @todo This function assumes that items with the user_id in the item_id slot 373 * are associated with that user. However, this will only be true with 374 * certain components (such as Friends). Use with caution! 375 * 376 * @since BuddyPress (1.9.0) 377 * 378 * @param int $user_id ID of the user whose associated items are beind deleted. 379 * @param int $is_new 0 for read, 1 for unread 380 * @param string $component_name Name of the associated component. 381 * @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 ) { 385 return BP_Notifications_Notification::delete( array( 386 'item_id' => $user_id, 387 'component_name' => $component_name, 388 'component_action' => $component_action, 389 'is_new' => $is_new 390 ) ); 391 } 392 393 /** Helpers *******************************************************************/ 394 289 395 /** 290 396 * Check if a user has access to a specific notification.
Note: See TracChangeset
for help on using the changeset viewer.