1
Hi all,
I have a code snippet, which returns a list of users belongs to a given group, works perfectly fine in XOOPS 2.0.18.1. However, after I installed XOOPS 2.3.2b and installed my application on this new XOOPS as a module, my application does not return me the list of users anymore. I have not changed my source code, and I have the mainfile.php, header.php and footer.php included in my php. I also checked the source code in the System module, system/admin/groups/main.php, and could not figure out why similar function works in the system module but not in my module. If someone could shed some lights, I would deeply appreciate it.
Here is my source code.
include_once("../../mainfile.php");
include_once(XOOPS_ROOT_PATH."/header.php");
?>
function review_getUsersByGroup($grpname){
$mem_hld = &xoops_gethandler('member');
$grps = $mem_hld->getGroupList();
$keys=array_keys($grps);
foreach($keys as $k){
echo 'groups:'.$k.'
'; //no result, suspect that array $keys is null
if($grps[$k]==$grpname) $grpid = $k;
}
$users = $mem_hld->getUsersByGroup($grpid,TRUE);
foreach($users as $user){
$vals[$user->uid()]=$user->uname();
}
return $vals;
}
?>
include_once(XOOPS_ROOT_PATH."/footer.php");
?>