function comment_links in Drupal 5
Same name and namespace in other branches
- 4 modules/comment.module \comment_links()
- 6 modules/comment/comment.module \comment_links()
- 7 modules/comment/comment.module \comment_links()
1 call to comment_links()
- comment_link in modules/
comment/ comment.module - Implementation of hook_link().
File
- modules/
comment/ comment.module, line 819 - Enables users to comment on published content.
Code
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['comment_parent'] = array(
'title' => t('parent'),
'href' => comment_node_url(),
'fragment' => "comment-{$comment->cid}",
);
}
if (node_comment_mode($comment->nid) == COMMENT_NODE_READ_WRITE) {
if (user_access('administer comments') && user_access('post comments')) {
$links['comment_delete'] = array(
'title' => t('delete'),
'href' => "comment/delete/{$comment->cid}",
);
$links['comment_edit'] = array(
'title' => t('edit'),
'href' => "comment/edit/{$comment->cid}",
);
$links['comment_reply'] = array(
'title' => t('reply'),
'href' => "comment/reply/{$comment->nid}/{$comment->cid}",
);
}
else {
if (user_access('post comments')) {
if (comment_access('edit', $comment)) {
$links['comment_edit'] = array(
'title' => t('edit'),
'href' => "comment/edit/{$comment->cid}",
);
}
$links['comment_reply'] = array(
'title' => t('reply'),
'href' => "comment/reply/{$comment->nid}/{$comment->cid}",
);
}
else {
$links['comment_forbidden']['title'] = theme('comment_post_forbidden', $comment->nid);
}
}
}
return $links;
}