Every once in awhile, I get a question about restricting content (either page or post) to a specific user. There is a limited way to do that with the wpmem_securify filter, similar to the method for blocking content by category and user level.
This process is actually easier than blocking by levels or categories because you only need to determine three things:
- Is the user logged in? If not, then it is blocked regardless.
- If the user is logged in, but not the specified user, it is blocked and an error message is given.
- If the user is logged in and is the specified user, then the content is delivered.
This example will make use of a couple of new action hooks that will allow us to add a dropdown selector of users to the WP-Members post meta box.
This article is only available to WP-Members Support Subscribers. If you have an existing subscription, please login below. If you do not have a current support subscription, you can purchase a support subscription here.