| 

Our Tutorials

Tutorial Library

CB Auto Actions: Assigning usergroup based on CB field value

User Rating: / 100
PoorBest 

Overview

With Joomla 1.5 you can specify which ACL group newly registered users will be placed into (Global Configuration -> System: 'New User Registration Type'. This feature is also available in Joomla 1.7 (Users -> User Manager -> Options: 'New User Registration Group') but now with Joomla new ACL group functionality this has become even more powerful.

With CB 1.7.1+, Joomla 1.7.x and CB Auto Actions 2.0+, in addition to the normal Joomla user group assignment (based on the previous parameters) you can automatically place newly registered users in different Joomla ACL groups depending on a CB field value populated during the registration process.

To make this even more specific the following use case is outlined:

  • Our Comunity Builder registration form has a mandatory CB radio field named 'User Type' that accepts one of the following three values: Student, Teacher, or Parent.
  • We have created three Joomla ACL groups under the Registered group parent named: Student, Teacher, Parent.
  • When a new user registered we want to automatically assign the user to the relevant Joomla ACL user group based on the selected 'User Type' radio field value. Thus students should be added to the 'Student' Joomla group, parents to the Parent group, etc.

Solution / Example

The CB Auto Action plugin available for Professional members can be easily configured to implement such a use case with the following three actions (one for each group assignment):

  • Type: Usergroup
    Trigger: onAfterUserRegistration
    User: Automatic
    Access: Everybody
    Conditional: [cb_usertype] Equal To Student (Make sure to surround your field name with brackets [ ] )
    Mode: Add Usergroups
    Groups: Student

  • Type: Usergroup
    Trigger: onAfterUserRegistration
    User: Automatic
    Access: Everybody
    Conditional: [cb_usertype] Equal To Parent (Make sure to surround your field name with brackets [ ] )
    Mode: Add Usergroups
    Groups: Parent

  • Type: Usergroup
    Trigger: onAfterUserRegistration
    User: Automatic
    Access: Everybody
    Conditional: [cb_usertype] Equal To Teacher (Make sure to surround your field name with brackets [ ] )
    Mode: Add Usergroups
    Groups: Teacher

With these auto actions published all students will be added to Registered and Student Joomla ACL groups, all parents will be added to Registered and Parent Joomla ACL groups and all teachers will be added to Registered and Parent Joomla ACL groups.

If you do not want users added to Joomla Registered ACL group, then you can create three more auto actions (with same trigger) to remove users from Registered ACL group.

Relevant Information


blog comments powered by Disqus
Professional Member
Professional badge
As a Professional member you get all the Advanced privileges (CB detailed documentation, 17+ CB Add-ons, 11 GroupJive) and access to our same or next business day response time support forum for all your websites and our 26+ Incubator add-ons! That's a lot of add-ons that you can use on all your websites for ever!

 

Only 119 € for 12 months


Go Professional Now!