Groups

Groups is a WordPress plugin that 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.

Extensions

New Groups Restrict Categories and Groups Import Export.

  • Groups 404 Redirect allows to redirect visits to pages that are protected by Groups.
  • Groups Blog Protect restricts access to blogs based on group membership.
  • Groups File Access Groups File Access is an extension that allows to provide file download links for authorized users. Access to files is restricted to users by their group membership.
  • Groups Forums provides a powerful and yet light-weight forum system for WordPress sites.
  • Groups Gravity Forms allows to add users to groups automatically, based on form submissions.
  • Groups Import Export – An import and export extension for Groups.
  • Groups Jigoshop Groups integration for Jigoshop that supports memberships and subscriptions.
  • Groups Newsletters helps you to communicate efficiently, providing targeted information to groups of recipients through automated campaigns.
  • Groups Notifications allows to send automatic notifications to group members and the site administrator.
  • Groups PayPal – Sell memberships and subscriptions with Groups and PayPal.
  • Groups Restrict Categories features access restrictions for categories, tags and other WordPress taxonomies, including support for custom post types and taxonomies.
  • Groups Restrict Comments Pro This extension for Groups allows to restrict who can post or read comments based on a user’s group membership.
  • Groups Subscriptions is a subscription framework for Groups.
  • Groups WooCommerce Groups for WooCommerce is a WordPress plugin that allows you to sell memberships.
  • WooCommerce Group Coupons This extension for WooCommerce uses Groups and WordPress roles to limit the validity of coupons.
  • WooCommerce Groups Newsletters The WooCommerce Groups Newsletters extension lets customers subscribe to newsletters at checkout.

Features

User groups

  • Supports an unlimited number of groups
  • Provides a Registered group which is automatically maintained
  • Users can be assigned to any group
  • Users are added automatically to the Registered group

Groups hierarchy

  • Supports group hierarchies with capability inheritance

Group capabilities

  • Integrates standard WordPress capabilities which can be assigned to groups and users
  • Supports custom capabilities: allows to define new capabilities for usage in plugins and web applications
  • Users inherit capabilities of the groups they belong to
  • Groups inherit capabilities of their parent groups

Access control

  • Built-in access control that allows to restrict access to posts, pages and custom content types to specific groups and users only
  • control access to content by groups: shortcodes allow to control who can access content on posts, show parts to members of certain groups or to those who are not members Shortcodes: [groups_member], [groups_non_member]
  • control access to content by capabilities: show (or do not show) content to users who have certain capabilities Shortcodes: [groups_can], [groups_can_not]

Easy user interface

  • integrates nicely with the standard WordPress Users menu
  • provides an intuitive Groups menu
  • conceptually clean views showing the essentials
  • quick filters
  • bulk-actions where needed, for example apply capabilities to groups, bulk-add users to groups, bulk-remove users from groups

Sensible options

  • administrator overrides can be turned off
  • optional tree view for groups can be shown only when needed
  • provides its own set of permissions
  • cleans up after testing with a “delete all plugin data” option

Access Control

Groups defines some capabilities of its own. The groups_read_post capability is used to restrict access to certain posts or pages to groups (and users) with that capability only.

Framework

  • Solid and sound data-model with a complete API that allows developers to create group-oriented web applications and plugins

Multisite

  • All features are supported independently for each blog in multisite installations

Your opinion counts

You & Groups

Beta-testers and developers who need to integrate group-based features in their plugins and web applications: please use it and provide your feedback.

Feedback

Feedback is welcome!

If you need help, have problems, want to leave feedback or want to provide constructive criticism, please do so here at the Groups plugin page.

Please try to solve problems there before you rate this plugin or say it doesn’t work. There goes a lot of work into providing you with free quality plugins! Please appreciate that and help with your feedback. Thanks!

Twitter

Follow me on Twitter for updates on this and other plugins.

Introduction

Content Access Control

Access restrictions on posts

On posts an pages (and custom content types) a new meta box titles Access restrictions appears. By checking Enforce read access, you can restrict access to the post to groups and users who have the groups_read_post capability. You need to assign this capability to a group and make users members of that group to allow them to see those posts.

Content visibility for members and non-members

The [groups_member] and [groups_non_member] shortcodes are used to limit visibility of content to users who are members of a group or users who are not members of a group. Multiple comma-separated groups can be specified.

Example: Limiting visibility of enclosed content to registered users.

[groups_member group="Registered"]

Only registered users can see this text.

[/groups_member]

Content visibility based on capabilities

The [groups_can] and [groups_can_not] shortcodes limit visibility of enclosed content to those users who have the capability or those who do not have it. Multiple capabilities can be given.

Example: Showing enclosed content to users who can edit_posts (standard WordPress capability).

[groups_can capability=”edit_posts”]

You can see this only if you have the edit_posts capability.

[/groups_can]

Integration in the ‘Users’ menu:

Users – group membership is managed from the standard Users admin view. Users are automatically added to the Registered group. You can add multiple users to other groups here and also remove them.

Sections in the ‘Groups’ menu:

Groups

Here you can:

  • add groups
  • remove groups
  • assign capabilities to groups

Capabilities

This is where you add, remove and manage capabilities.

