11
deka87
Re: random users block
  • 2009/10/16 15:05

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


hm it doesn't work ghia.

here is my final code:

global $xoopsDB
$sql "SELECT u.uid, u.uname, u.user_avatar, p.source_language, p.target_language, p.country  FROM ".$xoopsDB->prefix("users")." u 
LEFT JOIN "
.$xoopsDB->prefix("groups_users_link")." g on u.uid = g.uid 
LEFT JOIN "
.$xoopsDB->prefix("profile_profile")." AS p ON u.uid=p.profile_id
WHERE g.groupid = 6 AND u.level > 0 AND u.uid NOT IN (1)  
ORDER BY RAND() LIMIT 1"

$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."";
echo 
"Working languages:".$source_language." to  ".$target_language." from ".$country."";
}


it does show the user but the source and target_language fields and the coutry field are not displayed.

12
ghia
Re: random users block
  • 2009/10/16 15:21

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You have to extend the list with the new variables.

13
deka87
Re: random users block
  • 2009/12/18 15:28

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


here is my final code:

global $xoopsDB;  
$sql "SELECT u.uid, u.uname, u.user_avatar, p.source_language, p.target_language, p.welcome  FROM ".$xoopsDB->prefix("users")." u, ".$xoopsDB->prefix("groups_users_link")." g, ".$xoopsDB->prefix("profile_profile")." p WHERE u.uid = g.uid AND u.uid = p.profile_id AND g.groupid = 6 AND u.level > 0 AND u.uid NOT IN (1) ORDER BY RAND()";  
$result $xoopsDB->query($sql5);    
while (list(
$uid$uname$user_avatar$source_language$target_language$welcome) = $xoopsDB->fetchRow($result))    
{    
    
$user_avatar = ($user_avatar != 'blank.gif') ? $user_avatar 'default_avatar.png'// default_avatar.png - ????????? ?????? 
  
echo 'XOOPS_URL '/uploads/' $user_avatar '" alt="Avatar" width="50" height="50" />
XOOPS_URL '/userinfo.php?uid=' $uid '">' $uname '
$source_language ' » 
$target_language '';
}


thanks guys. but i have one more thing. the code above shows 5 users. but it shows them in a column. how do i show them in a line? like 1-2-3-4-5

not

1
2
3
4
5

thanks in advance!

14
ghia
Re: random users block
  • 2009/12/18 15:43

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Don't use new lines
in your html.

15
deka87
Re: random users block
  • 2009/12/18 16:01

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


yeah but how do i put a username under the avatar then? i tried

and they arranged in a column again. tried with tables with the same result. i missed something?


16
deka87
Re: random users block
  • 2009/12/18 16:04

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


i want something like this (please take a look at the row of avatars at the top).

17
ghia
Re: random users block
  • 2009/12/18 16:35

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


if you look to the html source you see it is done with
  • link, image, name
  • ..
.
Positioning is done with display:block; and float:left for the li tags.

18
deka87
Re: random users block
  • 2009/12/18 16:48

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Quote:

Positioning is done with display:block; and float:left for the li tags.


that's right, ghia. it works now. thanks!

Login

Who's Online

319 user(s) are online (189 user(s) are browsing Support Forums)


Members: 0


Guests: 319


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