cliffordp
8/13/2013 - 5:39 PM

From http://www.wphub.com/tutorials/code-snippets-wordpress/ #2 Display comments in admin to authors own posts only

From http://www.wphub.com/tutorials/code-snippets-wordpress/ #2 Display comments in admin to authors own posts only

function wps_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;
};
if(!current_user_can('edit_others_posts')) {
add_filter('comments_clauses', 'wps_get_comment_list_by_user');
}