Capabilities can be assigned to groups and users (1). These capabilities include the standard WordPress capabilities but you can also define additional capabilities for your web-application.

Groups defines some capabilities of its own. The groups_read_post capability is used to restrict access to certain posts or pages to groups (and users) with that capability only.

(1) Assigning capabilities to users is not integrated in the user interface yet but can be done through API calls.

Options

Administrator override :

Administrator overrides can be turned off.

Permissions :

For each role these permissions can be set:

  • Access Groups: see information related to Groups.
  • Administer Groups: complete control over everything related to Groups.
  • Administer Groups plugin options: grants access to make changes on the Groups > Options admin section.

Testing the plugin :

A convenient option is provided to delete all data that has been stored by the Groups plugin. This option is useful if you just need to start from fresh after you have been testing the plugin.

Shortcodes

Please visit the documentation page on shortcodes for up-to-date information: Groups Shortcodes

Download

Download the Groups plugin on WordPress.

1,946 Responses to Groups

  1. Suman kalyan mohanty February 1, 2016 at 9:05 am #

    Hi Antonio

    I m just using this plugin and it’s working good.
    All the users are automatically added to registered group by default.I want users to be added to my own created groups(eg:VETS,a group I created).
    Please let me know how to do that?
    Hope for a quick heads up.

    Regards
    SUman

    • antonio February 1, 2016 at 9:39 am #

      Hi Suman,
      you can use this code in your functions.php theme file. You need to change ‘Premium’ for your group’s name.
      Kind Regards,
      Antonio B.

      • Suman kalyan mohanty February 1, 2016 at 10:37 am #

        Hi again

        It’s working good after putting that code in functions.php.But now users are added to both registered and the group I created i.e vets, at the same time. How can I added the users to only “vets” group.

        I dont users to be added to registered groups.Please let me know as this is my client’s requirement.

        Thanks
        Suman

  2. Suman kalyan mohanty February 1, 2016 at 10:07 am #

    Hi again

    It’s working good after putting that code in functions.php.But now users are added to both registered and the group I created i.e vets, at the same time. How can I added the users to only “vets” group.

    I dont users to be added to registered groups.Please let me know as thisi s my client’s requirement.

    Thanks
    Suman

    • antonio February 1, 2016 at 10:42 am #

      Hi Suman,
      ‘Registered’ is the default group, it can not be removed. But it should not be a problem, simply limit your contents to the VET group.
      Kind Regards,
      Antonio B.

      • Suman kalyan mohanty February 1, 2016 at 10:53 am #

        Thanks a lot for the heads up 🙂

  3. Aj February 4, 2016 at 12:27 am #

    I have been using the Groups plugin for around a year and it has worked great. Today I tried something that seemed very straightforward, but it is not working as expected.

    My problem involves two groups.

    GM Group
    Capabilities…
    – groups_read_post
    – access_all_shops

    Owner Group
    Capabilities…
    – groups_read_post
    – access_all_shops
    – access_shop_owners

    The WP users in question are assigned to either the ‘GM’ or ‘Owner’ group.

    I created a post that I gave an access restriction of ‘access_all_shops’.

    Inside that post I have several download link shortcodes (from WordPress Download Manager Pro). For one of these shortcode links I have added the Groups shortcode access restriction of ‘access_shop_owners’. It looks like this…

    [groups_member group="access_shop_owners"][wpdm_package id=’1060′][/groups_member]

    Expected Behavior
    The post would be accessible only to ‘Shop’ users but the one download link would only be seen by the ‘Shop Owners’.

    Actual Behavior
    The post is accessible only to ‘Shop’ users, but the one download link is hidden to everyone?

    What do I need to do to achieve the ‘Expected Behavior’? Thank you for your help.

  4. Aj February 4, 2016 at 12:41 am #

    I just solved my own question. It was a silly mistake with a simple answer. I was using the name of the ‘capability’ in the Groups shortcode instead of the name of the ‘group’ itself. Once I made that change, everything worked as expected.

    Thanks for a great plugin!

    • antonio February 4, 2016 at 8:10 am #

      Perfect 😉
      Kind Regards,
      Antonio B.

  5. Jerry Christensen February 4, 2016 at 4:47 pm #

    When a Woocommerce subscriber cancels their membership they are removed from all groups. How do I set it so they will automatically be placed in the Registered group upon cancellation?

    • antonio February 4, 2016 at 9:16 pm #

      Hi Jerry,
      by default new users are in ‘Registered’ group, so you don’t need to select the ‘Registered’ group in your subscriptions.
      Kind Regards,
      Antonio B.

      • Jerry Christensen February 4, 2016 at 9:29 pm #

        I thought that was the case as well however it was brought to my attention today that when a subscription is canceled the member is removed from all groups and they cannot see anything within the [groups_member group="Registered"]…[/groups_member] shortcode until I manually put them back in the Registered group. I also noticed that they are automatically assigned to the Registered group if I deactivate and reactivate the groups plugin. My question is, “Is there a way to make assignment to Registered group upon downgrade automatic without having to deactivate and reactivate the plugin?” Thanks so much for everything. I think your work is pretty amazing!

        • antonio February 5, 2016 at 9:03 am #

          Hi Jerry,
          what subscription plugin are you using ? Woocommerce Susbcription? So I can test this (If you want, you can send me dashboard admin access to antonio at itthinx dot com indicating this comment, and I’ll have a look at your settings).
          Kind Regards,
          Antonio B.

  6. Joffreu February 15, 2016 at 3:36 pm #

    Is it possible to restrict the edition and creation of article, of a certain cartegory to a certain group of admin ?

    I see how to restrict categories to users, but I’d like do to the same with administrators.

    • Kento February 15, 2016 at 7:33 pm #

      Hi,

      You can protect the category – if the user who is publishing the post doesn’t belong to a group that has access to the category, then it won’t be available to that user. Does that work for what you have in mind?

      Cheers

  7. Sophie Jones February 15, 2016 at 10:09 pm #

    Hello
    Is there any way to allow a user to manage one group, in a sense be the owner of that group and allow him to add sub-groups to his group if necessary without giving them major global permissions??
    Basically, I would like to be able to create the parent group for privileged role users and give them owner of the group and allow them to create subgroups in this group??
    My goal is to create a page using group shortcode and show list of users in this group with a custom field in their profile to show if they are available or not. So the owner/manager of this group can see, and add a button to open a form to create subgroup where he can add from users who are available and create his subgroup which he can later use on a custom post type.

    • Kento February 18, 2016 at 4:11 pm #

      Hi,

      Thanks for asking – it’s possible to create a group with administrative permissions for the Groups section itself, but it wouldn’t be possible yet to limit these to allow only subgroups to be managed by someone. We’re working on a more fine-grained permission model but it isn’t available yet.

      Cheers

  8. Karl February 17, 2016 at 4:13 am #

    Hi-

    I’m looking for a way (possible a small snippet added to my theme’s functions.php file) that would allow me to redirect a particular link or page to another url/page on my site based on the logged in user’s group or capability. More specifically, I’m looking to redirect a generic URL (call it https://mysite/dashboard) to one of several other urls based on a user’s assigned group.

    Any ideas?

    Note that I’m NOT just trying to redirect after login. I’m trying to systematically redirect a particular link…

    Thanks in advance!

    • Kento February 18, 2016 at 4:22 pm #

      Hi Karl,

      I would probably go about this in a similar way as used by Groups 404 Redirect – hooked on the wp action and using the Groups API to check to which group a user belongs (see Examples). Does that help?

      Cheers

  9. Elia February 17, 2016 at 6:11 am #

    Hi

    I use Groups to grouping my authors and I found an editor for any group.
    Now I want to add group filter to posts page to filter the posts by group.
    Is there a way for this issue?!

    Thank you

    • Kento February 18, 2016 at 4:04 pm #

      Hi,

      Thanks for the suggestion, currently there is not filter to show posts by authors’ group membership but it sounds like a useful idea. Maybe we can add this later on.

      Cheers

  10. Andrei G. February 25, 2016 at 4:20 pm #

    Hi,

    I have a site where there are many groups and subgroups and inherited capabilities. I am able to restrict access to pages or posts to a certain group or subgroup just fine.

    My question is how would I go about excluding access to a page or post for a specific group without having to list all the others that do have access?

    Thanks.

    • Kento March 1, 2016 at 7:20 pm #

      Hi Andrei,

      That’s a good question – in fact there are plans to add the possibility to exclude certain groups from being able to access a page, but currently it won’t be possible … maybe using the [groups_non_member] shortcode is a solution meanwhile? You can use it to enclose content on a page so that it is hidden from group members. If the page itself it protected, then that could work. Also note that you would have to combine it with the [groups_member] shortcode enclosing that section so that those who shouldn’t have access can’t see it either (if the page isn’t restricted).

      Cheers

  11. Brian Russell March 2, 2016 at 3:50 pm #

    Is there any way to get a multisite install to recognize group affiliation across the multisites? If I wanted a specific group to have access to that group’s access across the whole network?

    That would be incredibly helpful.

    • Kento March 16, 2016 at 12:30 pm #

      Hi Brian,

      Thanks for asking, this isn’t possible yet altough we’re already aware of the usefulness and should be providing a solution hopefully soon. See this topic for example.

      Cheers

  12. Juliette March 6, 2016 at 3:35 pm #

    Hi Itthinx team,

    Do you sell plugin’s group which allows to hide or to show different menus according to the group of the users ?

    Thanks
    Juliette

    • antonio March 7, 2016 at 5:34 am #

      Hi Juliette,
      you have available this plugin that you must customize it.
      Kind Regards,
      Antonio B.

      • Juliette March 7, 2016 at 8:41 pm #

        Hi Antonio,

        I’m talking about premium plugin that I can buy to you… :))

        But If you have a free plan…
        How can you do to install this file ? You install it in folder in /plugins/ ?

        Sorry I’m not developper… :oS

        • antonio March 8, 2016 at 8:52 am #

          Hi Juliette,
          maybe this solution is easier for you, please have a look at this conversation.
          Kind Regards,
          Antonio B.

  13. Keith March 10, 2016 at 11:26 am #

    Hi

    I am looking to see if the Groups membership plugin would allow me to do the following:

    Example: John Smith (member) logins into the site, and he can only see posts that have been assigned to him. No one else would see this posts.

    Would I need other extensions or custom coding to do that?

    Thanks

    • Kento March 10, 2016 at 6:04 pm #

      Hi Keith,

      With Groups you can grant access to members of a certain group, so in this case, you would protect the pages and then assign John Smith to the group that has access. See Access Control in the documentation for details please.

      Cheers

  14. Web March 16, 2016 at 2:31 am #

    We have Group Plugin on the website and we have around 1000 groups live for Access restrictions.

    The issue is when we have Groups plugin active with 1000 Groups, we are not able to load the images under the Add Media window quickly.

    Is anyone have idea how can we fix this issue????

    • Kento March 16, 2016 at 1:43 pm #

      Hi,

      I don’t see where this would affect the Media > Add New screen, the access restrictions aren’t even listed there so I’d like to find out why this is creating an issue for you on your site. Do you get any Javascript errors?

      Cheers

  15. Sam March 20, 2016 at 6:02 pm #

    Hi – i cant find a way to lists the users in a particluar group, on the front-end?

    • antonio March 21, 2016 at 3:22 pm #

      Hi Sam,
      you can use this plugin and use the [groups_users_list_group] new shortcode, with the ‘group_id’ attribute.
      Kind Regards,
      Antonio B.

  16. JoC March 31, 2016 at 1:48 am #

    I need access-protected posts to be visible on category pages (or any page that uses the $wp_query variable).

    I found the relevant code in the plugin directory /groups/lib/access/class-groups-post.access.php, in the function posts_where (there is a mySQL statement that pulls posts which aren’t protected or which the user doesn’t have the capability to access.

    Instead, I want all the posts to be visible, but if a user clicks on them, I want the posts to remain access protected.

    What adjustments can I make to the posts_where function, in order to accomplish this?

    • antonio April 4, 2016 at 8:55 am #

      Hi JoC,
      maybe Groups Excerpts can be a solution.
      Kind Regards,
      Antonio B.

  17. Desheen L. Evans April 7, 2016 at 7:12 pm #

    I have the plugin installed and set-up nicely, but I want to protect the page behind a payment wall and only allow visitors to sign up for a membership then they can access.

    Can someone help me by going into my WP dashboard?

    • antonio April 8, 2016 at 9:37 am #

      Hi,
      If you are using Woocommerce, you can use Groups Woocommerce to sell access to groups. So only users who purchase “this product” have access to the protected pages.
      Kind Regards,
      Antonio B.

  18. Marcus April 14, 2016 at 1:57 pm #

    Your plugin says that it can restrict access to custom types of media. For instance the access restrictions option comes up in my media library, if I apply a restriction to the media I find that it does not work. If i type the web address into a browser of which I am not logged into my site I go directly to that document. What I really would love is a way to completely lock down media/files using groups. Any help you can provide is appreciated.

    • Kento April 14, 2016 at 3:20 pm #

      Hi Marcus,

      That’s correct, the attachment page itself is protected but if you have the direct URL to the file it will still be accessible. You can protect files using Groups File Access, please have a look also at the documentation so you can see if that would be suitable for your requirements.

      Cheers

  19. Maxident April 22, 2016 at 11:11 am #

    Hi Kento,

    I am thinking about buying the groups file access plugin. As far as I understand file restriction works based on the group membership only. Is there a way to add a password request before the file can be downloaded if the member is part of a group that is linked to the file?

    I am not sure if membership alone is enough security.

    cheers

    • Kento April 22, 2016 at 1:12 pm #

      Hi,

      The user has to be logged in to access the file or use a specific link, otherwise it will not be accessible. There’s no additional password option to access the file, it’s not something that I would consider adding as I consider the plugin’s restriction already sufficient, but thanks for asking.

      Cheers

  20. Eric April 26, 2016 at 1:10 am #

    First off, fantastic plugin! Groups has really been helpful, so thank you!

    But I seem to have a strange issue. I’m using Groups to show/hide posts based on membership. However, if I make a post sticky, it shows up on the posts page even though the user doesn’t belong to that group. If you try clicking into the post, you get a 404, which is good. But I need to stop a sticky post from being listed on the posts page.

    Is marking a post sticky supposed to override Groups or am I just missing something here?

    Thanks!

    • antonio April 26, 2016 at 8:55 am #

      Hi Eric,
      Sticky posts override Groups, but you can use this code if you need to filter the sticky posts.
      Kind Regards,
      Antonio B.

  21. Martijn April 28, 2016 at 2:22 pm #

    Hi,

    We want to use groups to limit access to several pages/content.
    But there is one thing we want to do, were we don’t see any options for, so I don’t know if it can be done with this plugin or with any of the addons. So maybe someone here can help us out.

    For a couple of the groups we would like to have a specific group page, were some info for this group is displayed. Users can be in multiple groups.

    Is there a way to only display the pages the user has access too in a menu, preferably in the submenu.
    exaple : User X is part of group A,C & G
    So user X sees:
    grouppages
    -group a
    -group c
    -group g

    & user Y is part of group D & G and sees
    grouppages
    -group d
    -group g

    I hope its clear what we would want.
    Is this possible within this plugin and or its addons? or do we have to find another solution.

    Kind regards,

    Martijn

    • Kento May 1, 2016 at 9:13 am #

      Hi Martijn,

      If you add a restricted page to a menu through Appearance > Menu > Pages the menu item will only show up if the user has access. This works with protected posts, too, note that it will have no effect if you add a URL directly using Custom Links.

      Cheers

      • Martijn May 2, 2016 at 8:02 pm #

        Thanks, works like a charm.

      • Cloudfusion May 19, 2016 at 9:05 am #

        Hi, I have custom links in my menu used as seperators, how can I hide these links using Groups? or Is there any other solution / idea to implement this to work with Groups? Thanx!

        • antonio May 23, 2016 at 7:43 am #

          Hi Cloudfusion,
          you can use the Menu Item Visibility Control plugin using this code: current_user_can(‘your_capability’);
          Regards,
          Antonio B.

  22. Loic May 2, 2016 at 4:50 pm #

    Hi !

    Is it possible to not hide a menu when the user doesn’t have the correct permission ? Just display a message on the page like “Sorry, you do not have the correct permission”.

    Thanks 🙂

    • antonio May 3, 2016 at 5:50 am #

      Hi Loic,
      You can do it using shortcodes in the page/post content, instead of limit the full page/post.
      Kind Regards,
      Antonio B.

  23. Martijn May 2, 2016 at 8:05 pm #

    Can this plugin also be used to limit the pages that are editable by a group ?

    case: a couple of user filled pages, were a couple of blogs and events are automaticly placed, but the group “owner/leader” should be able to edit this page. But he/she has no business editing any of the other pages. Can I use this plugin to make an editor, who is part of group A, only able to edit the page of group A?

    Kind regards,

    Martijn

    • antonio May 5, 2016 at 6:48 am #

      Hi Martijn,
      If you restrict a post/page to a groupA, and your editor user is not in this group, then he can not view/edit this page/post.
      So you could restrict all your pages to a ‘editorGroup’. Create an ‘ownerLeaderGroup’ and assign the pages editable to this ownerLeaderGroup.
      If you need to have editors who can edit all pages, the join these editors to both groups: editorGroup and ownerLeaderGroup.
      Kind Regards,
      Antonio B.

  24. Facemweb May 4, 2016 at 12:39 pm #

    Hi,

    Is it possible to remove all the users of a group instead of making it user by user ?

    • antonio May 4, 2016 at 1:52 pm #

      Hi Facemweb,
      From the Users->All users page you can select multiple users and uses the bulk actions.
      Kind Regards,
      Antonio B.

      • Facemweb May 6, 2016 at 7:32 am #

        Didn’t see that option !!
        Thanks !

  25. John King May 19, 2016 at 4:22 pm #

    Hi, I have applied the Access Restrictions to the Media post type in Groups / Options.

    When I go to a page and click ‘Add Media’, then drag an image to the screen the Access Restrictions dropdown seems to be broken and in my console I see the error message ‘Uncaught TypeError: jQuery(…).selectize is not a function’.

    Is this a known bug? And is there a fix I can apply?

    Thanks.

    • antonio May 20, 2016 at 5:40 am #

      Hi John,
      I can not replicate your issue. Please be sure you have the latest versions and check if you have another plugin that could have javascript problem.
      If the problem persists, you can send me dashboard admin access to antonio at itthinx dot com, indicating this conversation and I’ll have a look at your settings.
      Kind Regards,
      Antonio B.

  26. Dave May 24, 2016 at 7:23 pm #

    I have been considering this plugin for membership access to a client’s website (along with the paypal, forums and file access modules). But the problem is that they would need a group subscription based on the groups instead of the users. For example, an organisation registers, and then their employees get access through the organisation. That would technically work with the groups, but for my client some automation would be required. When an organisation registers they would need to be able to pay to increase privileges to their group, which would then grant these privileges to their members. Technically, this already works with groups, but would require a lot of manual work by the site admin (create a group for the new organisation, collect payment, then add privileges to the group, then manually assign users to the group). I’ve been testing the plugin, but it can’t seem to do this. Is there any way to do some of this automatisation that I’ve missed? Any suggestions?

    Thanks!

    • antonio May 25, 2016 at 5:24 am #

      Hi Dave,
      You can use the Groups API to create your own solution. You could have your groups with basic capabilities,and when you receive a payment, then add extra capabilities to this group.
      Relating to “Import/export users to/from a group”, you can do it manually or using the Groups Import/Export plugin.
      Kind Regards,
      Antonio B.

      • Dave May 25, 2016 at 1:33 pm #

        Thanks for the answer, I will look into that. I’ll look into upgrading the groups capabilities according to the other groups members are part of, so if a user of the group buys access to the premium group, everyone in the group gets the same capabilities.

        Is it possible to have users that are part of a group be able to invite other users to the group? I guess it could be done with the API but its already possible I’d rather not have to code it. 🙂

        Thanks!

        • antonio May 25, 2016 at 5:44 pm #

          Hi Dave,
          I have created the Groups Invitations plugin that you can use as reference to create your own solution.
          Kind Regards,
          Antonio B.

          • Dave May 26, 2016 at 4:04 pm #

            Great! I modified it to work only on groups starting with a specific string pattern and added some obfuscation to the URL so it is not too easy to change the group id (and thus join the other groups that user is part of) and it works very well for what my client needs.

            Now I’m on to code the automatic group capabilities assignments. This solution seems very good, and most importantly, cheap for my client, since I don’t have to spend days coding a custom solution or have them pay through the roof for other membership plugins that charge crazy monthly/yearly fees for plugins that are not very good or even customizable.

            Many thanks!

            • antonio May 27, 2016 at 4:51 am #

              Perfect 😉

          • Dave May 26, 2016 at 7:23 pm #

            Hi again,

            I tried working on upgrading groups capabilities like I stated earlier, but could not get ‘groups_created_user_group’ to trigger. To test that I installed this demo: https://github.com/itthinx/groups-premium-add-to-foobar/blob/master/groups-premium-add-to-foobar.php, added the Premium and Foobar groups and it doesn’t work. The ‘groups_created_user_group’ action still doesn’t trigger.

            Any idea?

            Thanks!

            • antonio May 27, 2016 at 4:57 am #

              Hi Dave,
              Maybe are you working with capabilities? Please have a look at the actions documentation page.
              Kind Regards,
              Antonio B.

              • Dave May 27, 2016 at 11:06 am #

                Yes, I’m working with capabilities, but I need to know when a user joins a group. The way I see it, when a user joins a premium group, I want to know, and I will propagate the capabilities to its other membership groups at this moment, which is why I’m working with the ‘groups_created_user_group’ action. But if you have a better idea, I’m all ears.

                Thanks!

                • antonio May 28, 2016 at 8:32 am #

                  Hi Dave,
                  Maybe this plugin can be used as reference. It does something different, but you can see the use of hooks.
                  Kind Regards,
                  Antonio B.

  27. Dave May 30, 2016 at 1:30 pm #

    Hi Antonio,

    I have dug deeper into the code. Here’s what the error message is:

    Warning: Missing argument 2 for gpatf_groups_created_user_group() in /******/wp-content/plugins/groups-premium-add-to-foobar-master/groups-premium-add-to-foobar.php on line 38

    Line 38 is:

    function gpatf_groups_created_user_group( $user_id, $group_id ) {

    It seems the add_action call on line 36 needs to be told to expect two variables with two extra parameters: 10 and 2.

    add_action( ‘groups_created_user_group’, ‘gpatf_groups_created_user_group’, 10, 2 );

    When I do that, it works. You might want to update the demo. 😉

    Thanks!

    • antonio May 31, 2016 at 5:40 am #

      Hi Dave,
      thanks for sharing.
      Kind Regards,
      Antonio B.

  28. Tyrone June 3, 2016 at 3:43 pm #

    Hi Antonio,

    I have a quick, and what would seem a really simple, question but I just can’t figure out how to do it.

    I have the Groups, WooCommerce and WooCommerce for Groups plugins.

    I want any not logged in visitor to the website to be able to see the ‘Premium’ posts in search results but when they click on them to view them they get redirected to a signup page.

    Can you point me in the right direction ?

    Thanks

    • antonio June 4, 2016 at 5:31 am #

      Hi Tyrone,
      The search filters the restricted pages/posts. You could use the [groups_member] and [groups_non_member] shortcodes to restrict the contect instead of restrict the full page/post. So the post will be on the search results but according to the user group, he will see different content.
      Kind Regards,
      Antonio B.

  29. Kevin Wagner June 12, 2016 at 9:23 pm #

    Hello,

    I am using groups for access restriction on a food blog. Excellent plugin, has worked like a charm. I recently installed a new recipe plugin, wp ultimate recipe (also a great plugin). I had previously been locking/showing content using short codes in the main text area box. However, the new recipe plugin includes custom post types that use many custom fields to build the ingredients and instructions for each recipe. Is there a way to lock the custom field content using short codes, without taking the time to apply the short codes to each individual field? If not, is there conditional php I can add to the custom post type template to restrict those sections?

    Regards,

    • antonio June 13, 2016 at 5:41 am #

      Hi Kevin,
      I hope this comment can help you with the php code.
      Kind Regards,
      Antonio B.

  30. Edward Martin III June 16, 2016 at 2:13 pm #

    Hi!

    This plugin is almost exactly what I’ve been needing, but I can’t get past a certain glitch…

    On my site, I have several groups of “monsters” (werewolf, vampire, zombie, etc.). A user is allowed to be a member of any one group at a time, and they can change their alliance as needed. The shortcodes allowed me to build it this way:

    Choose a Creature Clan for access to exclusive content
    Note: you can only join one Creature Clan at a time. Your current Creature Clan is: [groups_member group="Ghost"]Ghost[/groups_member][groups_member group="Vampire"]Vampire[/groups_member][groups_member group="Werewolf"]Werewolf[/groups_member][groups_member group="Zombie"]Zombie[/groups_member].
    [groups_member group="Ghost"][groups_leave group="Ghost"][/groups_member][groups_member group="Vampire"][groups_leave group="Vampire"][/groups_member][groups_member group="Werewolf"][groups_leave group="Werewolf"][/groups_member][groups_member group="Zombie"][groups_leave group="Zombie"][/groups_member]

    [groups_non_member group="Ghost,Vampire,Werewolf,Zombie"][groups_join group="Ghost"][groups_join group="Vampire"][groups_join group="Werewolf"][groups_join group="Zombie"][/groups_non_member]

    So if they are a member of a group, the only choice they have is to leave the group, and if they are a member of no groups, they are offered buttons to let them choose a group to join.

    The trouble I hit is that the page doesn’t refresh after running the short code.

    So, if they leave a group, they have to refresh the page to see the new buttons. More complicating: if they CHOOSE a group, then they can immediately choose another group and another group and so on. If the page refreshed, then the shortcodes would allow only the appropriate controls to resolve.

    How might I force the page to refresh once they click any button in that group?

    • antonio June 17, 2016 at 9:47 am #

      Hi Edward,
      The ‘groups_leave’ and ‘groups_join’ actions are executed when the shortcode is executed, and this is after your groups is displayed.
      You can try to change the order, ex:
      [groups_member group="Ghost"][groups_leave group="Ghost"][/groups_member][groups_member group="Vampire"][groups_leave group="Vampire"][/groups_member][groups_member group="Werewolf"][groups_leave group="Werewolf"][/groups_member][groups_member group="Zombie"][groups_leave group="Zombie"][/groups_member]

      [groups_non_member group="Ghost,Vampire,Werewolf,Zombie"][groups_join group="Ghost"][groups_join group="Vampire"][groups_join group="Werewolf"][groups_join group="Zombie"][/groups_non_member]

      Note: you can only join one Creature Clan at a time. Your current Creature Clan is: [groups_member group="Ghost"]Ghost[/groups_member][groups_member group="Vampire"]Vampire[/groups_member][groups_member group="Werewolf"]Werewolf[/groups_member][groups_member group="Zombie"]Zombie[/groups_member].
      [groups_member group="Ghost"][groups_leave group="Ghost"][/groups_member][groups_member group="Vampire"][groups_leave group="Vampire"][/groups_member][groups_member group="Werewolf"][groups_leave group="Werewolf"][/groups_member][groups_member group="Zombie"][groups_leave group="Zombie"][/groups_member]

      Kind Regards,
      Antonio B.

      • Edward Martin III June 17, 2016 at 4:27 pm #

        Hi Antonio, and thank you for writing back.

        I had figured out the rendered-vs-active component, and I’m glad you confirmed that.

        All I’m trying to achieve is a relatively seamless “pick only one” experience.

        So, I guess I have two questions that might guide me:

        1. Is there a way to refresh the PAGE after a button is clicked (for example: if one joins a group), or at least to refresh the contents of a specific DIV which contains all the Groups HTML stuff (because it seems as if there is SOME sort of refresh activity happening), but in such a way that the contents of the DIV respect the choice that was made BEFORE the refresh event?

        2. Is there a way to use a standard JS control (button, drop-down, etc.) to perform a group action such as “add me to the Vampire group” or “delete me from the Vampire group”?

        • Edward Martin III June 17, 2016 at 4:28 pm #

          The part that keeps confounding me is the changing of the display of the elements based on the choices made. There seems to be SOME kind of localized refresh happening (thus when I remove myself from a clan, my affiliation reports accurately), but if that localized refresh IS happening, why aren’t the display-rules-for-buttons applying to it?

          I rewrote the code to put the “leave a clan” button in FRONT of the clan affiliation declaration, which worked great. Once they leave a clan, their “status” changes to “unaffiliated”, which is perfect, and then they are offered the list of clans to join, which is ALSO perfect.

          But there’s something going on I can’t explain…

          I discovered that picking a clan didn’t redraw the page, which meant the “pick a clan” buttons for the other clans remained on the page.

          If I refreshed the page, everything looked fine.

          So I surrounded the cluster of “pick a clan” buttons in a DIV such that on mouseup anywhere in that DIV (such as picking a clan button), the page was redrawn.

          But that actually failed to happen (as per my first note). The EXACT SAME CODE around a word worked fine. So, that was weird.

          So then I tried simply hiding the contents of the DIV (after all, if you can’t SEE a button, you can’t click it).

          And at first, it seemed to work.

          But then it refreshed a half-second later. With the subset of “pick a clan” buttons re-appearing. In Chrome. But not in IE. In IE, it remained hidden. (so the AJAX or whatever is executing under Chrome, but apparently not executing under IE…?) (but if it IS refreshing, how come the “what group are you now in” logic isn’t working anymore?)

          • Kento June 20, 2016 at 8:15 am #

            Hi Martin,

            See also my reply on your post Post-buttonclick actions?. Basically you have a form that shows as a button which is submitted when you click it. What you describe related to the other buttons is basically because the submission is handled in the process and the shortcodes that surround the buttons aren’t “aware” of the change when they are rendered, only on the next page load. A good solution would involve appropriate Javascript which disables and hides the other buttons, probably with an AJAX handler for the buttons (forms) themselves – something you would have to customize. Maybe another option is to have a look at the Gravity Forms integration?

            Cheers

        • Edward Martin III June 17, 2016 at 4:29 pm #

          I set up a test page here:

          http://www.store.hellbendermedia.com/my-account/

          I think you should be able to set up a test account to observe the behavior of the buttons.

          This is the code behind it:


          Choose a Creature Clan for access to exclusive content

          Note: you can only join one Creature Clan at a time.

          [groups_member group="Ghost"][groups_leave group="Ghost" display_message="false" submit_text="Leave the Ghost clan"][/groups_member][groups_member group="Vampire"][groups_leave group="Vampire" display_message="false" submit_text="Leave the Vampire clan"][/groups_member][groups_member group="Werewolf"][groups_leave group="Werewolf" display_message="false" submit_text="Leave the Werewolf clan"][/groups_member][groups_member group="Zombie"][groups_leave group="Zombie" display_message="false" submit_text="Leave the Zombie clan"][/groups_member]

          Your current Creature Clan is: [groups_member group="Ghost"]Ghost[/groups_member][groups_member group="Vampire"]Vampire[/groups_member][groups_member group="Werewolf"]Werewolf[/groups_member][groups_member group="Zombie"]Zombie[/groups_member][groups_non_member group="Ghost,Vampire,Werewolf,Zombie"]unaffiliated with any Creature Clan[/groups_non_member].

          [groups_non_member group="Ghost,Vampire,Werewolf,Zombie"]
          [groups_join group="Ghost" display_message="false" submit_text="Join the Ghost clan"]
          [groups_join group="Vampire" display_message="false" submit_text="Join the Vampire clan"]
          [groups_join group="Werewolf" display_message="false" submit_text="Join the Werewolf clan"]
          [groups_join group="Zombie" display_message="false" submit_text="Join the Zombie clan"]
          [/groups_non_member]

        • Kento June 20, 2016 at 8:54 am #

          Hi guys,

          The issue here is with the way the shortcodes are handled and although close, those solutions won’t work as you’d want them to. When the groups_member or groups_non_member shortcodes wrapped around groups_join or groups_leave shortcodes are processed, the latter haven’t executed the addition or removal of the user to or from a group and thus what is rendered is inconsistent with what you would expect right after you have clicked a button (submitted its form). On the next page load, it would show the appropriate buttons only. For example:

          [groups_non_member group="Test,Testing"][groups_join group="Test"][groups_join group="Testing"][/groups_non_member]
          [groups_leave group="Test"]
          [groups_leave group="Testing"]

          If you click the button to join the Test group the form is submitted and the groups_non_member shortcode will show its contents because at that stage the user hasn’t been added to the Test group yet. That is done while the group_join shortcode for the Test group is processed. As the content is rendered, the user is added to the Test group and then the groups_join button for the Testing group is rendered. For this case, it’s no good, at least not right after you have submitted the form (clicked the button).

          For your case, it would be simpler to just create a shortcode that offers a select box instead and handles the removal from the current group if the user chooses another. That’s my recommendation, you can in fact derive it easily from the groups_join and groups_leave shortcode handling code.

          I hope that helps to clarify it more. There’s much room for improvement for the way these things are handled in Groups and I hope we can offer something more versatile, son. Anyhow, would you like to try the suggestion around a select box?

  31. Dustin DeRyke June 27, 2016 at 9:50 pm #

    I know about the setting to display the groups that the user is part of in their profile, but is there any way to have that info somewhere on the frontend? I don’t allow regular users to access the backend so I’m hoping for some type of a solution to let them know what group they are in on the frontend. I downloaded a plugin called User Profiles Made Easy but can’t figure out how to implement it through that. I am also using Woocommerce, is there any way to display their group in WooCommerce’s My Account page?

    Thanks

  32. Pradeep Bhat July 4, 2016 at 10:21 am #

    Hi Antonio,
    Is there any Rest API to create group.I want to create group from my application?

    Thanks and Regards

    Pradeep Bhat

  33. John July 12, 2016 at 8:25 pm #

    Hi,

    Is there a way to have someone automatically added to a group upon registration. I have a custom registration form that adds users to a certain WP role. I need people in that role to be added to a group as well. So maybe there is a way to add a entire role to a group. Example: Add the Subscriber role to a group so that whoever is in the Subscriber role will automatically be added to the group. I hope that makes sense. I just need to know if there is a way to add a user to a group automatically.

    Thanks!

    • antonio July 13, 2016 at 6:58 am #

      Hi John,
      I have created this code that automatically add the new user to the ‘Premium’ group. You could use this code as reference to crete your own solution with the Groups API.
      Kind Regards,
      Antonio B.

  34. Jen July 14, 2016 at 10:58 am #

    Hi! I am thinking of using your plugin for my next project but I want to make sure it will do what I need first. Basically I have been asked to build a website which will have listings added by companies. The listings will only be visible to logged in Members. My plan is to use a theme like Listify (on themeforest) and BuddyPress. But I need to ensure that the Members cannot add listings and the companies cannot use the social networking facilities. I was starting to wonder how on earth I can allow access to companies to add and edit listings while ensuring that the public cannot view them without logging in first. I asked for help on the WP support forum and someone recommended your plugin. I’ve had a look and it looks promising. Will it work with Listify and Buddypress? Will it do what I need?

    Thanks
    Jen

    • antonio July 15, 2016 at 7:15 am #

      Hi Jen,
      If the theme implements the listings as post types or taxonomies, you can use the Groups Restrict Categories with Groups.
      But that depends of the theme implementation. If you have the theme installed, you can send me dashboard admin access to antonio at itthinx dot com (indicating this conversation), and I’ll have a look at this.
      Kind Regards,
      Antonio B.

Leave a Reply