2
By default Wordpress shows for all accounts all the comments the site has already received.
I wish that when I logged in as Autor
only showed comments made on posts from Autor
.
Behold:
The comments with green outline are those that were made in posts created by my account Autor
the rest are comments made in other posts Autores
.
What I wanted was to show only the comments made in my posts.
Does anyone know any PLUGIN do that?
I did a lot of research on the Internet and found nothing useful.
I found this Topical containing the following code:
# ------------------------------------------------------------
# Ensure that non-admins can see and manage only their own comments
# ------------------------------------------------------------
function myplugin_get_comment_list_by_user($clauses) {
if (is_admin()) {
global $user_ID, $wpdb;
$clauses['join'] = ", wp_posts";
$clauses['where'] .= " AND wp_posts.post_author = ".$user_ID." AND wp_comments.comment_post_ID = wp_posts.ID";
};
return $clauses;
};
// ensure that editors and admins can moderate everything
if(!current_user_can('edit_others_posts')) {
add_filter('comments_clauses', 'myplugin_get_comment_list_by_user');
}
Put in functions.php
but simply add all comments:
Doesn’t work.
It is not a mistake. The thing is that comments are appearing that
O Teste da Silva
made, even if he is not the author of the post. If you want to modify this, remove$comment->user_id != $user_ID &&
from within theif()
. . . . PS: Please delete comments that have nothing to do with the problem, leaving the answer cleaner for future readers ;)– brasofilo
A doubt: Since it is also the comments that the own
Autor
made in posts of other authors, could he also edit these comments? because as it is not possible.– Alexandre Lopes
This code has nothing to do with it. I’m not sure why...
– brasofilo
Look at this: http://prntscr.com/47a5f2 you’re 10! rsrs
– Alexandre Lopes
You’re not very good, you need to give Capability
edit_comment
at the role.– brasofilo