3
Mithrandir and I recently had a discussion about this. XoopsUser::getGroups returns an array of group
IDs. Since you want the group
names, you would need to get an array of group
objects, and then get the names using an object method:
$member_handler =& xoops_gethandler('member');
$groups = $member_handler->getGroupsByUser($xoopsUser->getVar('uid'),[color=ff0000]true[/color]);
echo 'You are in the following groups:
';
foreach ($groups as $group) {
echo $group->getVar('name') . '
';
}
Note the second parameter (
asobject) to XoopsMemberHandler::getGroupsByUser. That parameter has to be specified as
true to get an array of objects. XoopsUser::getGroups calls XoopsMemberHandler::getGroupsByUser with the second parameter omitted, and that parameter defaults to
false, which is why XoopsUser::getGroups returns an array of IDs, not objects.