I have given my site’s subscriber role the following permissions (unserialized DB-query):
[subscriber] => Array
(
[name] => Reader
[capabilities] => Array
(
[delete_comment] => 1
[edit_comment] => 1
[level_0] => 1
[quick_edit_comment] => 1
[read] => 1
[reply_comment] => 1
[unfiltered_html] => 1
)
)
I want to make the subscriber be able to edit their comments, but I always get an error “Your are not allowed to edit this comment.” I tried the following in debugging (in my comments.php template file):
$link = get_edit_comment_link($GLOBALS['comment']->comment_ID);
$perm1 = current_user_can('edit_comment', $GLOBALS['comment']->comment_ID);
$perm2 = current_user_can('edit_comment');
var_dump($link);
var_dump($perm1);
var_dump($perm2);
global $current_user;
var_dump($current_user->allcaps);
giving the following output (explanation added beside):
(get_edit_comment_link): NULL
(cur_user w/ post-id): bool(false)
(cur_user w/o post-id): bool(false)
(allcaps):
array(9) { ["delete_comment"]=> bool(true) ["edit_comment"]=> bool(true)
["edit_posts"]=> bool(true) ["level_0"]=> bool(true) ["quick_edit_comment"]=> bool(true)
["read"]=> bool(true) ["reply_comment"]=> bool(true) ["unfiltered_html"]=> bool(true)
["subscriber"]=> bool(true) }
As you can see, the allcaps shows that the user is allowed to edit_comments. But get_edit_comment_link stays empty, although the role has the capability AND the current_user is the author of the comment.