Auto Group plugin for Community Builder 2.x / 1.x for Joomla 3.x and Joomla 2.5 allows to assign Joomla groups to an user depending on the value of a CB field. The check on the field's value is performed when the user register on site for the first time, and everytime the user profile is modified from the frontend or the backend. This allows, as example, to enable multiple user profiles, using Joomla groups as profile type, and CB fields to let users choose their profile type.
Let's assume we need two different user profile types, Downloader and Uploader. We can create two different Joomla groups with the same name.
And use Joomla Access Levels to grant different permissions for each profile (e.g. grant permissions to upload files only for Uploader profile). Now we need to let an user to choose his profile type. Let's create a CB field named "cb_profiletype" of type "select", with three values, Downloader, Uploader and Both.
Once this field is published, the user will be able to choose the profile type in the registration form using this field.
To assign the user to the corresponding Joomla group depending on the value for this field, let's enable Auto Group plugin from Community Builder panel and just configure a few rules (a rule for each line). Rule syntax is:
fieldname;fieldvalue, ... ,fieldvalue;groupname, ... ,groupname;unassign
Where "fieldname" is the CB field name to check (cb_profiletype in our example), "fieldvalue" is the field value that "trigger" the group assign action, and "groupname" is the Joomla group name to assign the user to. It's possible to specify a list of values and groups separated by a comma. Last field "unassign" can be only true or false (the default when not specified). When this is set to "true" this means that the groups specified should also be "unassigned" if the field value is different from the specified one (a group is unassigned only if is not explicitly assigned by another matching rule on a field).
Field types supported by Auto Group are:
- Check Box (Single)
- Check Box (Multiple)
- Drop Down (Single Select)
- Drop Down (Multi-select)
- Text Area
- Text Field
- Radio Buttons
For Check Box (Single) the field values for the plugin settings are 0 when unchecked and 1 when checked.
In our example rules are:
With these rules any time the field "cb_profiletype" assume the "Downloader" value, the user is assigned to "Downloader" group, and unassigned from this group if the value is different (from Downloader and Both). Likewise, any time this field assume the "Uploader" value, the user is assigned to "Uploader" group, and unassigned from this group if the value is different (from Uploader and Both). Finally, if the field assume the "Both" value, the user is assigned to both "Uploader" and "Downloader" groups. Simple, effective and cheap. The price for the lifetime subscription is only 5€.
Auto Group is released under GPL 2.0 license.