You are here

function comment_edit in Drupal 6

Same name and namespace in other branches
  1. 4 modules/comment.module \comment_edit()
  2. 5 modules/comment/comment.module \comment_edit()

Form builder; generate a comment editing form.

Parameters

$cid: ID of the comment to be edited.

Related topics

1 string reference to 'comment_edit'
comment_menu in modules/comment/comment.module
Implementation of hook_menu().

File

modules/comment/comment.pages.inc, line 15
User page callbacks for the comment module.

Code

function comment_edit($cid) {
  global $user;
  $comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d', $cid));
  $comment = drupal_unpack($comment);
  $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
  if (comment_access('edit', $comment)) {
    return comment_form_box((array) $comment);
  }
  else {
    drupal_access_denied();
  }
}