Exemplo n.º 1
0
 /**
  * Add recipient-specific values for an email.
  *
  * @since 2.0.0
  *
  * @param WP_User $recipient
  * @return $this
  */
 protected function add_recipient(WP_User $recipient)
 {
     $unsubscribe_link = new Prompt_Unsubscribe_Link($recipient);
     $command = new Prompt_Comment_Command();
     $command->set_post_id($this->prompt_post->id());
     $command->set_user_id($recipient->ID);
     $command->set_parent_comment_id($this->comment->comment_ID);
     $values = array('id' => $recipient->ID, 'to_name' => $recipient->display_name, 'to_address' => $recipient->user_email, 'subject' => $this->subscriber_subject($recipient), 'unsubscribe_url' => $unsubscribe_link->url(), 'subscriber_comment_intro_html' => $this->subscriber_comment_intro_html($recipient), 'subscriber_comment_intro_text' => $this->subscriber_comment_intro_text($recipient), 'reply_to' => $this->trackable_address(Prompt_Command_Handling::get_command_metadata($command)));
     $values = array_merge($values, Prompt_Command_Handling::get_comment_reply_macros($this->previous_comments, $recipient->ID));
     return $this->add_individual_message_values($values);
 }
Exemplo n.º 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;
 }