Select users by user group

bobede

Member
I have an application where there are approximately 100 managers across about 12 different organizations. I want to be able to have people register for sessions and then an admin of the site will assign these registered people to one or more managers across one or more organizations. I know that I can use the user element for assigning the registration to the manager and then set it up as a repeatable group, but I'm wondering if there is some way to have one drop down to select the organization, which then filters which users are displayed so I don't see 100 users in the dropdown. Now that I'm typing it, it sounds kind of like the cascading drop down tutorial, but could that work with assigning multiple users? Having some difficulty visualizing how it fits together.

Thanks
 
Do the organizations correspond to Joomla groups? If so, you could probably do it with two join elements.

One to the #__usergroups table, for the organizations. Assuming you created a parent group, "Organizations", and put all the individual org groups in that, you could then use the ID of the parent to filter that to just the org groups, with a WHERE of ...

{thistable}.parent_id = 123

... where 123 is the ID of that parent Organizations group.

Then another join to the #__users table, with a WHERE of ...

{thistable}.id in (SELECT user_id FROM #__user_usergroup_map WHERE group_id = '{yourtable___organization_raw}')

... and enable the "AJAX update" option for it. Replace yourtable___organization with the full element name of the org join element (keep the _raw on the end).

Then when the org dropdown is changed on the form, it will rebuild the user dropdown, filtered by the org group, with that subquery that gets the members of that org group from the usergroup map table.

-- hugh
 
Thanks Hugh,

I did plan on creating user groups for each organization, but hadn't thought of creating a parent group. That's brilliant. The parent group will also help simplify the permissions as the child groups will inherit settings from the Org group.

Guess I have some work to do. Thanks again.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top