FrontendUser::getAvailableUserGroups()
\nn\t3::FrontendUser()->getAvailableUserGroups($returnRowData = false);
Return all existing user groups.
Returns an associative array, key is the uid, value is the title.
\nn\t3::FrontendUser()->getAvailableUserGroups();
Copied!
Alternatively, true can be used to return the complete data set for the user groups
can be returned:
\nn\t3::FrontendUser()->getAvailableUserGroups( true );
Copied!
| @return array
Source Code
public function getAvailableUserGroups( $returnRowData = false )
{
if (!($userGroupsByUid = $this->cache['userGroupsByUid'] ?? false)) {
$userGroups = \nn\t3::Db()->findAll('fe_groups');
$userGroupsByUid = \nn\t3::Arrays( $userGroups )->key('uid');
$userGroupsByUid = $this->cache['userGroupsByUid'] = $userGroupsByUid->toArray();
}
if ($returnRowData) {
return $userGroupsByUid;
}
return \nn\t3::Arrays($userGroupsByUid)->pluck('title')->toArray();
}
Copied!