Ejemplo n.º 1
0
 public static function after_form()
 {
     if (!Prompt_Core::$options->get('enable_comment_delivery') or empty(self::$prompt_post)) {
         return;
     }
     $current_user = Prompt_User_Handling::current_user();
     if (!$current_user or !self::$prompt_post->is_subscribed($current_user->ID)) {
         return;
     }
     echo html('div class="prompt-unsubscribe"', html('div class=".loading-indicator" style="display: none;"', html('img', array('src' => path_join(Prompt_Core::$url_path, 'media/ajax-loader.gif')))), html('p', __('You are subscribed to new comments on this post.', 'Postmatic')), scbForms::input(array('type' => 'submit', 'name' => self::UNSUBSCRIBE_ACTION, 'value' => __('Unsubscribe', 'Postmatic'))));
 }
Ejemplo n.º 2
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();
 }