Title: Groups access control doesn&#8217;t work for all users
Last modified: August 14, 2017

---

# Groups access control doesn’t work for all users

 *  Resolved [Tommy O.](https://wordpress.org/support/users/tommyo/)
 * (@tommyo)
 * [9 years ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/)
 * Hello,
 * I’m having an issue with Woocommerce shortcodes when activating the Groups plugin.
 * I’ve installed WordPress 4.8.1 (default 2017 theme) and Woocommerce 3.1.1, and
   created:
    10 products that should be public (no restriction at all). 10 that 
   should be visible to group A. 10 that should be visible to group B. 10 that should
   be visible to groups A and B.
 * After installing and activating Groups 2.3.0, i’ve:
    * Created ‘Group A’ and ‘
   Group B’. * Created 2 new users, and assigned one to ‘Group A’ and the other 
   to ‘Group B’. * Set access restrictions on the products as described above.
 * What happens:
    On the Woocommerce ‘Shop’ page the products are displayed properly:–
   10 products when logged out. – 30 products when logged in, with each user seeing
   the products matching their assigned group.
 * On a page that displays all products, using the shortcode – [products ids=”1,
   2, 3, 4, 5 …”] (listing all products in the store), i’m seeing 30 products correctly
   when logged in as a user of group A, but only 20 when logged in as a user of 
   group B.
    I’ve verified that all products and users are set-up correctly, and
   while this is happening, the ‘Shop’ page shows the correct number of products–
   30 (for each user).
 * This is also having an effect on the Elegant Themes – Divi Theme i’m trying to
   install with the shop, which relies on shortcodes, and as a result doesn’t display
   products correctly in it’s front page ‘Shop’ module. It isn’t showing products
   that the user should have access to, based on their group.
 * WC shortcodes list:
    [https://docs.woocommerce.com/document/woocommerce-shortcodes/](https://docs.woocommerce.com/document/woocommerce-shortcodes/)
   I’ve also tried to use other shortcodes from the list, with similar results.
 * Any help would be greatly appreciated, as i’ve tried to reinstall / deactivate/
   wipe everything a few times, with no success so far.
 * Thank you.

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [Tommy O.](https://wordpress.org/support/users/tommyo/)
 * (@tommyo)
 * [9 years ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9409512)
 * I’m attaching screenshots of the Groups plugin settings, WP users that are used,
   and the Woocommerce products list (with access control settings):
 * > [View post on imgur.com](https://imgur.com/a/tYC0J)
 *  Plugin Author [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [9 years ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9411975)
 * Hi Tommy,
 * I’ve set up the following to check:
 * Groups: A, B
    Products: Test A, Test B each restricted to the respective groups
   and another product “Test” which is not restricted and “Test A B” which is restricted
   to groups A and B. Users: A couple of users, a and b, one belongs to group A,
   the other to group B
 * I’ve used the [products ids=”…”] shortcode to render the four products on a page.
 * My admin (who belongs to groups A and B) is shown all three products.
    User a
   who belongs to group A sees products Test, “Test A” and “Test A B” User b who
   belongs to group B sees products Test, “Test B” and “Test A B”
 * So this example is working fine … I can’t really see why your second user would
   only see a reduced set of products. Which products does the user who can only
   see 20 products see?
 *  Thread Starter [Tommy O.](https://wordpress.org/support/users/tommyo/)
 * (@tommyo)
 * [9 years ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9412267)
 * Hi Kento,
 * I’m attaching screenshots of what the users are seeing.
    User ‘student’ is in
   group ‘Students’ (Group A). User ‘alumni’ is in group ‘Alumni’ (Group B).
 * student is seeing 20 products (missing 10 from group ‘Students’):
 * > [View post on imgur.com](https://imgur.com/nWeO7Jr)
 * alumni is seeing 30 products correctly:
 * > [View post on imgur.com](https://imgur.com/HBXd12b)
 * Here you can see the setting for the WP users, Woocommerce products and Groups
   settings:
 * > [View post on imgur.com](https://imgur.com/a/n66QC)
 * You might have to create some more products to replicate this issue, as it seems
   to be inconsistent and doesn’t always happen.
    Sometimes the problem occurs with
   the ‘student’ user, sometimes it happens with the ‘alumni’ user and sometimes
   it works correctly for both.
 *  Plugin Author [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9412632)
 * Ok thanks that’s very odd. You don’t happen to have any caching for logged in
   users activated? That could mess things up … if it doesn’t happen always, it 
   could be the cause.
 *  Thread Starter [Tommy O.](https://wordpress.org/support/users/tommyo/)
 * (@tommyo)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9414977)
 * Hi,
 * I’ve tried clearing my local cache, and we don’t have any server side caching
   plugins or tools as far as i can see.
    After clearing it, products visibility
   remained the same as before.
 * I’ve also tried to create 1 of each product the same way you did, with new groups,
   users and products, but i’m having the same problem again for both users. this
   time they can’t see any of the products that have access restrictions on them.
   only the one that is public (no group restrictions).
 * By the way, my server specifications (if this might have anything to do with 
   the problem) are:
    PHP 5.6.31 MySQL 5.5.55
 *  Plugin Author [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9415119)
 * Thanks for that, have you checked if there are any issues with PHP memory limits?
   If you’d like us to have a look at your site, please email support at itthinx
   dot com with a link to this conversation.
 *  Thread Starter [Tommy O.](https://wordpress.org/support/users/tommyo/)
 * (@tommyo)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9415640)
 * PHP memory limit is set to 256 MB. We’ve had no issues with it so far.
 * I’ve sent an email with login details to your support email.
 * Thank you
 *  Plugin Author [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9415894)
 * Ok perfect, but we haven’t received the email. Could you please resend it to 
   itthinx at gmail dot com? Looks like the mail server hasn’t received it.
 *  Thread Starter [Tommy O.](https://wordpress.org/support/users/tommyo/)
 * (@tommyo)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9415927)
 * I’ve resent the email to both addresses.
 *  Plugin Author [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9417040)
 * Ok thanks, got it.
 *  Plugin Author [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9418295)
 * I’ve tried a few variations on your all-products page, and got odd results ..
   I think now I know why.
 * I’ve taken a look at how this `[products]` shortcode is implemented, it uses 
   transients to store results for a particular shortcode instance based on some
   parameters, among them the product IDs that have been passed to the shortcode.
   If you have a look at your all-products page and check the results it produces
   for the shortcode where only IDs of unrestricted products are included – under“
   Products not assigned to groups” and “Products not assigned to groups, using 
   a different order” – it will show all products the user is allowed to view, even
   if their IDs are not passed to the shortcode. I think the shortcode is accessing
   the same transient although the parameters are different. To me this is a bug
   in the shortcode and I wouldn’t use it.
 * A possible solution if you still want to use it, group the products like I’ve
   done on your page. Imagine products 123 and 234 belong to one group while products
   345 and 456 belong to another group. As you can see on your all-products page,
   this seems to work:
 *     ```
       [products id="123,234"]
       [products id="345,456"]
       ```
   
 * You could display some additional info conditionally using `[groups_member]` :
 *     ```
       [groups_member group="Students"]Hey Students, here are your products: [products id="123,234"][/groups_member]
       [groups_member group="Alumni"]Dear Alumni, we have these fine products exclusively for you: [products id="345,456"][/groups_member]
       ```
   
 * I hope that this helps you, I’ll mark this as resolved with the above solution(
   although I still would rather recommend to look for other ways instead of using
   that shortcode).
 * Please feel free to ask if you need further help.
    -  This reply was modified 8 years, 12 months ago by [Kento](https://wordpress.org/support/users/proaktion/).
      Reason: marking code

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Groups access control doesn’t work for all users’ is closed to new replies.

 * ![](https://ps.w.org/groups/assets/icon-256x256.png?rev=983146)
 * [Groups - Memberships and Access Control](https://wordpress.org/plugins/groups/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/groups/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/groups/)
 * [Active Topics](https://wordpress.org/support/plugin/groups/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/groups/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/groups/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [Kento](https://wordpress.org/support/users/proaktion/)
 * Last activity: [8 years, 12 months ago](https://wordpress.org/support/topic/groups-access-control-doesnt-work-for-all-users/#post-9418295)
 * Status: resolved