Exemple #1
0
 public function delete_activity()
 {
     if (!ap_verify_nonce('ap_delete_activity') || !is_super_admin() || !isset($_POST['args'][0])) {
         $this->something_wrong();
     }
     $activity_id = (int) $_POST['args'][0];
     $row = ap_delete_activity($activity_id);
     if (false !== $row) {
         $this->send(array('message' => 'delete_activity', 'action' => 'delete_activity', 'do' => array('remove_if_exists' => '#activity-' . $activity_id)));
     }
     $this->something_wrong();
 }
 /**
  * Unpublish comment
  * @param integer $comment_id Comment object.
  */
 public function delete_comment($comment_id)
 {
     $comment = get_comment($comment_id);
     $post = get_post($comment->comment_post_ID);
     if (!('question' == $post->post_type || 'answer' == $post->post_type)) {
         return;
     }
     $activity_ids = ap_activity_ids_by_item_id($comment->comment_ID, 'comment');
     if ($activity_ids) {
         foreach ($activity_ids as $ids) {
             ap_delete_activity($ids);
         }
     }
 }