PDA

View Full Version : Need help with piece of code "GREG"


mac27
03-02-2008, 12:06 PM
Hey I am trying to get it so that if a user has an avatar selected then it shows but if they don't then an avatar of my choice shows. This is not for in actual threads. It is for a meet our staff page.

Here is the php that I have.


<tr>
<td class="$bgclass">

<div style="padding: 2px; "><center><img src='image.php?u=$user[userid]' border='0' alt='$user[username]`s Avatar'></center></div>

<div><td class="$bgclass">
<a href="member.php?$session[sessionurl]u=$user[userid]" class="bigusername">$user[musername]</a> $user[onlinestatus]$user[usertitle]</div>


<div class="smallfont" title="Activity"><strong>Last Activity:</strong> $user[lastonline]</div>
<div class="smallfont" title="Location"><strong>$vbphrase[location_perm]:</strong> $user[field2]</div>

<div class="smallfont" title="User's Homepage"><strong>$user[username]'s Homepage:</strong>
<a href="$user[homepage]" target="_blank" dir="ltr">$user[homepage]</a></div>
<div class="smallfont" title="$user[username]'s Biography"><strong>Biography:</strong> <br> <textarea rows="3" cols="70"readonly="true">$user[field1]</textarea></div>

<if condition="$showforums">
<div class="smallfont">Forums $user[username] Maintains: &ensp;$user[forumbits]</div>
</if>
</td>
<td class="$bgclass" nowrap="nowrap">
<if condition="$show['pmlink']"><a href="private.php?$session[sessionurl]do=newpm&amp;u=$user[userid]" rel="nofollow"><img src="$stylevar[imgdir_button]/sendpm.gif" alt="<phrase 1="$user[username]">$vbphrase[send_private_message_to_x]</phrase>" border="0" /></a></if>
<br /><if condition="$show['emaillink']"><a href="sendmessage.php?$session[sessionurl]do=mailmember&amp;u=$user[userid]" rel="nofollow"><img src="$stylevar[imgdir_button]/email.gif" alt="<phrase 1="$user[username]">$vbphrase[send_message_via_email_to_x]</phrase>" border="0" /></a></if>
</td>


Any ideas?

Greg
03-02-2008, 12:52 PM
I have to look at the user table. I think there is an indicator you can use to decide what to do with. But I don't know it off hand. It's been done before, so it's not rocket science.

Greg
03-02-2008, 01:00 PM
OK, if you look at line 395 of member.php in vB 3.6.8 you will see how to do the avatar. It's pretty easy.

mac27
03-02-2008, 01:01 PM
Ok will have a look see at that, thanks.

Greg
03-02-2008, 01:06 PM
It's like 3 lines of code. You'll see the simplicity. Since I don't know how your custom page works, I really can't suggest how you might use it.

mac27
03-02-2008, 01:14 PM
OK i have tried this already.


<if condition= $show['avatar']"><img src='image.php?u=$user[userid]' border='0' alt='$user[username]`s Avatar'><else /><img src='link to my noavatar.gif' border='0' alt='$user[username]`s Avatar'></if>


It just shows the noavatar.gif avatar and not the one the user has chosen. Does that make since?

mac27
03-02-2008, 01:17 PM
Hmmmmmmmmmm I think it is because I am using 3.7 that maybe the code above doesn't work. The member.php file has none of the same code for avatars in it as for 3.6.8.

Greg
03-02-2008, 01:39 PM
Well, go figure. Let me see how they do it now.