summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module26
1 files changed, 4 insertions, 22 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index dd621e25e..afcd985d8 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -292,6 +292,9 @@ function comment_permission() {
'post comments without approval' => array(
'title' => t('Post comments without approval'),
),
+ 'edit own comments' => array(
+ 'title' => t('Edit own comments'),
+ ),
);
}
@@ -1256,7 +1259,7 @@ function comment_access($op, $comment) {
global $user;
if ($op == 'edit') {
- return ($user->uid && $user->uid == $comment->uid && comment_num_replies($comment->cid) == 0) || user_access('administer comments');
+ return ($user->uid && $user->uid == $comment->uid && user_access('edit own comments')) || user_access('administer comments');
}
}
@@ -1544,27 +1547,6 @@ class CommentController extends DrupalDefaultEntityController {
}
/**
- * Get replies count for a comment.
- *
- * @param $pid
- * The comment id.
- * @return
- * The replies count.
- */
-function comment_num_replies($pid) {
- $cache = &drupal_static(__FUNCTION__, array());
-
- if (!isset($cache[$pid])) {
- $cache[$pid] = db_query('SELECT COUNT(cid) FROM {comment} WHERE pid = :pid AND status = :status', array(
- ':pid' => $pid,
- ':status' => COMMENT_PUBLISHED,
- ))->fetchField();
- }
-
- return $cache[$pid];
-}
-
-/**
* Get number of new comments for current user and specified node.
*
* @param $nid