/** * * @since 2.0.0 * * @param object $data */ protected function record_successful_outbound_message_batch($data) { if (empty($data->id)) { Prompt_Logging::add_error(Prompt_Enum_Error_Codes::OUTBOUND, __('Got an unrecognized outbound message batch response.', 'Postmatic'), array('result' => $data, 'post_id' => $this->batch->get_context()->get_post()->id())); return; } $this->batch->get_context()->get_post()->add_outbound_message_batch_ids($data->id); }
/** * * @since 2.0.0 * */ protected function schedule_next_chunk() { $this->client->post_instant_callback(array('metadata' => array('prompt/post_mailing/send_notifications', array($this->batch->get_context()->get_post()->id())))); }
/** * Handle post editor preview email requests. */ public static function action_wp_ajax_prompt_post_delivery_preview() { $post_id = absint($_GET['post_id']); if (!$post_id) { wp_die(0); } $post = get_post($post_id); $context = new Prompt_Post_Rendering_Context($post); $context->setup(); $batch = new Prompt_Post_Email_Batch($context); $batch->add_recipient(new Prompt_User(wp_get_current_user())); $context->reset(); Prompt_Factory::make_post_adhoc_mailer($batch)->send(); wp_send_json(array('message' => __('Preview email sent.', 'Postmatic'))); }
/** * @since 2.0.0 */ protected function send_post() { $post = get_post($this->post_id); $context = new Prompt_Post_Rendering_Context($post); $context->setup(); $batch = new Prompt_Post_Email_Batch($context, array('excerpt_only' => false)); $batch->add_recipient(new Prompt_User($this->user_id)); $context->reset(); Prompt_Factory::make_post_adhoc_mailer($batch)->send(); }