XF 2.2 fetch all groups

I'm trying to learn how to fetch all groups and then display in a widget. But unsure how to do, because i need to display all groups based on certain defined permission(s)?

Like:
You can use the usergroup repository for this purpose there are builtin functions there, look in Usergroup repository
this can be used to fetch the list of usergroups
\XF::repository('XF:UserGroup')->getUserGroupTitlePairs()
 
Top Bottom