remove() public method

public remove ( $id )
Ejemplo n.º 1
0
 function check_delete_comments()
 {
     global $rtmedia_query;
     if ($rtmedia_query->action_query->action != 'delete-comment') {
         return;
     }
     if (count($_POST)) {
         /**
          * /media/id/delete-comment [POST]
          * Delete Comment by Comment ID
          */
         if (empty($_POST['comment_id'])) {
             return false;
         }
         $comment = new RTMediaComment();
         $id = $_POST['comment_id'];
         $activity_id = get_comment_meta($id, 'activity_id', true);
         if (!empty($activity_id)) {
             if (function_exists('bp_activity_delete_comment')) {
                 //if buddypress is active
                 $activity_deleted = bp_activity_delete_comment($activity_id, $id);
                 $delete = bp_activity_delete(array('id' => $activity_id, 'type' => 'activity_comment'));
             }
         }
         $comment_deleted = $comment->remove($id);
         echo $comment_deleted;
         exit;
     }
 }
Ejemplo n.º 2
0
 function check_delete_comments()
 {
     global $rtmedia_query;
     if ('delete-comment' !== $rtmedia_query->action_query->action) {
         return;
     }
     if (count($_POST)) {
         // @codingStandardsIgnoreLine
         /**
          * /media/id/delete-comment [POST]
          * Delete Comment by Comment ID
          */
         $_comment_id = filter_input(INPUT_POST, 'comment_id', FILTER_SANITIZE_NUMBER_INT);
         if (empty($_comment_id)) {
             return false;
         }
         $comment = new RTMediaComment();
         $id = $_comment_id;
         $activity_id = get_comment_meta($id, 'activity_id', true);
         if (!empty($activity_id)) {
             if (function_exists('bp_activity_delete_comment')) {
                 //if buddypress is active
                 $activity_deleted = bp_activity_delete_comment($activity_id, $id);
                 $delete = bp_activity_delete(array('id' => $activity_id, 'type' => 'activity_comment'));
             }
         }
         $comment_deleted = $comment->remove($id);
         echo $comment_deleted;
         // @codingStandardsIgnoreLine
         exit;
     }
 }