| Versions | |
|---|---|
| 4.7 – 6 | comment_links($comment, |
| 7 | comment_links($comment, $node) |
modules/
<?php
function comment_links($comment, $return = 1) {
global $user;
$links = array();
// If we are viewing just this comment, we link back to the node.
if ($return) {
$links[] = l(t('parent'), comment_node_url(), NULL, NULL, "comment-$comment->cid");
}
if (node_comment_mode($comment->nid) == COMMENT_NODE_READ_WRITE) {
if (user_access('administer comments') && user_access('post comments')) {
$links[] = l(t('delete'), "comment/delete/$comment->cid");
$links[] = l(t('edit'), "comment/edit/$comment->cid");
$links[] = l(t('reply'), "comment/reply/$comment->nid/$comment->cid");
}
else if (user_access('post comments')) {
if (comment_access('edit', $comment)) {
$links[] = l(t('edit'), "comment/edit/$comment->cid");
}
$links[] = l(t('reply'), "comment/reply/$comment->nid/$comment->cid");
}
else {
$links[] = theme('comment_post_forbidden', $comment->nid);
}
}
return $links;
}
?>