Example #1
0
 /**
  * Unsubscribe the user from new post comments.
  * @since 1.0.0
  */
 protected function unsubscribe()
 {
     $prompt_post = new Prompt_Post($this->post_id);
     if (!$prompt_post->is_subscribed($this->user_id)) {
         return;
     }
     $prompt_post->unsubscribe($this->user_id);
     Prompt_Subscription_Mailing::send_unsubscription_notification($this->user_id, $prompt_post);
     return;
 }
 /**
  * Unsubscribe an array of user IDs from the post.
  * @param $ids
  */
 protected function unsubscribe($ids)
 {
     foreach ($ids as $id) {
         $this->prompt_post->unsubscribe($id);
     }
 }
Example #3
0
 /**
  * Handle unsubscribe requests from the comment form.
  */
 public static function action_wp_ajax_prompt_comment_unsubscribe()
 {
     if (!wp_verify_nonce($_POST['nonce'], self::AJAX_NONCE)) {
         wp_die(-1);
     }
     $post_id = absint($_POST['post_id']);
     if (!$post_id) {
         wp_die(0);
     }
     $current_user = Prompt_User_Handling::current_user();
     $prompt_post = new Prompt_Post($post_id);
     if (!$current_user or !$prompt_post->is_subscribed($current_user->ID)) {
         wp_die(0);
     }
     $prompt_post->unsubscribe($current_user->ID);
     _e('You have unsubscribed.', 'Postmatic');
     wp_die();
 }