Exemplo n.º 1
0
 protected function execute($args)
 {
     $link = new Prompt_Unsubscribe_Link($args);
     if (!$link->is_valid()) {
         return __('We tried to unsubscribe you, but there was some required information missing from this request.', 'Postmatic');
     }
     $this->subscriber = $link->user();
     $prompt_user = new Prompt_User($this->subscriber);
     $prompt_user->delete_all_subscriptions();
     return sprintf(__('Got it. %s has been unsubscribed from new posts as well as any conversations.', 'Postmatic'), $this->subscriber->user_email);
 }
Exemplo n.º 2
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.º 3
0
 /**
  * Add recipient-specific values to the batch.
  *
  * @since 2.0.0
  *
  * @param Prompt_User $recipient
  * @return $this
  */
 public function add_recipient(Prompt_User $recipient)
 {
     if (!$recipient->get_wp_user()) {
         trigger_error(__('Did not add an invalid post recipient', 'Postmatic'), E_USER_NOTICE);
         return $this;
     }
     $prompt_site = $this->context->get_site();
     $prompt_author = $this->context->get_author();
     $subscribed_object = $prompt_author->is_subscribed($recipient->id()) ? $prompt_author : $prompt_site;
     $unsubscribe_link = new Prompt_Unsubscribe_Link($recipient->get_wp_user());
     $values = array('id' => $recipient->id(), 'to_name' => $recipient->get_wp_user()->display_name, 'to_address' => $recipient->get_wp_user()->user_email, 'subscribed_object_label' => html_entity_decode($subscribed_object->subscription_object_label()), 'unsubscribe_url' => $unsubscribe_link->url());
     if (is_a($subscribed_object, 'Prompt_User') and $prompt_author->id()) {
         $values['from_name'] = get_option('blogname') . ' [' . $prompt_author->get_wp_user()->display_name . ']';
     }
     $values = array_merge($values, $this->mail_command_values($recipient->id(), $subscribed_object));
     return $this->add_individual_message_values($values);
 }