× Here you can get community support related to Auto Group.

Assign to 3 groups

  • gilles.dumee
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 5 months ago #415 by gilles.dumee
Assign to 3 groups was created by gilles.dumee
Hello,
I have 3 groups of users : group1, group2 and group3
But groups are not exclusives. A user can be in :
- group1 only
- group1 and group2
- group1, group2 and group3

I added a community builder select field, to select Type1, Type2 or Type3.
But i cannot set AutoGroup rules to do my exemple. I tried:
cb_groupe;Type1;group1;false
cb_groupe;Type2;group2;true
cb_groupe;Type3;group3;true


To success this, i had to change the last parameter meaning. "Unassign when fieldvalue is different" was too restrictive. So now, when selecting a fieldvalue, last parameter is assign or unassign to user group.

if ($rule == $value)
{
$gid = $this->getGroupID($rule);
if if ($rule == 'true')
{
JUserHelper::addUserToGroup($id, $gid);
}
else
{
JUserHelper::removeUserFromGroup($id, $gid);
}
}

Hope this could improve your module

Please Log in or Create an account to join the conversation.

More
11 years 5 months ago - 11 years 5 months ago #419 by admin
Replied by admin on topic Assign to 3 groups
Hi Gilles,
first of all, really thanks for using Auto Group and for this great suggestion. You really inspire me so I've rewritten my plugin to add your tips. Just now you can download new version 2.0 with the following main changes:
  • Improved performances adding cache support at group lookups;
  • Added support for assign multiple groups for each field value;
  • Removed dependency from rule ordering with trace of assigned groups.

Now I'm going to update the product description page and the JED. Please, let me know if this new version solves all your problems.

Kind regards,
Luigi
Last edit: 11 years 5 months ago by admin.

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds