get the child of specific usergroup?

For Joomla! 3.x Coding related discussions, please use:

Moderator: ooffick

Forum rules
Please use the mailing list here: rather than this forum.
Post Reply
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Thu Jan 18, 2018 7:36 pm

get the child of specific usergroup?

Post by saman2 » Mon Feb 05, 2018 5:23 pm

i want get the list of child id of parent joomla usergroup?
for example i have GroupA have GroupB and GroupC as a child, is there any php function to get id of Group B and C via GroupA id?
Last edited by toivo on Sun Apr 22, 2018 7:37 am, edited 1 time in total.
Reason: mod note: moved to 3.x Coding

Joomla! Guru
Joomla! Guru
Posts: 996
Joined: Thu Sep 24, 2009 5:40 pm
Location: Austin, TX, USA

Re: get the child of specific usergroup?

Post by jgress- » Mon Feb 05, 2018 5:31 pm

I suggest you post to the forum at viewforum.php?f=708. This forum is for Registered Joomla! User Groups which are groups of people that meet together in their local areas.

Mod: can you please move this to Joomla 3 administrator?

That said, you can find the IDs when you go to Users -> Groups and then the ID is in the far right column.
Co-author Using Joomla, Second Edition (migration/upgrade included)
Find a Joomla User Group (JUG) near you

User avatar
Joomla! Ace
Joomla! Ace
Posts: 1387
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas

Re: get the child of specific usergroup?

Post by stutteringp0et » Sun Apr 22, 2018 6:39 am

$parent_group_id = 2;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id')->from('#__usergroups')->where('parent_id = '.(int)$parent_group_id);
$children = $db->loadColumn();
// returns an array of group ids
My extensions: ... ails/18398
Honk if this signature offends you.

Post Reply

Return to “Joomla! 3.x Coding”