1
yingzhao
Get a list of users by the group name
  • 2009/3/9 16:24

  • yingzhao

  • Just popping in

  • Posts: 45

  • Since: 2008/5/12


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.

<?php
include_once("../../mainfile.php");
include_once(XOOPS_ROOT_PATH."/header.php");
?>

<?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.'<br>'; //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;
}
?>

<?php
include_once(XOOPS_ROOT_PATH."/footer.php");
?>

2
trabis
Re: Get a list of users by the group name
  • 2009/3/9 18:37

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Well, that is just a function and nothing is supposed to happen.

Maybe you need to call the function to have some output, correct?

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!