Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Oldiesmann on October 21, 2004, 09:29:18 PM

Title: Add More Post Icons
Post by: Oldiesmann on October 21, 2004, 09:29:18 PM
SMF has several fun message icons, but you've probably wondered how you can add your own. Turns out, it's really simple.

Step 1. Find any icons you want to add (preferably about the same size as the ones already used) and upload them to Themes/themename/images/post for every theme on your board.

Step 2. (optional) If you have multiple languages on your board and want to have the icon name translated for each language, add text strings to languages/Modification.language.php for every language in every theme where that file exists. If you don't care about having a properly translated icon name for each language or English is the only language on your board, you can skip this step. I recommend naming the strings something like $txt['file'] or $txt['icon_file'] just to make them easier to remember.

Step 3. Open up Sources/Post.php in a text editor and search for $context['icons'] - you should see the following array:

Code: [Select]
$context['icons'] = array(
array('value' => 'xx', 'name' => $txt[281]),
array('value' => 'thumbup', 'name' => $txt[282]),
array('value' => 'thumbdown', 'name' => $txt[283]),
array('value' => 'exclamation', 'name' => $txt[284]),
array('value' => 'question', 'name' => $txt[285]),
array('value' => 'lamp', 'name' => $txt[286]),
array('value' => 'smiley', 'name' => $txt[287]),
array('value' => 'angry', 'name' => $txt[288]),
array('value' => 'cheesy', 'name' => $txt[289]),
array('value' => 'grin', 'name' => $txt[293]),
array('value' => 'sad', 'name' => $txt[291]),
array('value' => 'wink', 'name' => $txt[292])
);

Just follow the pattern, like so:
Code: [Select]
$context['icons'] = array(
array('value' => 'xx', 'name' => $txt[281]),
array('value' => 'thumbup', 'name' => $txt[282]),
array('value' => 'thumbdown', 'name' => $txt[283]),
array('value' => 'exclamation', 'name' => $txt[284]),
array('value' => 'question', 'name' => $txt[285]),
array('value' => 'lamp', 'name' => $txt[286]),
array('value' => 'smiley', 'name' => $txt[287]),
array('value' => 'angry', 'name' => $txt[288]),
array('value' => 'cheesy', 'name' => $txt[289]),
array('value' => 'grin', 'name' => $txt[293]),
array('value' => 'sad', 'name' => $txt[291]),
array('value' => 'wink', 'name' => $txt[292]),
array('value' => 'icon', 'name' => 'My custom icon'),
array('value' => 'anothericon', 'name' => $txt['anothericon'])
);

Just remember that "value" must be the same as the filename (without the .gif extension).

Upload the modified Post.php to your Sources directory and enjoy.
Title: Re: Add More Post Icons
Post by: A.M.A on October 22, 2004, 11:17:24 AM
Great tip .. it will surely solve lots of requests.
Title: Re: Add More Post Icons
Post by: Oldiesmann on October 25, 2004, 10:26:02 AM
There are also a couple mods on Grudge's package server to add an interface to do this... :)
Title: Re: Add More Post Icons
Post by: seenitall on January 04, 2006, 08:57:19 PM
Hi have tried to add post icons as discribed in earlier posts , but I only got the first icon addition working , it adds the name of the icon to the drop down list but the image won't appear , any suggestions.

