WSUWP Content Visibility
WSUWP Content Visibility is a WordPress plugin used to control the visibility of content for groups of authenticated visitors. The interface for managing the visibility of content is built into the Publish area of a page or post.
The default plugin provides the Members of this site group by default. At WSU, we also add several groups associated with active directory by using the provided filters. When published with Manage authorized viewers option selected, the post or page will be set as private and visibility will be controlled by the plugin.
If a non-authenticated user arrives on a page restricted by WSUWP Content Visibility, the user will be redirected to a login screen. If an authenticated user arrives on a page and is not a member of an assigned group, that user will be redirected to the home page.
Existing capabilities in WordPress
The following conditions are true by default in WordPress and are not changed by WSUWP Content Visibility:
- All users can view their own private posts.
- Subscribers, Contributors, and Authors can not view private posts owned by others.
- Editors, Administrators, and Super Admins can view all private posts.
If WSUWP Content Visibility is used to assign a group of viewers to a private post that includes existing site Subscribers, Contributors, or Authors, those users will be able to view that private post. Likewise, if used to assign a group that excludes existing Editors, Administrators, and Super Admins, those users will still be able to view that private post.
Extending Content Visibility
Adding and removing post type support
By default, WSUWP Content Visibility supports posts and pages. Use add_post_type_support( 'post-type-slug', 'wsuwp-content-visibility' );
to add support to other custom post types.
Similarly, remove_post_type_support()
can be used to remove existing support for a feature on a post type. Current support is applied on init
with a priority of 11.
At WSU, we’ve added support for content visibility to WP Document Revisions.
Filtering available groups and membership
Two filters are available in the plugin to extend the default groups and behavior.
content_visibility_default_groups
is used to modify the list of groups.user_in_content_visibility_groups
is used to verify a user’s membership of the groups assigned to a post.