1
liomj
Help with listing user of group with custom profile fields
  • 2013/8/7 2:17

  • liomj

  • Just popping in

  • Posts: 94

  • Since: 2012/4/10


Hi XOOPSers

Im a php and xoops newbie..

Im currently using XOOPS 2.5.5 and the profile module

I found this code here in the forum and modify it to show the current logged in user real name and custom user field (sex) created using the profile module


global $xoopsUser;  
echo 
$xoopsUser->getVar('name') . ''

$profile_handler =& xoops_getmodulehandler('profile','profile');
$uid intval($_GET['uid']); //get uid from url
if ($uid <= 0) { 
 if (
is_object($xoopsUser))  {//if member
        
$profile $profile_handler->get($xoopsUser->getVar('uid'));} //get uid for the connected member
        
else {
             
header('location: ' XOOPS_URL); //back to homepage - redirect wherever you want
             
exit();
             }
 }
else 
{
//$profile = $profile_handler->get($xoopsUser->getVar('uid'));  
$profile $profile_handler->get($uid);
}
echo 
$profile->getVar('Sex') . '';


the code works but now i would like to show username, real name and sex of all the user in a given group in a table

how do i do this..Thank you

2
liomj
Re: Help with listing user of group with custom profile fields
  • 2013/8/7 7:01

  • liomj

  • Just popping in

  • Posts: 94

  • Since: 2012/4/10


never mind.. i just use simple mysql select query

thank you

3
liomj
Re: Help with listing user of group with custom profile fields
  • 2013/8/7 7:35

  • liomj

  • Just popping in

  • Posts: 94

  • Since: 2012/4/10


this is to show all users
$result mysql_query("SELECT uid, name, uname,  user_avatar, last_login,profile_id, Sex  FROM ".$xoopsDB->prefix("profile_profile").",".$xoopsDB->prefix("users")." WHERE profile_id=uid ORDER BY name ASC");


How do i show user from groupid= 4 only ?

this is not working
$result mysql_query("SELECT uid, groupid, name, uname,  user_avatar, last_login,profile_id, Sex  FROM ".$xoopsDB->prefix("groups_users_link").",".$xoopsDB->prefix("profile_profile").",".$xoopsDB->prefix("users")." WHERE groupid=4 AND profile_id=uid ORDER BY name ASC");

4
mjoel
Re: Help with listing user of group with custom profile fields
  • 2013/8/7 12:20

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9



Login

Who's Online

347 user(s) are online (282 user(s) are browsing Support Forums)


Members: 0


Guests: 347


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