Created
August 15, 2012 21:11
-
-
Save brentini/3363710 to your computer and use it in GitHub Desktop.
WordPress: show the comments to the authors own posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment