Post discussion

# Smiley JS Buttons

Posted: Jun 9, 2005, under WordPress, DHTML. Add a comment!

This WordPress plugin allows you to display all the smilies in the default WP set as images next to your comment field. When you click on one of them it appends the code needed to produce that smiley to the comment field.

You can add a comment:
Identify yourself here, or login.

(only seen by admins)
(optional) if you want people to visit


Smilies: (click to append)

87 comments

RSS2 feed for this discussion.

  1. Posted by germaine, on August 22, 2005, 13:45.

    Hi, I used your clickable smileys plugin on my site, but instead of displaying the smiley images it displays the text.. like : lol : instead of :lol:. Do you know how I can fix this? Thank you!

  2. Posted by Skippy, on August 22, 2005, 15:31.

    germaine: It must not pick up the correct path to the images. Look at the source of the page and see what URL it uses for the images. Then try to obtain that image via the browser location bar. See how the two differ, that may give you a clue.

    Use the latest version (1.1), 1.0 had a typo that may affect this.

    It's possible you have installed WP in a subdir and the plugin doesn't pick things up correctly. If all else fails, edit the plugin file and set $smilies_blog_url by hand to a proper path.

  3. Posted by germaine, on August 26, 2005, 06:10.

    Thanks for that, version 1.1 fixed the problem :)

  4. Posted by LeonDerProfi, on August 26, 2005, 18:16.

    Hi,
    i want to implement the smilie tollbar into my guestbook form, but when I use the function, the smilies won't be insert into the textarea.
    What do I wrong?
    Greetings

  5. Posted by Skippy, on August 27, 2005, 02:20.

    LeonDerProfi: See the instructions, under "Using the plugin". By default, the function expects the textarea to be called "comment". Make sure the textarea tag has a name attribute and pass the right name to the function (don't forget to use quotes).

  6. Posted by LeonDerProfi, on August 27, 2005, 05:09.

    Hi,
    i tried it before like in your example above, but it doesn't works.
    Here is my code:

    <?php if (function_exists('SJB_outputSmilies')) {SJB_outputSmilies('comment');} ?><br />
    <p><textarea name="comment" id="comment" cols="80" rows="10" tabindex="4"></textarea></p>

    What could be the problem?

  7. Posted by Skippy, on August 27, 2005, 15:18.

    LeonDerProfi: add an alert() next to the call to the function and see if it pops up. Try loading your page in Mozilla or Firefox and look at the JS console debugger for clues. Check again if you really activated the plugin, sometimes I copy a plugin but forget to activate it. :blush:

  8. Posted by LeonDerProfi, on August 27, 2005, 21:31.

    Yes, it is activated, because i already use this script for the comments in the blog. I don't know what you mean with the alert() function, because I habe no experience with PHP. But I tested the site with the js debugger an got many errors like that:
    SJB_appendSmiley is not defined or some syntax errors. Maybe you can test the site by yourself and see what kinds of error there are:
    http://www.arkadius-tencar.com/?page_id=22

    I also looked up the comments template, but there's the code the same like in the guestbook and I have no problems with the comments…

  9. Posted by Skippy, on August 27, 2005, 22:45.

    LeonDerProfi: For some reason you seem to have <br> tags inside the JavaScript code. This blows up the definition of the function so when smilies are clicked they have nothing to trigger. I'm guessing something is applying nl2br() over the output of the PHP function SJB_outputSmilies().

  10. Posted by LeonDerProfi, on August 28, 2005, 04:52.

    ok, and what could I do now to solve that problem? :?

  11. Posted by Skippy, on August 28, 2005, 15:32.

    LeonDerProfi: I'm afraid I don't know what is producing that effect. It has never happened to me. Search the files in your template for "nl2br", perhaps you'll find a clue. Maybe it's an editor or authoring tool you're using. Maybe it's another plugin's fault.

    Here's a workaround. Edit the SJB plugin file. Take everything inside the <script></script> tags (without the tags!) and put them in another text file somewhere on your website, such as /sjb.txt. Then in their former place put the following:

    <script type="text/JavaScript" src="/sjb.txt"></script>

    Hopefully, this will cause the JavaScript code to escape the evil nl2br().

  12. Posted by LeonDerProfi, on August 28, 2005, 20:59.

    hm, i found no "nl2br" in the script and the external java file didn't work too. I think it's ok, the main thing is, that it works with the comments textarea in the blog.
    Thanks for your help and for the plugin! I like that smilies! :)

  13. Posted by Martin, on September 5, 2005, 12:07.

    Hi
    the smilies works only when i'm logged in, how come? whats wrong?

  14. Posted by Martin, on September 5, 2005, 12:13.

    Nevermind. when i put the function under the textbox it worked.

  15. Posted by MissLadyhawke, on October 24, 2005, 02:59.

    Great Plugin, I love and it was so easy to install. Thank you :mrgreen: :mrgreen:

  16. Posted by doctoorh, on October 25, 2005, 03:22.

    I'll be more than grateful if you show me a way to active this plug with the ver. 1.5.2 of wordpress .. :)

  17. Posted by Skippy, on October 25, 2005, 15:28.

    doctoorh: Why, doesn't it work? Does it appear in the plugin list? What happens when you activate it?

  18. Posted by doctoorh, on October 25, 2005, 19:33.

    I dunno, it appears in the plug list, and I active it correctly .. but when I go to comment I can't see the Smileys .. what shall I do ?! :(

  19. Posted by doctoorh, on October 25, 2005, 19:50.

    hey, never mind :D ..
    the problem was that I got the code from other blog, and it was wrong, I used yours now ..
    and it worked so beautiful .. thank you very much ;) ..

  20. Posted by CoffeeMan, on November 7, 2005, 23:56.

    does this plugin make any request to the Database?

  21. Posted by Skippy, on November 8, 2005, 12:30.

    CoffeeMan: None whatsoever. It picks up the already available global array containing smiley-to-image pairs, flips it to obtain the reversed image-to-smiley pairs, and generates some JavaScript which runs on the client side.

  22. Posted by Leguims, on November 17, 2005, 23:26.

    Great plugin ! :)
    You can add the following tips :
    1- Edit files in "/wp-admin" directory "edit-form-advanced.php"/"edit-form.php"/"edit-form-comment.php"
    2- Search the "textarea" just below the word "the_quicktags" and insert the line for the smileys. :)

    You have the smyleys in the admin editor. :D

    Last thing to say : I find a good fonction in the plugin "iimage-browser" to insert in your plugin : "InsertAtCursor". I can send you your plugin with this function inside. It works very well. :)

  23. Posted by Skippy, on November 18, 2005, 10:42.

    Leguims: Thanks, we'll talk via email shortly.

  24. Posted by AvP, on November 28, 2005, 20:55.

    hello,i finished one of your "to do list":Detect cursor position and insert smilies accordingly instead of appending them.But sorry for support IE only now,You can download and test it.Thanks for your nice plugin.

    Download Here :tongue:

  25. Posted by AvP, on November 28, 2005, 21:19.

    OMG!I read Leguims's comment,and wrote it again,now support all Popular browser like IE,FIREFOX :lol: :lol:

    download link same.

  26. Posted by AvP, on November 28, 2005, 21:37.

    Sorry For Spam….And New Download Link is: Here

    Plugin work just like origina one,but If you dont want to kiss good-bye to IE User,you must add some code to "textarea" tag:

    onkeyup="storeCaret(this);" onclick="storeCaret(this);" onselect="storeCaret(this);"

    For Detail please go to: http://www.quakemachine.com/blog/php/wordpress/575/ ,sorry no english now,maybe later i will add it;But i think it's easy to anyone to add these code. :laidback:

  27. Posted by Skippy, on November 28, 2005, 21:56.

    AvP: thanks a lot, I will start looking at it. It was file ID 20, BTW, not 19. :)

    I'm still not very sure about basing the detection on browser name, I'd like to do it by examining if certain DOM elements exist.

    Also cool would be a way to reuse the same JS functions that WP uses for the admin area.

    But one way or another we'll do this. :)

  28. Posted by AvP, on November 29, 2005, 10:20.

    rewrite again,no need add code to "textarea",install just like your plugin.

    Download Here

  29. Posted by Skippy, on November 29, 2005, 10:37.

    Thanks, that's better. I'll incorporate it one of these days, as soon as I get some time.

  30. Posted by Scott, on January 3, 2006, 04:16.

    I love the plugin and was wondering if there was any way to use different smileys, like those designed for the yahoo/msn smiley plugin?

    Thanks!

    Scott

  31. Posted by Skippy, on January 3, 2006, 19:02.

    Scott: this plugin only uses whatever smilies you already have. If you want to change your smilies you have to change your smiley set by hand. Check out this tutorial.

  32. Posted by xaqc, on January 12, 2006, 14:39.

    Hello, I just upgraded to Worpress 2.0, the plugin works fine in the comment area, but it does not work in the admin area because it is now using the ajax/wysiwig editor.

    Am I the only one with this problem ?

  33. Posted by Skippy, on January 12, 2006, 16:04.

    xaqc: It's probably the same for everybody, but I heard lots of people consider the new WYSIWYG editor in WP2 slow and annoying and they turn it off. Perhaps it works with the old-style editor.

  34. Posted by bluemint, on January 15, 2006, 00:43.

    Maybe I missed reading about it but version 1.2 doesn't work correctly in WordPress version 2. The smileys' images don't show up. :grr:

    The reason is because the default location for the smileys in WP 2 is in /wp-includes/images/smilies/

    To fix that, open up "smileys_js_buttons.php" in your text editor and look for "/wp-images/smilies/" (without quotes) and replace it with "/wp-includes/images/smilies/" (without quotes). Save. That's it. Now it works in WP 2.

    Keep up the good work! :tongue:

  35. Posted by Opforsoldierf, on January 15, 2006, 05:45.

    If you have WP2.0 you can turn of the rich text editor in your "USERS" tab under your individual profile.

    However I have changed all the directories for the comment smilies and I still do not have the images, only the text and Red X (only on IE).

  36. Posted by JoP, on January 22, 2006, 20:52.

    Hello World!!! :evil: :lol: :smile: :frown: :tongue: :roll: :mad: :tongue: :wink: :shock: :shock:
    Cooooool!!! I must have one of this!!!

  37. Posted by Alyssa, on February 18, 2006, 22:52.

    I installed the plugin and it works fine. The only problem is the thick nasty border around the images. It's in the default link colors (purple and blue) and I can't figure out how to get rid of it. :grr: What should I do?

  38. Posted by Skippy, on February 19, 2006, 13:28.

    Alyssa: One simple solution is to edit your style.css and add this somewhere, preferably at the end:

    a img { border: 0 }

    It means that img tags inside a tags should not have borders.

  39. Posted by Alyssa, on February 19, 2006, 20:55.

    Thank you so much! :grin: I knew there must be a simple solution.. I feel so blonde now. :right:

  40. Posted by Robin, on March 12, 2006, 04:28.

    When I added the: it moved my sidebar down below the comments.

  41. Posted by Skippy, on March 13, 2006, 17:40.

    Robin, added the what? :)

  42. Posted by shortii, on March 27, 2006, 04:07.

    after i installed the smileys the pictire error and the :name: of the smiles shows and i cant click on them but if i write in :name: they work…help please!?

  43. Posted by Skippy, on March 27, 2006, 08:50.

    shortii, so you're saying that they show up in posts and comments but not in the bar? Or just in posts, or just in comments? It would really help if you'd give me a live WordPress where I can see this happening. Until then, see my replies to germaine (top of the comment list on this page).

  44. Posted by shortii, on March 27, 2006, 15:35.

    heres my wordpress url http://www.love-fiend.com/wp

  45. Posted by shortii, on March 27, 2006, 16:27.

    ok scratch everything i asked…i figured most of it out…..now the only problem im having is clicking on the smilies to put into form??? :sad:

  46. Posted by Skippy, on March 28, 2006, 10:47.

    I think I know what's wrong. You called SJB_outputSmilies('') that is with a blank string as parameter. You shouldn't do that, either pass something in the string or just use (). If you look at your comment page source as compared to mine (this one), you'll notice that my JavaScript definition for function SJB_appendSmiley(text) tries to grab the comment field using the "comment" id, whereas yours just uses an empty string and ends up grabbing who knows what page element (I think it grabs document or something :)).

  47. Posted by shortii, on March 28, 2006, 22:30.

    yup that was the problem thanks! :grin:

  48. Posted by Laura, on April 6, 2006, 21:00.

    I'm having a problem. The images are not working in the actual comments. The row shows up below the text box though. Any ideas? This is happening in WP2.

  49. Posted by Skippy, on April 7, 2006, 16:13.

    Laura, in WP2 the smilies were moved. You will have to modify the plugin before you put it on your site. First, get at least version 1.3. Then look for a line like this:

       ).'/wp-images/smilies/';

    And change it to:

       ).'/wp-includes/images/smilies/';
  50. Posted by Laura, on April 7, 2006, 17:14.

    Ok. I did that. They are still not working. The regular ones such as :) and ;) work but any others- like :| don't work.

  51. Posted by Laura, on April 7, 2006, 17:21.

    I believe it has to do with another plugin that I have installed- custom smilies. I'm working on a fix now. Thanks!

  52. Posted by Maggie, on November 11, 2006, 16:55.

    I love this plugin :smile:

    I was wondering, how to add the smilies of my choice.

  53. Posted by Skippy, on November 11, 2006, 20:19.

    Maggie, please read the presentation article. It has a section explaining how you can use your own smilies.

  54. Posted by Jameson Malpezzi, on November 21, 2006, 08:22.

    i used the latest version you have and i got the same problem as your first poster(germaine)… :neutral:

  55. Posted by Skippy, on November 21, 2006, 12:16.

    Jameson, you must be using WP 2. The plugin still uses the old 1.5 path to the smilies, which was /wp-images/smilies/. You need to edit the plugin and change line 43 to /wp-includes/images/smilies/.

    Later: Fixed, please download version 1.4 and let me know how it works. It should be able to detect the proper smiley dir on its own.

  56. Posted by Jameson Malpezzi, on November 21, 2006, 19:39.

    Alright, 1.4 worked perfect, the smiles look sweet ! Thanks Skippy !!! :lol:

  57. Posted by Skippy, on November 21, 2006, 21:52.

    Alright then, glad to hear it's working, and glad that your comment prompted me fixing some long-standing issues with this plugin. :)

  58. Posted by Maggie, on January 8, 2007, 04:45.

    Good evening,

    I recently upgraded to version 2.0.6 and although I have my own smilies in the smilie folder, they seem to have been overridden by the default smilies which I have removed from the smilie folder. I've also checked the vars.php file and it seems to be fine. Was hoping you might be able to help.

  59. Posted by Skippy, on January 12, 2007, 12:42.

    Maggie, unfortunately I got burned myself by this one. It probably has nothing to do with the plugin. The upgrade procedure from WP 2.0.5 to 2.0.6 recommends to completely delete and re-upload the wp-includes/ directory, and that's where your custom smilies (and mine) were being kept.

    So they're gone right now and I for one will restore them from backup when I get home. Hope you got a backup as well. :right:

  60. Posted by sandynata, on January 23, 2007, 10:05.

    doesn't work on Firefox :shock:

  61. Posted by Skippy, on January 23, 2007, 10:49.

    sandynata, the JavaScript used is very basic, it should work in pretty much all versions of Firefox. What version are you using? Please check that you're not blocking JavaScript somehow. Also make sure you're using the latest version of this plugin. The latest versions will let you know if JavaScript is not activated.

  62. Posted by LaTomate, on April 8, 2007, 04:05.

    Hi, thanks for the plugin. Works fine, is simple and light, I like it :)
    For adding the smileys to the admin pages without editing the admin php files, I did the following modifications to smiley_js_buttons.php (just after the "SJB_getSmilies();" call) :

    add_action("dbx_post_sidebar", SJB_add_box, 1);
    add_action("dbx_page_sidebar", SJB_add_box, 1);
    function SJB_add_box() {
    ?&gt;
    Custom Smileys

  63. Posted by LaTomate, on April 9, 2007, 01:51.

    Hi, me again.

    I managed to insert a function in the "the_editor" action hook, and now the smileys are found above all 'content' text edit boxes (write, edit and edit comments), without modifying the wordpress source code.

    I mailed you the file, but if you did not get it mail me if you want and I'll send them to you.

    Regards,
    LaTomate.

  64. Posted by Peter, on April 12, 2007, 13:14.

    HI, yes my me its the same problem it only appears the text :shock: not the smilie in the comment. Plsease help me, thx

  65. Posted by Peter, on April 12, 2007, 13:42.

    Hello,

    its me again, sorry for my bad english but i try to explain my problem again for better understanding :

    Well, rather i have exact the same problem like youre first poster (germaine), but i have installed the newest version (1.4) and followed youre Installation tutorial :roll: but it doesnt works correctly, hmm would be nice when you help me
    :smile: , thanks !

    peter

  66. Posted by Skippy, on April 25, 2007, 10:18.

    Sorry for taking longer to respond lately. LaTomate, thanks for the idea, I'll definitely look into it. Peter, it's pretty hard to debug WP remotely. :) Follow the advice I gave germaine about how to tell what's going wrong and get back to me with more info about how it went.

  67. Posted by Levi, on May 24, 2007, 01:54.

    Okay, Since Wordpress have been upgrade to version 2.2, that means Smiley JS Button plugin is now broken and show some errors like this:

    Warning: array_flip() [function.array-flip]: The argument should be an array in wp-content/plugins/smiley_js_buttons.php on line 59

    Warning: array_map() [function.array-map]: Argument #2 should be an array in wp-content/plugins/smiley_js_buttons.php on line 59

    Just thought let you know about that.

  68. Posted by Skippy, on June 1, 2007, 23:08.

    Thanks, Levi. I plan to upgrade to 2.2 as soon as I get my hands on some spare time, at which point I'll update the plugin as appropriate.

  69. Posted by heomap, on June 5, 2007, 06:19.

    Hope you will update the plugin as soon as possible. It was useful and I liked it so much.

    Thanks for your share :)

  70. Posted by pelf, on June 6, 2007, 17:48.

    I can't wait for the newest version of this plugin, which is compatible with WP 2.2! :grin:

  71. Posted by clark®, on June 7, 2007, 14:17.

    do u have a smiley buttons for ragnarok online emoticons?

    although i'm still waiting for your updates. i'm also using WP2.2

  72. Posted by heomap, on June 9, 2007, 16:20.

    Will you update the code soon?

    I can't wait anymore…

  73. Posted by Skippy, on June 10, 2007, 12:21.

    No sooner than about 2 weeks, I'm afraid.

  74. Posted by Boriel, on June 17, 2007, 01:34.

    Your plugin stops working on WP v2.2 :shock: But there is a simple fix: move call to SJB_getSmilies() on line #33 to line #64.

    It's better this way, since smilies array are not initialized if not required (that is, only when displaying the comment form).
    Another solution is to call smilies_init() within the function SJB_getSmilies()

  75. Posted by Skippy, on June 19, 2007, 21:33.

    Thanks a lot, Boriel. :)

  76. Posted by Nancy, on July 6, 2007, 08:09.

    I am curious to know how to fix the line 59 problem with wordpress 2.2?

  77. Posted by Brewskie, on July 31, 2007, 06:39.

    Still waiting anxiously waiting for a fix for the array_flip()

    I'm dying to give this a try.

    Thanks!

    :grin:

  78. Posted by Skippy, on July 31, 2007, 13:57.

    Strangely enough, it's been working perfectly for me, even though I've updated this site to WP 2.2.x at some point.

    Nevertheless, the suggested fix is sensible no matter the WP version. Bottom line is, version 1.5 should work with WP 2.2 now. Please download it and report if there are problems.

  79. Posted by Boobs bob, on August 2, 2007, 23:39.

    :cool: :shock: :yawn: :right: :cry: :secret: :grin: :lol: :evil:

  80. Posted by soul, on August 7, 2007, 09:36.

    ok? :roll: look nice though… :confused:

  81. Posted by Nicola, on September 7, 2007, 16:37.

    testing :frown: :lol: :evil: :smile:

  82. Posted by dee, on October 9, 2007, 17:16.

    Hello, for some reason the smileys are not loading at all in my comments. I am not receiving any errors or anything, and I've copied the correct code. For some reason, the bar is just absent. Help? Oh yes, I am using the latest version of WP.

  83. Posted by Skippy, on October 9, 2007, 18:58.

    Ah, it's upgrade time again. :) I'll look into it, but I don't know when. Upgrading to WP 2.3 is a bit low on my priorities right now.

  84. Posted by robin, on October 17, 2007, 03:06.

    just checking out the images :lol:

  85. Posted by Mainfield, on October 27, 2007, 17:00.

    Hi there. I have a problem with the plugin. When I activate it and write the code line in the comment.php, I get this sense in the pages:

    Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /var/www/vhosts/xxxxx.com/httpdocs/blog/wp-content/themes/mainfield/comments.php on line 100

    Parse error: syntax error, unexpected T_STRING in /var/www/vhosts/xxxxx.com/httpdocs/blog/wp-content/themes/mainfield/comments.php on line 105

    Can you tell me which is the matter? I like your plugin, but can't use it :sad:

  86. Posted by prav, on August 26, 2008, 16:09.

    I like this :lol: :grin: :smile:

  87. Posted by DaemonLV, on September 15, 2008, 23:30.

    Thank you!

Jump to comment box