function ap_get_parti_emails($post_id) { $parti = ap_get_parti($post_id); if (!$parti) { return false; } $emails = array(); foreach ($parti as $p) { $email = get_the_author_meta('user_email', $p->apmeta_userid); if ($email) { $emails[$p->apmeta_userid] = get_the_author_meta('user_email', $p->apmeta_userid); } } return $emails; }
public function add_new_comment_notification($comment) { $comment = (object) $comment; if (bp_is_active('notifications')) { global $bp; $post = get_post($comment->comment_post_ID); if ($post->post_type == 'answer') { $participants = ap_get_parti(false, false, $comment->comment_post_ID); } if ($post->post_type == 'question') { $participants = ap_get_parti($comment->comment_post_ID); } $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); if (!empty($participants) && is_array($participants)) { foreach ($participants as $p) { if ($p->apmeta_userid != $comment->user_id) { $notification_args['user_id'] = $p->apmeta_userid; bp_notifications_add_notification($notification_args); } } } } }