itthinx / groups

Groups provides group-based user membership management, group-based capabilities and content access control. It integrates standard WordPress capabilities and application-specific capabilities along with an extensive API.
GNU General Public License v3.0
49 stars 35 forks source link

Groups_Post_Access: filtering not applied on WooCommerce archive pages #82

Closed billerr closed 6 years ago

billerr commented 7 years ago

Hi!

I discovered recently on a website that I maintain that the Groups_Post_Access::posts_where method doesn't apply the proper filtering in product archive pages. The reason was that all tests for the $filter boolean currently only check the 'post_type' query var. However, it seems that WooCommerce never sets 'post_type' => 'product' for the archive page wp_query, but instead sets 'wc_query' => 'product_query' (I don't know if this is a recent change in WC or if it's particular to our website environment)

In any case, I added this specific check in the Groups_Post_Access class in pull request #81

proaktion commented 6 years ago

Thanks for the proposed changes, I've adapted this and added a filter to make it a bit more flexible and moved the check for the wc_query part into the Groups_Extra class. This will be published shortly within version 2.3.1