AnsPress_BP_Hooks::new_answer_notification( integer $post_id )
Description #
New answer notifications.
Parameters #
- $post_idinteger (Required) Post ID.
Source #
File: addons/free/buddypress.php
public static function new_answer_notification( $post_id ) {
if ( ! bp_is_active( 'notifications' ) ) {
return;
}
global $bp;
$answer = get_post( $post_id );
$answer = get_post( $answer->post_parent );
$subscribers = [ $answer->post_author ];
$notification_args = array(
'item_id' => $answer->ID,
'secondary_item_id' => $answer->post_author,
'component_name' => $bp->ap_notifier->id,
'component_action' => 'new_answer_'.$answer->post_parent,
'date_notified' => bp_core_current_time(),
'is_new' => 1,
);
foreach ( (array) $subscribers as $s ) {
if ( $s != $answer->post_author ) {
$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:423
Add your comment