1
deka87
Xoops 2.5.3 Profile default avatar ussue
  • 2011/10/17 11:59

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


hi guys,

I use this script to display random users avatars in a block

global $xoopsDB;   
$sql "SELECT u.uid, u.user_avatar, u.uname  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 u.level > 0 AND user_avatar <> 'blank.gif' AND u.uid NOT IN (1) ORDER BY RAND()";  
$result $xoopsDB->query($sql12);     
while (list(
$uid$user_avatar$uname) = $xoopsDB->fetchRow($result))     
{     
    echo 
'XOOPS_URL '/userinfo.php?uid=' $uid '" title="' $uname '">XOOPS_URL '/uploads/' $user_avatar '" alt="Avatar"  class="mosh" />
'
}
...


this code has been brought up several times here.

it used to display user avatars only but since I upgraded to 2.5.3 with its latest Profile it displays default grey avatars along with uploaded avatars. how do I ged rid of default avatars in the block? thanks in advance

Resized Image
Mind anchors

2
zyspec
Re: Xoops 2.5.3 Profile default avatar ussue
  • 2011/10/17 15:59

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Can you look at the database at the 'users' table and see what 'user_avatar' is set to? It may be that they are not set to 'blank.gif' so the query includes them in the results. Make sure you check for trailing 'spaces'...

3
trabis
Re: Xoops 2.5.3 Profile default avatar ussue
  • 2011/10/17 18:43

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


global $xoopsDB;   
$sql "SELECT u.uid, u.user_avatar, u.uname  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 u.level > 0 AND user_avatar <> 'blank.gif' AND user_avatar <> 'avatar/blank.gif' AND u.uid NOT IN (1) ORDER BY RAND()";  
$result $xoopsDB->query($sql12);     
while (list(
$uid$user_avatar$uname) = $xoopsDB->fetchRow($result))     
{     
    echo 
'XOOPS_URL '/userinfo.php?uid=' $uid '" title="' $uname '">XOOPS_URL '/uploads/' $user_avatar '" alt="Avatar"  class="mosh" />
'
}
...


Use this. Not tested.

4
deka87
Re: Xoops 2.5.3 Profile default avatar ussue
  • 2011/10/18 4:37

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


@Trabis

I still have those avatars

@zyspec

user_avatar is set to blank.gif for users registered before the update and it is set to avatars/blank.gif for users registered after the update. I wonder if this thread makes sense from this point.
Mind anchors

5
trabis
Re: Xoops 2.5.3 Profile default avatar ussue
  • 2011/10/18 12:45

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


@deka, there was a typo in my code, it is not avatar/blank.gif, it is avatars/blank.gif:

global $xoopsDB;    
$sql "SELECT u.uid, u.user_avatar, u.uname  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 u.level > 0 AND user_avatar <> 'blank.gif' AND user_avatar <> 'avatars/blank.gif' AND u.uid NOT IN (1) ORDER BY RAND()";  
$result $xoopsDB->query($sql12);      
while (list(
$uid$user_avatar$uname) = $xoopsDB->fetchRow($result))      
{      
    echo 
'XOOPS_URL '/userinfo.php?uid=' $uid '" title="' $uname '">XOOPS_URL '/uploads/' $user_avatar '" alt="Avatar"  class="mosh" />
';  
}


6
deka87
Re: Xoops 2.5.3 Profile default avatar ussue
  • 2011/10/18 13:03

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


this one works! thanks!
Mind anchors

Login

Who's Online

384 user(s) are online (268 user(s) are browsing Support Forums)


Members: 0


Guests: 384


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