21
mjoel
Re: Random Member ... ?
  • 2007/11/14 15:17

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


$member_handler xoops_gethandler('member');
$criteria = new CriteriaCompo(new Criteria('level''0''>'));
$criteria->setSort('RAND()');
$criteria->setLimit(10);
$users $member_handler->getUserList($criteria);
foreach (
$users as $uid => $uname) {
    echo 
".XOOPS_URL."/userinfo.php?uid=".$uid."'>".$uname."";
}


can someone help me to update this code to include avatar

22
mjoel
Re: Random Member ... ?
  • 2007/11/15 3:22

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


Bingo !!

global $xoopsDB;
$sql "SELECT uid, uname, user_avatar  FROM ".$xoopsDB->prefix("users")." WHERE level > 0 AND uid NOT IN (1) AND user_avatar <> 'blank.gif' ORDER BY RAND() LIMIT 10";
$result $xoopsDB->query($sql);
while (list(
$uid$uname,$user_avatar) = $xoopsDB->fetchRow($result) )
{
echo 
".$user_avatar."'alt='Avatar'>";
echo 
".XOOPS_URL."/userinfo.php?uid=".$uid."'>".$uname."";
}


admin is not included - uid NOT IN (1)
user with no avatar not included - user_avatar <> 'blank.gif'
show 10 random user RAND() LIMIT 10

23
antifmradio
Re: Random Member ... ?

Quote:

mjoel wrote:
Bingo !!

global $xoopsDB;
$sql "SELECT uid, uname, user_avatar  FROM ".$xoopsDB->prefix("users")." WHERE level > 0 AND uid NOT IN (1) AND user_avatar <> 'blank.gif' ORDER BY RAND() LIMIT 10";
$result $xoopsDB->query($sql);
while (list(
$uid$uname,$user_avatar) = $xoopsDB->fetchRow($result) )
{
echo 
".$user_avatar."'alt='Avatar'>";
echo 
".XOOPS_URL."/userinfo.php?uid=".$uid."'>".$uname."";
}


admin is not included - uid NOT IN (1)
user with no avatar not included - user_avatar <> 'blank.gif'
show 10 random user RAND() LIMIT 10


this works really well for me
ill adjust the Quantity of listed members but

how can i allow ADMIN to show up?

Login

Who's Online

213 user(s) are online (84 user(s) are browsing Support Forums)


Members: 0


Guests: 213


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits