LPH
Well-known member
I'm rebuilding a function to grab the usergroups. This appears to work but I am wondering if this is optimal.
PHP:
function xenwordGetUGIds() {
$idArr = array();
if ( class_exists( '\XF' ) ) {
$groupRepo = \XF::app()->repository('XF:UserGroup');
$usergroups = $groupRepo->finder('XF:UserGroup');
foreach ( $usergroups as $usergroup ) {
$id = $usergroup['user_group_id'];
$title = $usergroup['title'];
$idArr[ $id ] = $title;
}
asort( $idArr );
return $idArr;
}
}