/** * 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); }
/** * Shorthand method to get metadata for a comment command. * * @since 2.0.0 * * @param int $user_id * @param int $post_id * @param int $parent_comment_id * @return stdClass */ public static function get_comment_command_metadata($user_id, $post_id, $parent_comment_id = null) { $command = new Prompt_Comment_Command(); $command->set_user_id($user_id); $command->set_post_id($post_id); if ($parent_comment_id) { $command->set_parent_comment_id($parent_comment_id); } return self::get_command_metadata($command); }