I'm searching for an action hook which I can use to control access to certain parts of my Wordpress site. I want to write some custom PHP which will check certain user attributes and decide if they can view a particular part of the site (ie only users with certain attributes can view pages which fall under particular url hierarchies).
- My user profile has two extra flags: i) member of community 1 and ii) i) member of community 2.
- Community one consists of a load of content which falls under a page with slug "community1"
- Every time a use tries to access the page with slug community1 or any of it's sub-pages (eg community1/about), I want to check that they are a. logged in and b. have the community1 flag set in their profile. If they do then I allow the access, if not I redirect to page explaining that they need to sign up for access.
- The same for community2.