Author Topic: User avatar on index page  (Read 4734 times)

Offline ekfaysal

  • Jr. Member
  • **
  • Posts: 58
    • Email
User avatar on index page
« on: Aug 10, 2008, 01:08:19 »
Hi
i want to show the users avatar on the home page.
LIke if i m logged it,
it should display my user avatar too on home page.
anyway to to do this
« Last Edit: Jun 20, 2009, 05:50:39 by Bikken »

Offline Bikken

  • Administrator
  • Hero Member
  • *
  • Posts: 4030
  • I doubt that!
    • DzinerStudio
Re: User avatar on index page
« Reply #1 on: Aug 13, 2008, 02:01:20 »
Hi, open index.template file and find/replace:

Code: [Select]
   <div id="welcome">';
with:

Code: [Select]
   <div id="welcome">';
if(!empty($context['user']['avatar']))
echo '
<div class="ds-avatar">'.$context['user']['avatar']['image'].'</div>';

Then in style.css file, find/replace:

Code: [Select]
#welcome {
font-size: 1.0em;
color: #fff;
font-family: tahoma, sans-serif;
float: right;
padding: 25px 20px;
text-align: right;
}

with:

Code: [Select]
.ds-avatar {
float: right;
width: 65px;
height: 65px;
margin-left: 15px;
}

#welcome {
font-size: 1.0em;
color: #fff;
font-family: tahoma, sans-serif;
float: right;
padding: 25px 20px;
text-align: right;
width: 250px;
}
DzinerStudio Demos
http://demo.dzinerstudio.com

Get your own theme copy!
Browse Downloads | Become a Club Member

Offline ekfaysal

  • Jr. Member
  • **
  • Posts: 58
    • Email
Re: User avatar on index page
« Reply #2 on: Aug 13, 2008, 02:57:35 »
Thanks very much Bikken

i want display picture to move a bit (Picture is on the corner which doesnt look that good)
here is the screenshot


and hyperlink it to the profile of the respective user.
can u do that too please?

 

Offline Bikken

  • Administrator
  • Hero Member
  • *
  • Posts: 4030
  • I doubt that!
    • DzinerStudio
Re: User avatar on index page
« Reply #3 on: Aug 13, 2008, 03:55:14 »
Ok, try this....find and replace:

Code: [Select]
<div class="ds-avatar">'.$context['user']['avatar']['image'].'</div>';
with:

Code: [Select]
<div class="ds-avatar"><a href="', $scripturl, '?action=profile">'.$context['user']['avatar']['image'].'</a></div>';


Find/replace:

Code: [Select]
.ds-avatar {
float: right;
width: 65px;
height: 65px;
margin-left: 15px;
}

with:

Code: [Select]
.ds-avatar {
float: right;
margin-left: 15px;
}

.ds-avatar img {
width: 65px;
height: 65px;
}
DzinerStudio Demos
http://demo.dzinerstudio.com

Get your own theme copy!
Browse Downloads | Become a Club Member

Offline ekfaysal

  • Jr. Member
  • **
  • Posts: 58
    • Email
Re: User avatar on index page
« Reply #4 on: Aug 13, 2008, 10:36:06 »
thanks
it work like charm
Now looking more great

Offline Bikken

  • Administrator
  • Hero Member
  • *
  • Posts: 4030
  • I doubt that!
    • DzinerStudio
Re: User avatar on index page
« Reply #5 on: Aug 13, 2008, 10:55:20 »
Cool! Good to hear.
DzinerStudio Demos
http://demo.dzinerstudio.com

Get your own theme copy!
Browse Downloads | Become a Club Member

Offline balti

  • Jr. Member
  • **
  • Posts: 23
Re: User avatar on index page
« Reply #6 on: May 24, 2010, 14:12:07 »
Is thise modification posseble for smf 1.11 and rc3 version also ?
« Last Edit: May 24, 2010, 14:14:00 by balti »

Offline Bikken

  • Administrator
  • Hero Member
  • *
  • Posts: 4030
  • I doubt that!
    • DzinerStudio
Re: User avatar on index page
« Reply #7 on: May 27, 2010, 01:28:16 »
Yes, it should work for both versions.
DzinerStudio Demos
http://demo.dzinerstudio.com

Get your own theme copy!
Browse Downloads | Become a Club Member

Offline balti

  • Jr. Member
  • **
  • Posts: 23
Re: User avatar on index page
« Reply #8 on: Oct 30, 2010, 00:12:33 »
I can not find thise code in index.template.php of silentwave template 2.0RC3 Ver.

Code: [Select]
      <div id="welcome">';

Offline Bikken

  • Administrator
  • Hero Member
  • *
  • Posts: 4030
  • I doubt that!
    • DzinerStudio
Re: User avatar on index page
« Reply #9 on: Oct 30, 2010, 00:41:35 »
It should be userinfo instead of welcome.
DzinerStudio Demos
http://demo.dzinerstudio.com

Get your own theme copy!
Browse Downloads | Become a Club Member

Offline Kraha

  • Jr. Member
  • **
  • Posts: 19
    • Email
Re: User avatar on index page
« Reply #10 on: Nov 01, 2010, 04:57:10 »
So what I must to edit in index.template.php to have the avatar od index?

Offline Kraha

  • Jr. Member
  • **
  • Posts: 19
    • Email
Re: User avatar on index page
« Reply #11 on: Nov 02, 2010, 03:39:52 »
bump

Offline Chair

  • Hero Member
  • *****
  • Posts: 861
  • I'm a Yes-Man.
    • Brosquad
    • Email
Re: User avatar on index page
« Reply #12 on: Nov 02, 2010, 05:08:06 »
Hello Kraha,

The changes you need to make are the following:

In index.template.php

Find:
Code: [Select]
   <div id="userinfo">';
Replace with:
Code: [Select]
   <div id="userinfo">';
if(!empty($context['user']['avatar']))
echo '
<div class="ds-avatar"><a href="', $scripturl, '?action=profile">'.$context['user']['avatar']['image'].'</a></div>';

Now, in index.css

Find:
Code: [Select]
#userinfo {
font-size: 1.0em;
color: #fff;
font-family: tahoma, sans-serif;
float: right;
padding: 25px 20px;
text-align: right;
}

Replace with:
Code: [Select]
.ds-avatar {
float: right;
margin-left: 15px;
}

.ds-avatar img {
width: 65px;
height: 65px;
}

#userinfo {
font-size: 1.0em;
color: #fff;
font-family: tahoma, sans-serif;
float: right;
padding: 25px 20px;
text-align: right;
width: 250px;
}


That should sort you out.  :thumbup:


Some people deserve a high five once in a while....in the face... with an ARG
(see what I did there?)

Offline Kraha

  • Jr. Member
  • **
  • Posts: 19
    • Email
Re: User avatar on index page
« Reply #13 on: Nov 03, 2010, 04:10:02 »
Thanks for help, but I do it myself :P

Offline iainsherriff

  • Newbie
  • *
  • Posts: 7
    • Email
Re: User avatar on index page
« Reply #14 on: Apr 10, 2012, 07:30:10 »
 :welcome:

Hello. Long time since I have posted. I know this is an old topic but it covers my problem, so................

I have the Avatar as described above along with my forum header. The text looks messy and I cant work out how to move it. It would look better if the text was aligned below the Avatar, unless anyone has a better idea  ;)

How can I do this please ? See link...............

http://uklows.com/forum/


....... a day later realised of course you cant see it as your not registered !

string of night shifts in the way now  ???
« Last Edit: Apr 11, 2012, 12:22:16 by iainsherriff »