We’ve never seen this happen and we’ve been running PMPro for 3+ years. Are you sure that the post doesn’t belong to a category that’s part of the Level 1/Level 2 rights? Also, the post should show up on the site it should just be restricted with the default message. Or, could be something funky with your theme – did you try it with a default WP theme?
Thread Starter
joefez
(@joefez)
@essaysnark – Thank you for your input. I can see now that it was because the post belonged to a category for which that particular user level had access to, despite the individual post being marked as for a particular user level only.
This however raises a corollary issue. Let’s say the categories should be agnostic. Every level of user could access them. But every now and then you wanted to post in that category and have only level ‘x’ members to see it.
Approaching this logically, the per-post access controls that pmpro implements at the post creation level, seem to suggest this is possible, yet you are saying that ‘category access’ at the User Level overrides any per post restrictions, making those per-post controls essentially useless?
So for instance if you wanted to use pmpro for something like a support site, you couldn’t then make posts in product categories that only admins or staff could see, but not users?
Sorry to draw this out but it seems like a fundamental issue with the way the security seems to be applied. I appreciate that it could all boil down to implementation and it might simply be a case that trying to use categories and user levels in this way is impossible?
I think you can do everything you’re describing with filters.
Here’s one that seems like it should work for what you described:
my_pmpro_has_membership_access_filter
https://gist.github.com/strangerstudios
You can also use the [membership] shortcode on a by-post basis to restrict content for certain levels (e.g., to the support people, when regular users shouldn’t see it).
Thread Starter
joefez
(@joefez)
Thank you for your help.
I have tried the shortcodes and they certainly work as you suggest. I guess I was a little bit tweaked that the per-post tick boxes don’t work as I imagined they would, though that is nobodies fault but my own!
Thanks for pointing me to the gist. I’ll have a play around with it, and if I get stuck I’ll grab a pro membership and take it further with the forum there. As long as I know it’s possible.
As it stands, the plugin works very well – I guess I was just surprised that things weren’t locked down in the manner that I expected them to be. Still I can appreciate that the software is provided as is, and that buying support is the business model, which is a very fair approach.
Thanks for taking time to help – I hope StrangerStudios are looking after you! 🙂
Thread Starter
joefez
(@joefez)
I had marked this thread closed, but the more I think about it, the more I think there is still a bug with the way this is handled.
For example, Category ‘A’ has access by user levels ‘1’ & ‘2’ (not tiered). A new post is created in Category ‘A’, but is restricted to just user level ‘2’.
In this scenario, the per post controls work exactly as expected. If a level ‘1’ user browses Category ‘A’ they cannot see the post; if they do a search it is also not visible at all – so far, so excellent.
Except – if they happen to get the direct URL somehow, the post/page loads straight up with no content blocked.
Surely this isnt right? Again, it could just be an implementation issue.
> Except – if they happen to get the direct URL somehow, the post/page loads straight up with no content blocked.
Which theme are you using? PMPro filters the_content and the_excerpt, checking for membership access. If your theme shows content outside of that it won’t be restricted. Sometimes running the_content filters a bit later helps (for page builder type themes):
https://gist.github.com/strangerstudios/a9ed75ba4cbbf545644f
Sometimes you need to update the theme to work with PMPro. We can help you with that on our member forums: http://www.paidmembershipspro.com/forums/
Thread Starter
joefez
(@joefez)
Hi Jason,
We’re using a theme we’ve built ourselves specifically for the job. It’s not hugely complex, but I suspect we’re doing things slightly differently to what the plugin is expecting. Which is fair enough, as it would be impossible to cater for every scenario.
We decided to take out a year’s support to get this issue resolved as, to be fair, we’ve been using the plugin for a while now and it seemed to be 99% perfect for us, apart from this one issue.
Jessica knocked out a bit of code using the my_pmpro_has_membership_access_filter which provided an nice work around to the problem.
Like you say, I think the_content was being called before membership access was established.
Either way, thanks for your help. We’ve certainly had our moneys worth already. Great investment and great plugin!
Joetez wondering how I could use the filters I use the cmdownload manager and need to restrict access to a url it creates.