I'm using a very simple plugin called Semi Private Comments which does almost everything I need, it hides comments from other users and allows only the author of the comment and the admin to view the comment. My problem is the plugin allows any admin comment to be viewed by anyone. I would like it to keep开发者_C百科 the comment between the admin and any user a one on one conversation.
I really don't know PHP well enough to modify the plugins logic and was hopping for some help.
Here's the code.
if (current_user_can('edit_users') || // user is admin, or
$user_matched==1 || // user is original author, or
$comment->user_id == 1) // comment author is admin
{
return $content;
}
else
{
$hidden_comment_text = get_option('spc_hidden_comment_text');
return $hidden_comment_text;
}
}
else
{
return $content;
}
I think just removing the $comment->user_id == 1
should do the trick
if (current_user_can('edit_users') || // user is admin, or
$user_matched==1) // user is original author
{
return $content; // Only admins and authors of the comment can read
}
else
{
$hidden_comment_text = get_option('spc_hidden_comment_text');
return $hidden_comment_text;
}
Btw, the code snipped you posted is incomplete the if statement of the following part is missing
}
else
{
return $content;
}
精彩评论