WordPress Plugin Modification Logic

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 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.

Read More

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;
}

Related posts

Leave a Reply

1 comment

  1. 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;
    }