| Versionen | |
|---|---|
| drupal6 – drupal7 | comment_edit($cid) |
Form builder; generate a comment editing form.
$cid ID of the comment to be edited.
modules/
<?php
function comment_edit($cid) {
global $user;
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid' => $cid))->fetchObject();
$comment = drupal_unpack($comment);
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
if (comment_access('edit', $comment)) {
return theme('comment_form_box', (array) $comment);
}
else {
drupal_access_denied();
}
}
?>
Kommentare
Kommentar hinzufügen