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

  • liomj

  • Just popping in

  • Posts: 96

  • 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


le="color: #000000"><?php global $xoopsUser; echo $xoopsUser->getVar('name') . '<br />'; $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') . '<br />';


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: 96

  • 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: 96

  • Since: 2012/4/10


this is to show all users
le="color: #000000"><?php $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
le="color: #000000"><?php $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

Donat-O-Meter

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

Latest GitHub Commits