0

i was trying to achieve this how can i restrict user to see his comments only along with admin replies and admin can see everyone comments?

Any suggestion with code would be helpful as i am new to wordpress.

2 Answers 2

2

Semi-Private Comments.just install this plugin.This plugin masks comments so that a user can only see comments written by himself or by an admin. Admins can see all comments.

2
  • is there any way without installing plugin...
    – Kiran
    Jul 1, 2011 at 12:02
  • @kiran you are asking too much ... There is no way a vanilla Wordpress install can do what you ask.
    – Lamnk
    Jul 2, 2011 at 2:27
-2

put this code in wp-admin/edit-comments.php

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');
}
1
  • 1
    Editing core admin files is bad practice and absolutely not recommended. Besides that, please add an explanation to your answer. Feb 12, 2014 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.