Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

How to Calll Users Avatar

Asked Modified Viewed 1,131 times
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
  • Started this discussions
asked
Fusioneer

I want to make a Panel that shows the user who is logged in there Avatar, what is the code I can insert into a new panel so it will show the person who is logged in there avatar?

Thanks
Craig
0 replies

6 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
  • Started this discussions
answered
Fusioneer

Thank you very very much Sveinungs that is perfect. Thank you so much your cookie I baked for you should arive in your inbox soon. lol
0 replies
S
Sveinungs
S
  • Veteran Member, joined since
  • Contributed 935 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

Or you can do it like this:
openside("name");
echo "<div style='font-weight:bold;'>";
echo " <script type='text/javascript'>
      var today = new Date()
      var hour = today.getHours()
      if (hour > 17) {document.write('Good Evening ')}
      if (hour >= 6 && hour <= 11) {document.write('Good Morning ')}
      if (hour >= 12 && hour <= 17) {document.write('Good Afternoon ')}
      if (hour >= 0 && hour <6) {document.write('Good Morning ')}
      </script>".(iMEMBER ? $userdata['user_name'] : "Guest")."<br />Welcome to Fangree Space! <br />";
echo "</div>";     

if (iMEMBER){
echo "<p style='text-align:center;'>";
echo ($userdata['user_avatar'] ? "<a href='".BASEDIR."profile.php?lookup=".$userdata['user_id']."'><img src='".IMAGES."avatars/".$userdata['user_avatar']."' border='0' alt='Avatar' /></a>" : "<a href='".BASEDIR."profile.php?lookup=".$userdata['user_id']."'><img src='".THEME."images/no_avatar.gif' border='0' /></a>");
echo "</p>";
}

closeside();


//Remeber to declare a script type for you JS.
Edited by Sveinungs on 17-07-2008 11:41,
0 replies
S
satikas
S
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 31 threads in the forums
answered
Member

Try this, sorry i have no chance to test it atm:

openside("name");
if ($userdata['user_avatar']) {
        echo "<center><img src='images/avatars/".$userdata['user_avatar']."' width='100px' height='100px'></center>";
}else{ echo "<center><img src='images/avatars/noavatar.png' width='100px' height='100px'></center>";
}

";
echo " <script>
      var today = new Date()
      var hour = today.getHours()
      if (hour > 17) {document.write('<strong>Good Evening</strong>')}
      if (hour >= 6 && hour <= 11) {document.write('<strong>Good Morning</strong>')}
      if (hour >= 12 && hour <= 17) {document.write('<strong>Good Afternoon</strong>')}
      if (hour >= 0 && hour <6) {document.write('<strong>Good Morning</strong>')}
      </script> <strong><font class='greeting'>".(iMEMBER ? $userdata['user_name'] : "Guest")."</font> <br>Welcome to Fangree Space! <br>
";

closeside();
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
  • Started this discussions
answered
Fusioneer

Ok,

Here is the code for my Panel so far it includes a Welcome script and calls the username.

How do Insert code so it shows avatar to?

openside("name");
echo " <script>
      var today = new Date()
      var hour = today.getHours()
      if (hour > 17) {document.write('<strong>Good Evening</strong>')}
      if (hour >= 6 && hour <= 11) {document.write('<strong>Good Morning</strong>')}
      if (hour >= 12 && hour <= 17) {document.write('<strong>Good Afternoon</strong>')}
      if (hour >= 0 && hour <6) {document.write('<strong>Good Morning</strong>')}
      </script> <strong><font class='greeting'>".(iMEMBER ? $userdata['user_name'] : "Guest")."</font> <br>Welcome to Fangree Space! <br>
";

closeside();
0 replies
S
satikas
S
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 31 threads in the forums
answered
Member

if ($userdata['user_avatar'] && file_exists(IMAGES."avatars/".$data['user_avatar'])) {
        echo "<center><img src='".IMAGES."avatars/".$userdata['user_avatar']."' width='100px' height='100px'></center>";
}else{ echo "<center><img src='".IMAGES."main/noavatar.png' width='100px' height='100px'></center>";
}


I would insert it into php file and use it as panel content.
If you do that, dont forget the <?php ?> tags.
Edited by satikas on 17-07-2008 11:15,
0 replies
S
Sveinungs
S
  • Veteran Member, joined since
  • Contributed 935 posts on the community forums.
  • Started 3 threads in the forums
answered
Veteran Member

Try something like this:

echo ($userdata['user_avatar'] ? "<a href='".BASEDIR."profile.php?lookup=".$userdata['user_id']."'><img src='".IMAGES."avatars/".$userdata['user_avatar']."' border='0' alt='Avatar' /></a>" : "<a href='".BASEDIR."profi[mail][/mail]le.php?lookup=".$userdata['user_id']."'><img src='".THEME."images/no_avatar.gif' border='0' /></a>");


(Put an image called 'no_avatar.gif' in your images folder - that are shown if the user has not selected an avatar yet)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 6 posts
  • Votes 0 votes
  • Topic users 3 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet