Open andrewlimaza opened 5 years ago
Just took another look into this... the problematic line is $query->set( 'category__not_in', $hidden_cat_ids );
in paid-memberships-pro/includes/content.php
: https://github.com/strangerstudios/paid-memberships-pro/blob/fb736a936914b1baf1f267fe553f57636b8b1eae/includes/content.php#L251
Right now, what we're saying is "Don't get posts who have categories that are restricted by a different membership level", whereas what we need to say is "Don't get posts who have categories that are restricted by a different membership level UNLESS they are also restricted by a membership level that the user has", which isn't currently possible with our current approach for restricting by category.
To resolve this, we'd likely need to do manual queries to get a list of posts to add to the 'post__not_in'
WP_Query argument similar to what we are doing with posts restricted directly by membership level. This would require rewriting that whole section of code that deals with restricting by category.
FYI Updated this code here to preserve existing settings when filtering, but the main issue here still stands.
Describe the bug If you are showing search/archive content to members only it is hidden to members if the content belongs to more than one category.
To Reproduce
Please enable filter archives and search to "YES" under the Advanced Settings options in PMPro.
Expected behavior Posts should show for users if they have access.
Isolating the problem (mark completed items with an [x]):