Fall Sale! Code FALL2024 takes 25% OFF our Pro Plugins & Books »
Web Dev + WordPress + Security

WordPress Plugin: Simple Ajax Chat

[ Simple Ajax Chat ] Simple Ajax Chat displays a fully customizable Ajax-powered chat box anywhere on your site. SAC makes it easy for your visitors to chat with each other on your website. There already are a number of decent chat plugins, but I wanted one that is simple yet fully customizable with all the features AND outputs clean HTML markup for easy styling.

Go Pro! Create unlimited chat forms with more features. Check out SAC Pro »

Simple Ajax Chat is based on Jalenack’s Wordspew (aka AJAX Shoutbox), which I’ve been using on my sites since the plugin was released back in 2005 (ish). Wordspew works great even today, but it hasn’t been updated in seven years, so I decided to adopt and improve the plugin with fresh code, clean markup, better control, and more features. Here’s a screenshot showing the plugin used for an imaginary, rather egocentric chat:

[ Simple Ajax Chat: Chat Box ]
Screenshot of chat-box display (view more screenshots)

Features

Simple Ajax Chat uses Ajax to enable new chats to appear without refreshing the page. The form works great even without JavaScript, but the page is refreshed for each new message. Here is an overview of the plugin’s main features:

  • Plug-n-play functionality, no configuration required
  • Display on any post or page with the shortcode
  • Display anywhere in your theme template with the template tag
  • Includes default CSS styles and enables custom CSS from the settings
  • JavaScript/Ajax goodness loads new chats without refreshing the page
  • Also works when JavaScript is not available on the user’s browser
  • Clean markup makes it easy to style the appearance as you please
  • New chat messages fade-in with custom duration and color
  • Includes manage-chats panel for editing and deleting chats
  • Links included in chats include `_blank` target attributes
  • Includes complete map of all available CSS hooks
  • Includes built-in banned-phrases list
  • Automatic smileys supported :)
  • On-demand restoration of all default settings
  • Super-slick toggling settings page

One of my favorite new features is the built-in chat blacklist, where you can add any phrase from the settings page and have it magically disappear from the username, chat input, or URL (if enabled). With the old plugin, I had to modify the source code to block stuff, but now it’s all handled from the comfort of the WP Admin.

Customize everything

The Wordspew plugin included a minimal set of options, which is one of the reasons I found it so useful. So I wanted to keep that simplicity while adding some much-needed features. It’s a balance that I think stays true to the original. Here’s a list of things you can customize with Simple Ajax Chat:

  • Customize the update interval for the Ajax-requests
  • Customize the fade-duration for new chat messages
  • Customize the intro and outro colors for new chats
  • Option to require login/registration to participate
  • Option to enable/disable URL field for usernames
  • Option to use textarea for larger input field
  • Customize the default message and admin name
  • Customize the appearance with your own CSS
  • Option to enable/disable custom styles
  • Option to load the JavaScript only when the chat box is displayed
  • Add custom content to the chat box and chat form
  • Built-in control panel to edit and delete chats
  • Built-in blacklist to ban specific phrases from the chat

Installation & Usage

Activate the plugin and visit the SAC settings page to customize your options. Once everything is customized as you like it, display the form anywhere using the shortcode or template tag.

Shortcode & Template Tag

Use this shortcode to display the chat box on a post or page:

[sac_happens]

Use this template tag to display the chat box anywhere in your theme template:

<?php if (function_exists('simple_ajax_chat')) simple_ajax_chat(); ?>

Screenshots

Here are some screenshots of Simple Ajax Chat in action (using default settings):

Demo

Online demo available at WP-Mix: Simple Ajax Chat DEMO »

Download

Download Simple Ajax Chat via the WordPress.org Plugin Directory:

About the Author
Jeff Starr = Designer. Developer. Producer. Writer. Editor. Etc.
Digging Into WordPress: Take your WordPress skills to the next level.

