Restricting users to seeing only comments on their posts in admin

Posted in: Newspaper
Post count: 81

Hi,

We would like to show authors only comments on posts they have authored instead of all the comments in the wp-admin area.
Please help!

Thanks.

  • This topic was modified 7 years by akshem.
Post count: 35449

Hi,

Unfortunately our theme don’t have such options, this come from the WordPress.
You can try the suggestion from here Display Comments in Admin to Authors Own Posts Only

Thank you for your understanding.

Post count: 81

Hi,

This code doesn’t work. Any other methods that can be tried?

Thanks.

Post count: 35449

Hi,

You can try the suggestion from this article:
How to Show Comments for Authors’ Own Posts Only in WordPress
Hope this will help you.

Thank you.

Post count: 81

I already tried this code but it gives an error.

Check this screenshot.

https://prnt.sc/ljftxn

Thanks.

Post count: 35449

Hi,

You get this error because you have an ‘,’ set in code and is not use ( is no need of it ).
https://www.screencast.com/t/NZT1pyvX6JcW

Thank you for your understanding.

Post count: 81

Now, an error on the next line.

Please check – http://prntscr.com/lk7z4q

Post count: 81

Please help!!

Post count: 35449

Hi,

First please make sure that you have set the role author not editor https://www.screencast.com/t/hlWIG9qpDDly

Paste this css in functions.php
https://www.screencast.com/t/Bt2I6tNA

function wps_get_comment_list_by_user($clauses) {
if (is_admin()) {
global $user_ID, $wpdb;
$clauses['join'] = ", ".$wpdb->base_prefix."posts";
$clauses['where'] .= " AND ".$wpdb->base_prefix."posts.post_author = ".$user_ID." AND ".$wpdb->base_prefix."comments.comment_post_ID = ".$wpdb->base_prefix."posts.ID";
};
return $clauses;
};
if(!current_user_can('edit_others_posts')) {
add_filter('comments_clauses', 'wps_get_comment_list_by_user');
}

https://www.screencast.com/t/ud9TTzDI
Results: https://www.screencast.com/t/bJ1lQyx1PG8D

Thanks.

Viewing 9 posts - 1 through 9 (of 9 total)
The forum ‘Newspaper’ is closed to new topics and replies.