Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: 1MileCrash on October 29, 2005, 08:43:56 AM

Title: Picture instead of Displayed Nick
Post by: 1MileCrash on October 29, 2005, 08:43:56 AM
I saw someone requesting this, so here it is.

This will replace whatever user's name you choose with an image. This could be helpful if say you want the moderators name animated and in a rare font. Well, here you go.

Since this is NOT dynamicly driven, or anything like that, i highly reccomend you only do this for privliedge/staff/etc. members. members with a certain special group. (mods, admins, etc.)

This will only show in posts. meaning that if you view a member's profile, you'll see text, not your image.

The first thing you want to do, is create the images. make sure they are named the same as the username, since we're using ',$message['member']['name'],' to find the pic. This means capitalization, etc. I think members with special characters in there user name may mess this up, in that case, you can just make a seperate if.

now, upload those images wherever. I dont care. Just upload them all to the same place (and in your public_html dir). in our example, we'll use mine. http://model98.org/forum/Themes/site. JUst replace it with yours.

Here is my image:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg464.imageshack.us%2Fimg464%2F5916%2Fusername7zh.gif&hash=bd956acd79f6b91f2c87bb48afc2f489fb3e579c)

ok. we got ALL images, right? There all together? OK. Now, right down the member id of all of the members you made images for. You can find it by viewing their profile url.
http://model98.org/forum/index.php?action=profile;u=174

ok. now we're ready to actually do it.

open display.template.php, find
', $message['member']['link'], '

you need to replace that with this code, but you need to change it abit to suit your url to images and member id.

Quote';

// Display an image rather than username for certain members

$image_memberID = array(1, 4);

if(in_array($message['member']['id'], $image_memberID))
{
echo'<a href="model98.org/forum/index.php?action=profile;u=', $message['member']['id'], '"><img src="model98.org/forum/Themes/site/', $message['member']['name'], '.gif"/></a>';
}
else
{
echo' ', $message['member']['link'], '';
}

echo'

**http:// removed because it turned to a link and wont show color

you need to replace the blue numbers with the id of your members you made images for. (seperate them with a comma then space: 1, 2, 6, 7, 8). You need to replce the green with the link to your profile page. You can get this by copying the address of a members profile, and editing out the number. Lastly, you need to replce the red with the path to your member's images.

Let me know if you see anything wrong with it.

if you're still confused as to what this does, look at the screenshot below. ( i know my image-names or really crappy, just made them to show you guys)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg457.imageshack.us%2Fimg457%2F3858%2Fimageuser6ij.gif&hash=a5e46d23a7547018282288902aef515cef54c509)

if you're good with making graphics, you can make animated names, which would be realy cool, different fonts, and lots of other dynamic effects.

**tips and tricks board on validation
Title: Re: Picture instead of Displayed Nick
Post by: dtm.exe on October 29, 2005, 09:52:01 AM
Very cool :).

/me moves this to Tips and Tricks.
Title: Re: Picture instead of Displayed Nick
Post by: ufuk.exe on October 30, 2005, 05:09:30 PM
QuoteI saw someone requesting this, so here it is.


That was me, thank you so much, I will try this first thing tomorrow morning.

Thanks again.
Title: Re: Picture instead of Displayed Nick
Post by: jkrlvgn on July 07, 2006, 06:53:27 PM
Just out of curiousity, can this be done with membergroups too?  Not with the stars, but just where it'd say something like

Name
Group (only a pic instead of the text..)
Stars

?
Title: Re: Picture instead of Displayed Nick
Post by: 1MileCrash on July 07, 2006, 07:54:11 PM
yeah, just replace the group variable with the second larger block of code
Title: Re: Picture instead of Displayed Nick
Post by: jkrlvgn on July 07, 2006, 09:26:58 PM
...god knows I'd ****** it up.

Ok, PHPMasters....and...er...Tippmaster....

I'm a complete idiot on this kind of stuff....any chance you could explain it to me?  I tried to do it myself like...3 times...and...completely screwed things up.
Title: Re: Picture instead of Displayed Nick
Post by: trenchteam on July 10, 2006, 08:04:41 AM
works great tip with 1.1RC2! Thanks!! CHECK OUT SHOYOROLL.com and look for my NAME! LOL ;D ;D ;D
Title: Re: Picture instead of Displayed Nick
Post by: Alan S on July 10, 2006, 06:53:44 PM
it didnt make any difference for me? my names still in text?, this is the code i have

// Display an image rather than username for certain members

$image_memberID = array(1);

if(in_array($message['member']['id'], $image_memberID))
{
echo'<a href="theteenzone.net/forum/index.php?action=profile;u=1', $message['member']['id'], '"><img src="/forum/alans.gif', $message['member']['name'], '.gif"/></a>';
}
else
{
echo' ', $message['member']['link'], '';
}

