Falcon_Connector_WordPress::get_comment_subscribers PHP Метод

get_comment_subscribers() публичный Метод

Get all subscribers for comment notifications
public get_comment_subscribers ( stdClass $comment ) : WP_User[]
$comment stdClass Comment being checked
Результат WP_User[]
    public function get_comment_subscribers($comment)
    {
        $recipients = array();
        // Find everyone who has a matching preference, or who is using the
        // default (if it's on)
        $query = array('meta_query' => array('relation' => 'OR', array('key' => $this->key_for_setting('notifications.comment'), 'value' => 'all')));
        $default = $this->get_default_settings();
        if ($default['post'] === 'all') {
            $query['meta_query'][] = array('key' => $this->key_for_setting('notifications.comment'), 'compare' => 'NOT EXISTS');
        }
        $users = get_users($query);
        if (empty($users)) {
            return array();
        }
        // Also grab everyone if they're in the thread and subscribed to
        // same-thread comments
        $sibling_authors = $this->get_thread_subscribers($comment);
        $users = array_merge($users, $sibling_authors);
        // Trim to unique authors using IDs as key
        $subscribers = array();
        foreach ($users as $user) {
            if (isset($subscribers[$user->ID])) {
                // Already handled
                continue;
            }
            if (!user_can($user, 'read_post', $comment->comment_post_ID)) {
                // No access, skip
                continue;
            }
            $subscribers[$user->ID] = $user;
        }
        return $subscribers;
    }