Do not show User Comment Of Other User in WordPress
A while ago I did a project with decentralized user in wordpress, it relates to such things as media, category, comment, post and page. It is awkward, sitting naturally thanks to some services should post up some reference to her children.
Default user in wordpress (author) see all posts, media, category … of users and the general information in wordpress. This article I show you how to not let the user see the other user’s comment, copy the following code and paste in your functions.php
add_filter('the_comments', 'wpse56652_filter_comments');
function wpse56652_filter_comments($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;
}
I explained briefly through the code above to proceed. function “wpse56652_filter_comments” function to filter out the user has the right to edit comments and is the author, because the author has the right see comemnt, then use a loop filter ea any comments under that user ID of the new show. The above code is not too hard to understand, right? You may not post, but look, you can understand.
The majority of his article written in the order because I was pretty busy, I just post a few short articles and content often single and less related to each other. This is mainly my experience when web code.
I think the problem you will face if you are going to follow the path coder. You try it, see?
If you copy my post, please remember to link the source to me.
This article is useful for you, press like on my help, encourage writing.