echo'


its placed below

// Show information about the poster of this message.
echo '
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="top" width="16%" rowspan="2" style="overflow: hidden;">



and above

<div class="smalltext">';

// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
', $message['member']['title'], '<br />';



any ideas what i did wrong? thanks ,
Title: Re: Picture instead of Displayed Nick
Post by: Alan S on July 11, 2006, 09:08:47 AM
i've tryed varations of the code and i still cant get it right? any ideas anyone?
Title: Re: Picture instead of Displayed Nick
Post by: trenchteam on July 12, 2006, 05:15:59 AM
Try this below.  Be sure to name the gif the same as your user name or it wont work!
Look at this post (http://www.shoyoroll.com/forum/index.php?topic=9128.0).  IT WORKS! I got it to work fairly with little problems 1.1rc2.

// Display an image rather than username for certain members

$image_memberID = array(1);

if(in_array($message['member']['id'], $image_memberID))
{
echo'<a href="http://www.theteenzone.net/forum/index.php?action=profile;u=', $message['member']['id'], '"><img src=http://www.theteenzone.net/forum/FOLDER YOU HAVE YOUR IMAGES"/', $message['member']['name'], '.gif"/></a>';
}
else
{
echo' ', $message['member']['link'], '';
}

echo'
Title: Re: Picture instead of Displayed Nick
Post by: Alan S on July 12, 2006, 09:20:12 AM
nope still no image appearing , any more ideas? im using the tp_dilbertMC theme if it makes any dif
Title: Re: Picture instead of Displayed Nick
Post by: nokonium on July 12, 2006, 12:48:52 PM
Can I suggest another option?

Well I'm going to anyways  ;)

Create the image(s) and add them as smilies, using the members name as the short code and setting the 'smilie' to hidden. This also means that you can have different versions of the graphic in different smilie sets, i.e. a 'nice' one and a 'rude' one  ;D

You can also use the swear filter to substitute a smilie short code for a members name .....
Title: Re: Picture instead of Displayed Nick
Post by: Alan S on July 12, 2006, 05:10:34 PM
and that would make it appear in place of the members name how???????
Title: Re: Picture instead of Displayed Nick
Post by: trenchteam on July 13, 2006, 12:43:35 AM
Dont know how to help you man. I did exactly what I explained to you and it worked great in my TP SMF site.  make sure it points to the folder where you have your images.  and your image names have to be exact! 

Ex.  my gif for this site has to be trenchteam.gif in the folder i place it in.

http://www.theteenzone.net/forum/FOLDER YOU HAVE YOUR IMAGES"/
Title: Re: Picture instead of Displayed Nick
Post by: Alan S on July 13, 2006, 09:12:38 AM
i foun dout what was wrong , i viewed the source code and it was requesting the wrong image , the link was after getting messed up so i removed the        ', $message['member']['name'], '      after the image link and it worked!! thanks for the help!!
Title: Re: Picture instead of Displayed Nick
Post by: trenchteam on April 04, 2007, 05:50:04 AM
Tipp, will you be updating this anytime soon?  You PM'ed me yesterday, but never got back to me with the coding changes.  Thanks again. ;D
Title: Re: Picture instead of Displayed Nick
Post by: Assistance on April 04, 2007, 07:27:58 AM
works with 1.1.2
Title: Re: Picture instead of Displayed Nick
Post by: trenchteam on April 05, 2007, 06:58:23 PM
Can you post the code and the lines you find them in the display then. Thanks
Title: Re: Picture instead of Displayed Nick
Post by: Assistance on April 07, 2007, 08:01:41 PM
see the first post in this thread
I did exactly as it says
Title: Re: Picture instead of Displayed Nick
Post by: trenchteam on April 08, 2007, 05:03:52 AM
I dont have some of the coding in my template. :(
Title: Re: Picture instead of Displayed Nick
Post by: metallica48423 on April 08, 2007, 05:44:19 PM
the coding does exist in the default template, i can't really assist with other templates, you'd need to contact the theme author.

But it should be there, elsewise i don't see how your membername links inside posts could be parsed properly, unless its simply showing just the member name.

Are you sure you're looking at Display.template.php and searching for
$message['member']['link']
Title: Re: Picture instead of Displayed Nick
Post by: pro2share on April 26, 2007, 07:52:11 PM
works gr8, it took me a while to get it.. but i got it
Title: Re: Picture instead of Displayed Nick
Post by: ProHax on January 06, 2012, 01:17:45 AM
is there an updated version?
Title: Re: Picture instead of Displayed Nick
Post by: johnscarbrough on January 10, 2012, 07:00:59 AM
I am new at this so very effective for me really