Notifications::new_answer( integer $post_id, object $_post )
Description #
Add notification for new answer.
Parameters #
- $post_idinteger (Required) Post ID.
- $_postobject (Required) Post object.
Source #
File: addons/notifications/notifications.php
public function new_answer( $post_id, $_post ) {
$_question = get_post( $_post->post_parent );
// Return if question is not available.
if ( ! $_question ) {
return;
}
// Insert the notification.
ap_insert_notification(
array(
'user_id' => $_question->post_author,
'actor' => $_post->post_author,
'parent' => $_post->post_parent,
'ref_id' => $_post->ID,
'ref_type' => 'answer',
'verb' => 'new_answer',
)
);
}
Expand full source code Collapse full source code View on GitHub: addons/notifications/notifications.php:277
Add your comment