AnsPress_BP_Hooks::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/free/buddypress.php
public static 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, buddypress()->ap_notifier->id, 'new_answer_' . $post_id->post_parent ); } if ( $post_id->comment_count >= 1 ) { $comments = get_comments( [ 'post_id' => $post_id->ID ] ); foreach ( (array) $comments as $comment ) { bp_notifications_mark_notifications_by_item_id( $user_id, $comment->comment_ID, buddypress()->ap_notifier->id, 'new_comment_' . $post_id->ID ); } } }
Expand full source code Collapse full source code View on GitHub: addons/free/buddypress.php:523
Add your comment