function comments_perform_delete_comment

7.x comments.module comments_perform_delete_comment()
6.x comments.module comments_perform_delete_comment()
4.x comments.module comments_perform_delete_comment()
5.x comments.module comments_perform_delete_comment()

"delete" a comment (actually, all we do is flag it as deleted)

File

modules/comments/comments.module, line 106

Code

function comments_perform_delete_comment() {
  global $current_student_id, $user;

  $comment_id = $_REQUEST ["comment_id"];
  // Let's get some details about the comment to make sure this user can delete it.
  $comment = comments_get_comment($comment_id);

  if ($comment ["faculty_id"] == $user->cwid && user_has_permission("can_delete_own_comments_3_months")) {
    // TODO:  We should really ALSO check to make sure it's been less than 3 months.
    db_query("UPDATE advising_comments
               SET delete_flag = '1'
               WHERE `id` = '?' ", $comment_id);
    fp_add_message(t("Comment has been deleted successfully."));
  }


  if ($_GET ["destination"] != "") {
    fp_goto($_GET ["destination"]);
  }
  else {
    fp_goto("comments");
  }


}