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.

My WP site has a members area which they pay to get access to. I want that area to be a subfolder, so something like site.com/premium/nameofpage.

I am aware of url rewriting, htaccess etc. Is that the only way to get this working? Or is there a WP way to create a folder structure in the url?

share|improve this question
add comment

1 Answer

I don't think what you want is URL rewriting. If I understand correctly, what you want is to restrict access to certain pages, posts, categories, etc., based on the current user's role or capabilities:

"If logged in, do something. If not, do something else (like prompt to login or register)."

Modifying the output/behavior of a single page is not all that difficult. Just use the is_user_logged_in() function to check the current user's status.

<?php 
    if ( is_user_logged_in() ) { 
        // Show your "logged in" user content here.
    } else{
        // Show your register/log in form here.
    }
?>

However, if what you want is TRULY a Member area, with multiple pages and sub-pages, I would consider using a plugin to accomplish this. In addition to the plugins offered in this solution, you might also want to check out Role Scoper. Wordpress lists a few of these options as Resources on their Roles and Capabilities page.

Simply create a page called "Premium" (for your specific case) and use one of these plugins (or something similar) to set restrictions for that page and every page beneath it. You could use a custom template for that page to determine what functionality it includes.

share|improve this answer
    
The member management, controlling content etc is covered by this plugin (premium.wpmudev.org/project/membership) . I just want the user to feel like they are in an area of the site just for them hence wanting to create a bunch of pages all carrying out specific functionality under a folder called "premium". –  BillyKhan Feb 13 '13 at 20:41
    
I've not used the plugin before, but it looks like you could just create a page called "Premium" and use the Membership plugin to set restrictions for that page and every page beneath, it according to your needs. You could use a custom template for that page to determine what functionality it includes. –  Matt Feb 20 '13 at 16:19
add comment

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.