bp_activity_remove_screen_notifications_single_post()
Mark notifications as read when a user visits an single post.
Description
Source
File: bp-activity/bp-activity-notifications.php
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | function bp_activity_remove_screen_notifications_single_post() { $reply_id = filter_input( INPUT_GET, 'rid' , FILTER_VALIDATE_INT ); $comment_reply_id = filter_input( INPUT_GET, 'crid' , FILTER_VALIDATE_INT ); if ( ! is_single() || ( empty ( $reply_id ) && empty ( $comment_reply_id ) ) ) { return ; } $comment_id = 0; // For replies to a parent update. if ( ! empty ( $reply_id ) ) { $comment_id = $reply_id ; // For replies to an activity comment. } elseif ( ! empty ( $comment_reply_id ) ) { $comment_id = (int) $comment_reply_id ; } // Mark individual activity reply notification as read. if ( ! empty ( $comment_id ) ) { BP_Notifications_Notification::update( array ( 'is_new' => false, ), array ( 'user_id' => bp_loggedin_user_id(), 'id' => $comment_id , ) ); } } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.5.4 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.