View Full Version : What am I doing wrong?
LanciaStratos
12-13-2001, 10:21 PM
I'm trying to create a hack which displays member's avatars in memberlist.php. So, in memberlist.php, where it says this...
if ($userinfo[receivepm]) {
eval("\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
} else {
$userinfo[pmlink] = " ";
}
eval("\$userinfo[profile] = \"".gettemplate("postbit_profile")."\";");
...I changed it to this...
if ($userinfo[receivepm]) {
eval("\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
} else {
$userinfo[pmlink] = " ";
}
if ($userinfo[avatar]) {
eval("\$userinfo[avatar] = \"".gettemplate("postbit_avatar")."\";");
} else {
$userinfo[avatar] = " ";
}
eval("\$userinfo[profile] = \"".gettemplate("postbit_profile")."\";");After I uploaded the new memberlist.php, I edited my memberlistbit template, and stuck $userinfo[avatar] where I wanted the avatar to show up. But, nothing happened! Can anyone show me what I did wrong here? :stupid:
hmm im not sure why but maybe try to use a variable w/o array
ie $avatar
and are u sure $userinfo[avatar] is actually the avatar?
try this:
$theavatar=getavatarurl($bbuserinfo[userid]);
if ($theavatar!='') {
eval("\$userinfo[avatar] = \"".gettemplate("postbit_avatar")."\";");
} else {
$theavatar = " ";
}
eval("\$userinfo[profile] = \"".gettemplate("postbit_profile")."\";");
Admin
12-14-2001, 10:56 AM
$avatarurl=getavatarurl($userinfo[userid]);
if ($avatarurl!='') {
eval("\$userinfo[avatar] = \"".gettemplate("postbit_avatar")."\";");
} else {
$userinfo[avatar] = " ";
}
eval("\$userinfo[profile] = \"".gettemplate("postbit_profile")."\";");
$bbuserinfo is the info of the user viewing the page.
And avatarurl because that's what postbit_avatar uses.
Admin
12-14-2001, 11:08 AM
Also using getavatarurl() adds an extra query whenever its run, so in a list with lots of members the page will really slow down.
Anyway, here's how you do it.
In memberlist.php, add this:
if ($userinfo[avatarid]!=0) {
$avatarurl=$userinfo[avatarpath];
} else {
if ($userinfo[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?userid=$userinfo[userid]&dateline=$userinfo[avatardateline]";
} else {
$avatarurl="";
}
}
if ($avatarurl=="" or ($bbuserinfo[userid]>0 and !($bbuserinfo[showavatars]))) {
$userinfo[avatar]="";
} else {
eval("\$userinfo[avatar] = \"".gettemplate("postbit_avatar")."\";");
}
right after this:
if ($userinfo[homepage]!="" and $userinfo[homepage]!="http://") {
Now replace this:
$users=$DB_site->query("SELECT *
FROM user,userfield
with this:
$users=$DB_site->query("SELECT *,avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline
FROM user,userfield
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
And now place $userinfo[avatar] in the memberlist template.
LanciaStratos
12-15-2001, 02:58 PM
Oh, that's perfect, FireFly! Thanks for helping out a PHP-newbie! :)
HellRazor
03-23-2002, 10:31 PM
This doesn't seem to display custom avatars tho... can anyone post a mod that will allow this to show them?
LanciaStratos
03-23-2002, 10:41 PM
[QUOTE]Originally posted by HellRazor
This doesn't seem to display custom avatars tho... can anyone post a mod that will allow this to show them?
svoec
04-06-2002, 12:09 AM
OK, i'm probably going to get smacked down for asking a stupid question, but where do you put $userinfo[avatar] in the template???
Thanks :cheeky: h
Eric C
LanciaStratos
04-06-2002, 03:51 PM
[QUOTE]Originally posted by svoec
OK, i'm probably going to get smacked down for asking a stupid question, but where do you put $userinfo[avatar] in the template???
Thanks :cheeky: h
Eric C
svoec
04-06-2002, 04:51 PM
that worked great, I was trying to edit the wrong template.
only problem is, it throws the columns off one row. Did I miss something?? or do I need to change another template??
Thanks again!
Eric C
svoec
04-06-2002, 07:00 PM
I tinkered a bit and found where you change the rows (memberlist template)
Sorry for being such a newbie, I have been running VB for a total of 4 days now!! :)
Thanks LanciaStratos !!
Eric
LanciaStratos
04-06-2002, 09:09 PM
[QUOTE]Originally posted by svoec
I tinkered a bit and found where you change the rows (memberlist template)
Sorry for being such a newbie, I have been running VB for a total of 4 days now!! :)
Thanks LanciaStratos !!
Eric
geniuscrew
04-30-2002, 01:14 PM
it looks as if it's only showing up for people with website URLs in their profiles :-/
LanciaStratos
04-30-2002, 08:09 PM
[QUOTE]Originally posted by geniuscrew
it looks as if it's only showing up for people with website URLs in their profiles :-/
Boofo
06-04-2002, 10:07 AM
I am having a problem with all of the avatars showing up in the listing. I have a few of them showing up but there are more that don't show up. Can anyone please tell me why some will show up and some will not? I followed Chen's code just like he wrote it.
LanciaStratos
06-04-2002, 05:35 PM
[QUOTE]Originally posted by Boofo
I am having a problem with all of the avatars showing up in the listing. I have a few of them showing up but there are more that don't show up. Can anyone please tell me why some will show up and some will not? I followed Chen's code just like he wrote it.
Boofo
06-04-2002, 05:44 PM
Not all of the users in the list have avatars. But the listing only showed about half of the avatars that I know for a fact are there. I have them listed in the profiles and they all show up there (if the users have them) fine. :)
[QUOTE]Originally posted by LanciaStratos
Are you sure that all of the users in the list have actually set avatars?
chad777
09-08-2002, 09:47 PM
Hey when I added that code
to add the avatar to teh memberlist it made it where
$userinfo[userid] would not work on memberlist
meaning the name in memberlist link to profile would not select userid it would just be = instead of =userid (=34) at the end of teh url to profile.
Also it would not let select a userid for search post eithier
irn-bru
01-19-2003, 08:40 PM
[QUOTE]Originally posted by Boofo
Not all of the users in the list have avatars. But the listing only showed about half of the avatars that I know for a fact are there. I have them listed in the profiles and they all show up there (if the users have them) fine. :)
sabret00the
03-02-2003, 10:30 AM
just added this, but for some reason it only shows half the av's 0_o
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.