AnsPress_BP_Hooks::new_comment_notification( object $comment )
Description #
New comment notification.
Parameters #
- $commentobject (Required) Comment object.
Source #
File: addons/free/buddypress.php
public static function new_comment_notification( $comment ) {
if ( ! bp_is_active( 'notifications' ) ) {
return;
}
global $bp;
$comment = (object) $comment;
$post = get_post( $comment->comment_post_ID );
$subscribers = [ $post->post_author ];
$notification_args = array(
'item_id' => $comment->comment_ID,
'secondary_item_id' => $comment->user_id,
'component_name' => $bp->ap_notifier->id,
'component_action' => 'new_comment_' . $post->ID,
'date_notified' => bp_core_current_time(),
'is_new' => 1,
);
foreach ( (array) $subscribers as $s ) {
if ( $s != $comment->user_id ) {
$notification_args['user_id'] = $s;
bp_notifications_add_notification( $notification_args );
}
}
}
Expand full source code Collapse full source code View on GitHub: addons/free/buddypress.php:456
Add your comment