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.
To gain full access to WP-Members premium content, a current support subscription is required. You can purchase
an annual support subscription for as little as $59, which provides you with access to priority support, a
customer support forum, access to code snippets, and more.
Why wait? Choose your subscription option here.
[Why join?]