70 responses to “WordPress Plugin: Simple Ajax Chat”

  1. Since 3.5 im getting this Warning:

    Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/simple-ajax-chat/simple-ajax-chat.php on line 353 and defined in /wp-includes/wp-db.php on line 990

  2. i fixed it, on that line by adding an empty argument

    ,""

  3. BTW Jeff, I’m getting a lot of bugs in latest version of WordPress. Most of them are that the options page doesnt save options i selected or wanted. Any news on when you are going to update those issues?

    • I’m not getting any bugs with the plugin on WP 3.5. Which settings/options aren’t saving for you?

      • Might be something with PHP 5.4.3 then… It didnt save custom CSS and selected Options on “Options”

      • Jeff Starr 2012/12/27 1:57 pm

        Yes, it looks like several of my plugins will need updating because of new PHP rules.. will hopefully have time for that before the end of the year, or soon thereafter.

  4. This looks like an awesome plugin, thanks for sharing. Is it possible to use it as a livechat plugin for one to one chat, something like liveperson?

    • Jeff Starr 2012/12/29 2:23 pm

      My pleasure, Noumaan :) I’m not familiar with liveperson, but you can set up your WP theme for one-to-one chat using conditional statements and template tags.

  5. hi, thanks for your great work. i just installed your plugin to my wordpress site, but it does not look like screenshots or the demo. would you please help me? here’s the screenshot: https://www.dropbox.com/s/lmpsbow45t4hchu/Capture.PNG

    • Jeff Starr 2013/01/15 1:09 pm

      Hi Farshad, it looks like an issue with existing CSS and/or settings. I would double-check all plugin settings and then use a tool like Firebug to see which existing CSS styles are interfering with the form.

  6. I think this plugin great. I love simplicity. Anyway? How to include smiliea?

  7. Hi, it sounds like a great lugin, indeed! Would it be possible to use it through the admin? It would be great for authors, contributors to chat together within the admin. Plus, I don’t think such a live chat already exists. :)

  8. Thanks for making this! It really is beautifully simple… and when I say a tech thing is simple to use, boy, I mean it!!! One question: I notice that new messages always seem to appear at the top of the list. Is there a way to flip that around? I want to make a sort of collaborative online play, and so it would be great if the thing could read like a script, with newer things appearing at the bottom…

  9. Hi! I don’t know if Jeff read my previous comment, but I still wonder if it would be possible to show the chat within the Admin instead of a new page since I use it only for the registered authors of my family blog.

    I’m also interested by Melanie’s question, I’d also like the latest message to appear at the bottom.

    I like this plugin a lot, and I’m still working with it, it’s so flexible. Neat job, thank you Jeff! :)

    • Jeff Starr 2013/03/06 2:19 pm

      I think it’s possible with WordPress, but the plugin is not set up to do that by default.

      The ordering of the messages is set in the plugin core files and would require a modification to do it. Let me know if you’re interested in doing so and I’ll post a method.

      Cheers :)

  10. Me again, forgot to ask: would it be possible to send a message simply using the Enter key instead of clicking on the input button ‘Say it’? Thanks :)

  11. Hi Jeff. I’m interested in the method to do it, I’ll modify the plugin core file to do it (already had to do because of missing translation) :)

    I use the textarea and when I type Enter, it does a carriage return, it doesn’t send the message. Just tried it.

    As for the possibility to have the chat dedicated to registered users only, within the Admin, would that be possible? Because I don’t want non registered be able to see the chat messages.

    PS: I managed to customize the CSS, that’s awesome. Only thing is the area to paste the CSS code in small… Couldn’t it be easier to call an external CSS from the current theme for example?

    • Jeff Starr 2013/03/06 2:51 pm

      Here is a live demo of the current version with “press enter to chat” working: https://wp-mix.com/chat/

      I’ll look into the method for customizing chat order after I’m back in the office.

      Yes, you may also include CSS for the plugin via any other method, including theme files, functions, etc.

  12. Enter sends the message in your chat, no in mine, do you know why?

    Thanks for looking into the method for customizing chat order :)

    About the CSS, how can I specify the path for the external CSS? In the plugin core file maybe?

    Concerning the possibility to make the chat ‘private’ (only viewed by registered users), I guess I will have to password protect the page.

    Thanks again!

    • Jeff Starr 2013/03/07 2:29 pm

      It sounds like maybe the JavaScript isn’t being included with the web page. If you search the source code of your chat page, you should find “sac.php” included via <script> tag..

Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
BBQ Pro: The fastest firewall to protect your WordPress.
Thoughts
I disabled AI in Google search results. It was making me lazy.
Went out walking today and soaked up some sunshine. It felt good.
I have an original box/packaging for 2010 iMac if anyone wants it free let me know.
Always ask AI to cite its sources. Also: “The Web” is not a valid answer.
All free plugins updated and ready for WP 6.6 dropping next week. Pro plugin updates in the works also complete :)
99% of video thumbnail/previews are pure cringe. Goofy faces = Clickbait.
RIP ICQ
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.