From: SourceForge.net <no...@so...> - 2012-09-03 15:36:31
|
Feature Requests item #3561831, was opened at 2012-08-26 03:08 Message generated for change (Comment added) made by zyspec You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=430843&aid=3561831&group_id=41586 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: XOOPS 2.6 Status: Open Resolution: None Priority: 5 Private: No Submitted By: irmtfan (irmtfan) Assigned to: Nobody/Anonymous (nobody) Summary: return the groups names by $user -> getGroupsName() Initial Comment: 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 ---------------------------------------------------------------------- Comment By: zyspec (zyspec) Date: 2012-09-03 08:36 Message: 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())); ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=430843&aid=3561831&group_id=41586 |