我正试图让事情像这样运作,在那里,作者只能看到他们在管理评论部分发表评论,他们也可以缓和。而管理员应该拥有所有权限。
我有一个代码,在所有方面都很好,比如只显示作者的帖子评论,但它不允许缓和。有谁能帮我找到一个解决方案,让作者可以调整自己的帖子评论。
我拥有的代码:
function my_plugin_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 all comments
if(!current_user_can(\'edit_others_posts\')) {
add_filter(\'comments_clauses\', \'my_plugin_get_comment_list_by_user\');
}