评论计数问题

时间:2017-07-08 05:53:33

标签: wordpress

enter image description here 全部(39)|待定(23)|批准(16)|垃圾邮件(0)|垃圾(1)

我希望用户只能看到他/她自己的评论并计算过滤器。

我怎样才能过滤数字?

我使用了以下代码

add_filter('the_comments', 'comment_filter');

function comment_filter($comments){
    global $pagenow;
    global $user_ID;
    get_currentuserinfo();
    if($pagenow == 'edit-comments.php' && current_user_can('author')){
        foreach($comments as $i => $comment){
            $the_post = get_post($comment->comment_post_ID);
            if($comment->user_id != $user_ID  && $the_post->post_author != $user_ID)
                unset($comments[$i]);
        }
    }
    return $comments;
}

0 个答案:

没有答案
相关问题