Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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.

share|improve this answer

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.

share|improve this answer
    
thanks I'll try this one.. –  markyeoj Dec 10 '12 at 13:48
    
Thanks, I tried this code <?php if (is_user_logged_in()) { wp_redirect( 'http://www.example.com'); exit; } else { //do-nothing} ?> sir, i tried this one as practice but not working. Did I missed something?? –  markyeoj Dec 10 '12 at 14:03
    
Without seeing the context, it's hard to tell. At first, seems legit. –  brasofilo Dec 10 '12 at 14:32
    
its not redirecting me to other page. instead, the area where I put the code ends with a white blank area at the front end. –  markyeoj Dec 10 '12 at 17:07
    
Please, add more details to the Question itself. –  brasofilo Dec 10 '12 at 17:11

This is now built into WishList Member. You can specify "error" pages for individual posts/pages. Here's a screenshot:

http://screencast.com/t/eCnVTq9M

You'd want to set your Non-Member and Wrong Member error pages accordingly.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.