Example #1
0
 /**
  * @since 2.0.0
  */
 protected function forward()
 {
     $text = $this->get_message_text();
     $from_user = get_user_by('id', $this->from_user_id);
     $to_user = get_user_by('id', $this->to_user_id);
     $command = new Prompt_Forward_Command();
     $command->set_keys(array('', '', $this->to_user_id, $this->from_user_id));
     $template_data = array('sender' => $from_user, 'message' => $text);
     $html_template = new Prompt_Template('forward-email.php');
     $batch = Prompt_Email_Batch::make_for_single_recipient(array('to_address' => $to_user->user_email, 'from_name' => $from_user->display_name, 'subject' => $this->message->subject, 'html_content' => $html_template->render($template_data), 'message_type' => Prompt_Enum_Message_Types::ADMIN, 'reply_to' => array('trackable-address' => Prompt_Command_Handling::get_command_metadata($command))));
     Prompt_Factory::make_mailer($batch)->send();
 }
Example #2
0
 /**
  * If replyable returns all comment reply command macros, otherwise a command macro to forward replies to
  * the post author.
  *
  * @since 2.0.0
  *
  * @param int                           $recipient_id
  * @param Prompt_Interface_Subscribable $subscribed_list
  * @return array
  */
 protected function mail_command_values($recipient_id, Prompt_Interface_Subscribable $subscribed_list)
 {
     $values = array();
     if ($this->replyable) {
         $command = new Prompt_New_Post_Comment_Command();
         $command->set_post_id($this->context->get_post()->id());
         $command->set_user_id($recipient_id);
         $values = Prompt_Command_Handling::get_comment_reply_macros($this->comments, $recipient_id);
     } else {
         $command = new Prompt_Forward_Command();
         $command->set_from_user_id($recipient_id);
         $command->set_to_user_id($this->context->get_post()->get_wp_post()->post_author);
         $command->set_subscription_object($subscribed_list);
     }
     $values['reply_to'] = $this->trackable_address(Prompt_Command_Handling::get_command_metadata($command));
     return $values;
 }