Page Restriction and Redirect for Particular Levels or user

I am planning to have a page restriction and redirect for the particular level of users, but I dont have any idea how to implement that. Here’s an example of what I want to achieve

I have a page lets say for example “News” page, and I want it to be accessible for all Gold Members. If Silver users tried to access it. they should be redirected to any page where I wanted them to be redirected. Is this possible. I almost forgot to mention, I am using WishlistMembership Plugin.. I already asked some support from Wishlist but no reply so far.

Related posts

Leave a Reply

4 comments

  1. I searched the documentation for WishListMember and they offer no hooks to do what you are suggesting. Have you tried a different membership system? I would suggest one of these 2 depending on your needs. Specifically, I know I have seen “redirection” in MagicMember but I believe the redirection is for where members land after login. MagicMember has great support though, you can just ask them what the hook is for “non-member access redirection.

    http://www.magicmembers.com/

    http://www.s2member.com/

    Alternatively, depending on your plugin, you could extend the plugin from your themes functions.php file. The plugin loads first though, so its still really dependent on how the plugin redirects people away from protect pages. Unfortunately not all these plugins are not open source and available for code browsing so its not possible for us to give you any code insight with no access to the plugin code.

  2. I’d suggest:

    1. Setting a Custom Field within a Custom Meta Box where you can mark the pages ‘Gold’, ‘Silver’, etc.

    2. In the page template, check for the user capability and the page “permissions”.

    3. If they don’t match, redirect or display “Forbidden content”.

    Probably point 2 can be done with an action hook, but am not sure which one would be the earliest where you can check for the page values and the user info.