$context['icons'] = array(
      array('value' => 'xx', 'name' => $txt[281]),
      array('value' => 'thumbup', 'name' => $txt[282]),
      array('value' => 'thumbdown', 'name' => $txt[283]),
      array('value' => 'exclamation', 'name' => $txt[284]),
      array('value' => 'question', 'name' => $txt[285]),
      array('value' => 'lamp', 'name' => $txt[286]),
      array('value' => 'smiley', 'name' => $txt[287]),
      array('value' => 'angry', 'name' => $txt[288]),
      array('value' => 'cheesy', 'name' => $txt[289]),
      array('value' => 'grin', 'name' => $txt[293]),
      array('value' => 'sad', 'name' => $txt[291]),
      array('value' => 'wink', 'name' => $txt[292]),
                                array('value' => 'blushing', 'name' => 'blushing'),
                                array('value' => 'cowboy', 'name' => 'cowboy'),
                                array('value' => 'crying', 'name' => 'crying'
Title: Re: Add More Post Icons
Post by: odradeck on February 21, 2006, 05:06:07 AM
Hi Seenitall,

when I modified the icon list, i first added a record to the <prefix>_message_icons table, where the ID, Title, filename and iconOrder is given relative to the standard icon folder.
This way worked for me.
Title: Re: Add More Post Icons
Post by: Vinspire on May 20, 2006, 01:33:01 PM
There are also a couple mods on Grudge's package server to add an interface to do this... :)

Whats the mod name ? I am interested in having the same "solve" icon like SMF Forum.

Tried the modified instruction and it is working great  ;D ;D ;D
Title: Re: Add More Post Icons
Post by: Vinspire on May 27, 2006, 12:20:08 AM
Is it possible to edit this code ?

Code: [Select]
$context['icons'] = array(
array('value' => 'xx', 'name' => $txt[281]),
array('value' => 'thumbup', 'name' => $txt[282]),
array('value' => 'thumbdown', 'name' => $txt[283]),
array('value' => 'exclamation', 'name' => $txt[284]),
array('value' => 'question', 'name' => $txt[285]),
array('value' => 'lamp', 'name' => $txt[286]),
array('value' => 'smiley', 'name' => $txt[287]),
array('value' => 'angry', 'name' => $txt[288]),
array('value' => 'cheesy', 'name' => $txt[289]),
array('value' => 'grin', 'name' => $txt[293]),
array('value' => 'sad', 'name' => $txt[291]),
array('value' => 'wink', 'name' => $txt[292])
);

I dont really use the cheesy, grin, wink icons. wanted to replace with other icons. tried renaming it but end up having an error.
Title: Re: Add More Post Icons
Post by: Stuart on July 08, 2006, 07:56:58 PM
This works great, thanks a lot as I just added 3 Post Icons :D
Title: Re: Add More Post Icons
Post by: Spidy on August 03, 2006, 09:02:06 AM
is it possible to do similar to this to add more smiley's to the existing ones?

there arent many and the forum i've put up is an offshoot of an already established 'wap' site and we'd loke to put the same smile's on the forum as the wap version...

any help would be appreciated thanks...
Title: Re: Add More Post Icons
Post by: Stuart on August 04, 2006, 11:53:17 AM
is it possible to do similar to this to add more smiley's to the existing ones?

there arent many and the forum i've put up is an offshoot of an already established 'wap' site and we'd loke to put the same smile's on the forum as the wap version...

any help would be appreciated thanks...

Basically it's a lot easier to add smilies to the existing ones. If you're logged in as an Admin you just go to: Admin ==> Smileys and Smiley Sets ==> Add Smiley  ;D
Title: Re: Add More Post Icons
Post by: RebelRose on August 05, 2006, 11:44:42 PM
You can change or add to your post icons the same way, by going into the admin area and clicking on

Smileys and Message Icons


1.1 RC2
Title: Re: Add More Post Icons
Post by: Vinspire on April 07, 2008, 12:10:58 AM
Uses this codes on SMF 1.1.4 and it work like charms ! :)
Title: Re: Add More Post Icons
Post by: ilovegames on April 09, 2008, 06:01:30 PM
I can not for the life of me add new post icons. Keeps saying
not found make sure it's in default. It is!

Any suggestions?

1.1.4
Title: Re: Add More Post Icons
Post by: Sarge on April 20, 2008, 02:47:24 AM
I can not for the life of me add new post icons. Keeps saying
not found make sure it's in default. It is!

Can you tell us what you have done so far, step by step? Have you modified the code for $context['icons'] in Post.php?
Title: Re: Add More Post Icons
Post by: ilovegames on April 20, 2008, 10:57:30 AM
I can not for the life of me add new post icons. Keeps saying
not found make sure it's in default. It is!

Can you tell us what you have done so far, step by step? Have you modified the code for $context['icons'] in Post.php?

Thanks Sarge, I figured it out. I was a goof! lol
Title: Re: Add More Post Icons
Post by: jhfc on June 14, 2008, 11:16:51 PM
post icons can be added/modified in the admin panel isn't it? under Smileys and Message Icons. Or is it another post icon you guys are referring to?
Title: Re: Add More Post Icons
Post by: DistantJ on June 19, 2008, 09:42:00 AM
There are also a couple mods on Grudge's package server to add an interface to do this... :)

Where can I find this package server?
Title: Re: Add More Post Icons
Post by: Sarge on July 05, 2008, 07:03:03 AM
There are also a couple mods on Grudge's package server to add an interface to do this... :)

Where can I find this package server?

The reply you quoted is almost 4 years old... Grudge's package server is not available anymore.

You need to know how to write mods in order to package this tip/trick as a mod.
Title: Re: Add More Post Icons
Post by: Stuart on November 29, 2008, 11:31:46 AM
I have been adding various post icons for a couple of years now and was actually wondering if I can put restrictions on them? E.g. the 'solved' icon on our forum is only used by crew members. How can we stop making some of these visible for all members? Cheers!
Title: Re: Add More Post Icons
Post by: Eliana Tamerin on December 25, 2008, 09:49:11 PM
I have been adding various post icons for a couple of years now and was actually wondering if I can put restrictions on them? E.g. the 'solved' icon on our forum is only used by crew members. How can we stop making some of these visible for all members? Cheers!

I think that would be more of a mod request.
Title: Re: Add More Post Icons
Post by: mgk on December 29, 2008, 02:26:32 PM
I love icons, I'll give it a try. Thanks for the post and explaining.
Title: Re: Add More Post Icons
Post by: DVC on April 14, 2011, 07:40:11 PM
Step 1. Find any icons you want to add (preferably about the same size as the ones already used) and upload them to Themes/themename/images/post for every theme on your board.

I'm trying to add 8 new icons that I have made, as an alternative to having 8 separate low use forums. As too many forums just means we can never remember where a post was made. However, I'm stuck on Step 1. Exactly how do I upload the icons?

p.s. It would be so much easier if we could add icons the same way we add smileys. I don't really get why no one has made this mod after Grudge's one stopped being available.
Title: Re: Add More Post Icons
Post by: DVC on April 17, 2011, 07:59:58 AM
Step 1. Find any icons you want to add (preferably about the same size as the ones already used) and upload them to Themes/themename/images/post for every theme on your board.

I'm trying to add 8 new icons that I have made, as an alternative to having 8 separate low use forums. As too many forums just means we can never remember where a post was made. However, I'm stuck on Step 1. Exactly how do I upload the icons?

p.s. It would be so much easier if we could add icons the same way we add smileys. I don't really get why no one has made this mod after Grudge's one stopped being available.

Ok I've added the icons to the right directory, but now I'm stuck again. I can't find the specified code in Post.php And when I try to add icons through the web menu all I get is an error that they can't be found. But they are in the same directory as the icons that are already there! Please help.

Edit: The error I am getting when I try and add new Icons is "An Error Has Occurred!
The icon image could not be found in the default theme - please ensure the image has been uploaded and try again."

But I've uploaded the image. It's in /Themes/default/images/post
Title: Re: Add More Post Icons
Post by: abraamz on May 27, 2011, 03:32:21 AM
If you try this in smf 2.0 there is an easy way:
http://www.your-forum-url-here.com/index.php?action=admin;area=smileys;sa=editicons;
Do change www.your-forum-url-here.com with your url.
Title: Re: Add More Post Icons
Post by: MrNicotine on November 06, 2011, 06:28:00 PM
This is a great link, Abraamz, and I just used it. Great!

But when I try to enter it again, I can't find it in admin?
I'm in Admin->Forum->smiley's and Icons, but I can't find this option.

I now have the link as a favorite in my browser, that works offcourse, but this is not how it should be.
Anyone a tip?