Role-Based Permissions
Role-Based Permissions
The Private Comments plugin strictly regulates comment visibility based on a user's relationship to the post or the comment itself. Once activated, the plugin filters the comment stream to ensure that sensitive discussions remain private between relevant parties.
Access levels are categorized into the following four tiers:
1. Administrators
Users with the administrator role have unrestricted access. They can view, moderate, and reply to all comments across the entire website, regardless of who authored the post or the comment.
2. Post Authors
Users who authored the specific post or page can view all comments left on that content. This allows authors to engage with their audience and manage discussions on their own articles without exposing those conversations to the general public.
3. Comment Authors
Individual users can always see the comments they have personally submitted. Even if they are not the post author or an administrator, their own contributions remain visible to them for tracking and follow-up purposes.
4. General Public and Other Registered Users
Any user who does not fall into the above categories—including logged-out guests and registered users who are neither the post author nor the specific comment author—will be unable to see the comments. To these users, the comment section will appear empty or restricted.
Permissions Matrix
The following table illustrates the visibility logic applied to every comment:
| User Role / Relationship | Can View Own Comments | Can View Others' Comments | | :--- | :---: | :---: | | Administrator | Yes | Yes | | Post Author | Yes | Yes (on their posts only) | | Comment Author | Yes | No | | Other Logged-in User | No | No | | Guest / Logged-out | No* | No |
*Note: Guests can only view their own comments if the browser session maintains the unapproved comment cookie, as per standard WordPress behavior, but they remain restricted from viewing the broader discussion.
Usage Example
No manual configuration is required to enforce these permissions. The plugin automatically hooks into the WordPress comment query.
// Example: Logic applied during the comment loop
// If User == Post_Author OR User == Comment_Author OR User == Administrator:
// DISPLAY COMMENT
// Else:
// HIDE COMMENT