News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Picture instead of Displayed Nick

Started by 1MileCrash, October 29, 2005, 08:43:56 AM

Previous topic - Next topic

1MileCrash

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:



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)



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
The only thing php can't do is tell you how much milk is left in the fridge.



dtm.exe

Very cool :).

* dtm.exe moves this to Tips and Tricks.

ufuk.exe

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.
www.34tr.com - Nostalgia Istanbul
www.jeepprojects.com - Jeep Projects

That's It Simple Machines Forum,
It just couldn't be simpler.

jkrlvgn

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

?

1MileCrash

yeah, just replace the group variable with the second larger block of code
The only thing php can't do is tell you how much milk is left in the fridge.



jkrlvgn

...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.

trenchteam

works great tip with 1.1RC2! Thanks!! CHECK OUT SHOYOROLL.com and look for my NAME! LOL ;D ;D ;D

Alan S

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 ,
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

Alan S

i've tryed varations of the code and i still cant get it right? any ideas anyone?
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

trenchteam

Try this below.  Be sure to name the gif the same as your user name or it wont work!
Look at this post.  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'

Alan S

nope still no image appearing , any more ideas? im using the tp_dilbertMC theme if it makes any dif
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

nokonium

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 .....



Alan S

and that would make it appear in place of the members name how???????
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

trenchteam

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"/

Alan S

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!!
Quote from: Eliana Tamerin on August 23, 2008, 04:10:10 PM
SMF 7 is where it gets good. That has time travel. You can go back and post before the guy who flamed you. :P

trenchteam

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

Assistance

~playing poker~

trenchteam

Can you post the code and the lines you find them in the display then. Thanks

Assistance

see the first post in this thread
I did exactly as it says
~playing poker~

trenchteam

I dont have some of the coding in my template. :(

Advertisement: