Sometimes we need to have names of groups instead of an array of groupid.
we can have a function in kernel/user.php like this:
[code]
function &getGroupsName()
{
$group_names= array();
$member_handler =& xoops_gethandler('member');
$usergroups =& $member_handler->getGroupsByUser($this->getVar('uid'), true);
foreach ($usergroups as $group) {
$group_names[] = $group->getVar('name');
}
return $group_names;
}
[/code]
then we can use like this:
$XoopsUser -> getGroupsName(); //in 2.5.5
$xoops -> user ->getGroupsName(); // in 2.6.0
I'm not sure we need another method for this since it can be accomplished using current methods. If a new method is created then the code in XOOPS 2.6 could be much simpler than example above.
$member_handler =& xoops_gethandler('member');
$group_names = $member_handler->getGroupList(new Criteria('uid', $GLOBALS['xoopsUser']->uid()));