/** * @since 1.0.0 * @return array */ public static function all_subscriber_ids() { // Currently just the default site subscribers $site = new Prompt_Site(); return $site->subscriber_ids(); }
/** * Get the IDs of users who should receive an email when this post is published. * * This includes both subscribers to the author and to the site. * * Post types not enabled in the options will have no recipients. * * @return array An array of user IDs. */ public function recipient_ids() { $post = $this->get_wp_post(); if (!in_array($post->post_type, Prompt_Core::$options->get('site_subscription_post_types'))) { return array(); } $recipient_ids = $this->cached_recipient_ids(); if (!$recipient_ids) { $prompt_site = new Prompt_Site(); $recipient_ids = $prompt_site->subscriber_ids(); $prompt_author = new Prompt_User($post->post_author); $recipient_ids = array_unique(array_merge($recipient_ids, $prompt_author->subscriber_ids())); /** * Filter the recipient ids of notifications for a post. * * @param array $recipient_ids * @param WP_Post $post */ $recipient_ids = apply_filters('prompt/recipient_ids/post', $recipient_ids, $post); if ('publish' == $post->post_status) { update_post_meta($post->ID, self::$recipient_ids_meta_key, $recipient_ids); } } return $recipient_ids; }