Getting parent category and filtering against a query
Hi, I’m integrating bbPress with s2member and need to restrict access to certain categories, forums and their topics.
For example, here’s a hierarchy:
Home > Forums > Category1 > Subcategory1 > Forum1 > Subforum1 > Topic1
If someone tries to look at Topic1 or any of its parents, I need to check to make sure they have access to Category1.
Access is managed by s2member.
For typical wordpress posts, I attach this filter, run a wp_query, then detach it:
attach_s2member_query_filters(); // only fetch content the user can access
If that query is not empty, then I let the user view the page they’re trying to look at. If it is empty, it means they don’t have access to any posts and so I redirect them.
But I don’t know how bbPress works well enough to figure it out.
It seems I need to
1. Find what the root category is
2. Check if the user can access the root category
3. If so, allow access to whatever they’re trying to see. If not, redirect or give an error message.
Any ideas on how I can do this?
- You must be logged in to reply to this topic.