BuddyPress::mark_bp_notify_as_read( mixed $post_id )
Description #
Mark notification as read when corresponding question is loaded
Parameters #
- $post_idmixed (Required) Post ID or Object.
Source #
File: addons/buddypress/buddypress.php
public function mark_bp_notify_as_read( $post_id ) {
if ( ! bp_is_active( 'notifications' ) || ! is_question() ) {
return;
}
$user_id = get_current_user_id();
if ( 'answer' === $post_id->post_type ) {
bp_notifications_mark_notifications_by_item_id( $user_id, $post_id->ID, 'anspress', 'new_answer' );
}
if ( $post_id->comment_count >= 1 ) {
$comments = get_comments( array( 'post_id' => $post_id->ID ) );
foreach ( (array) $comments as $comment ) {
bp_notifications_mark_notifications_by_item_id( $user_id, $comment->comment_ID, 'anspress', 'new_comment' );
}
}
}
Expand full source code Collapse full source code View on GitHub: addons/buddypress/buddypress.php:623
Add your comment