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.
BBQ Pro: The fastest firewall to protect your WordPress.

70 responses to “WordPress Plugin: Simple Ajax Chat”

  1. Dan Dawson 2012/11/14 10:49 pm

    Looks pretty great, I’ll definitely give it a try. I have a few sites that are running phpMyChat and I would love to migrate them to something a more modern than that.

    Does Simple Ajax Chat have any ability for users to have their own logins to protect their usernames?

    A perfect solution would allow me to import username/password pairs from the old site. Previous chat software on my sites that didn’t have logins caused a lot of problems with people impersonating other regular users of the system.

    • Hi Dan, sorry but the Simple Ajax Chat plugin does not have an import-users feature. Interesting idea though.

      • Dan Dawson 2012/11/15 2:30 pm

        Thanks, and I wouldn’t even need the import feature (I could easily do that manually with the SQL) but was more curious if it had any login system at all built in, but it looks like it doesn’t.

        Two easy options for how it could be implemented… one model could use the existing WordPress Users model to handle logins (probably a good choice) and the other would be a chatroom specific table of user data and passwords.

        The only fields really needed would be the chat username (nickname), password and email address (for password recovery)

        Either way, great job, and if I ever find some time to work on this I’ll let you know and contribute my changes back to you!

      • Jeff Starr 2012/11/15 7:57 pm

        Ah, I should note that there is an option to require registration to participate in the chat.. which may be something that will help? It basically relies on WP’s built-in registration system to check if the user is logged in or not. Let me know if you find a better way! Either way, thanks for the feedback, it is much appreciated.

  2. Very cool – this is one I’ll definitely use if I need a chat plugin.

  3. Thanks for creating this chatbox

  4. I am getting error – I will put here just first line – if needed I can paste all:

    Warning: stristr() [function.stristr]: Empty delimiter in /home/potencia/public_html/wp-content/plugins/simple-ajax-chat/simple-ajax-chat.php on line 282 ....

    is it there maybe support forum or email I can send this to.
    Thank you.

    I am looking for a useful chat for my site and I think this is it, just to make it work

    • Jeff Starr 2012/11/19 3:02 am

      Thanks for the feedback, Miran. I’m updating plugins and will look into this for the next update. Does the error happen using the default plugin settings, or after something specific has been changed?

    • Hey Miran, just to let you know this issue has been fixed in the latest version of Simple Ajax Chat (v20121119). Let me know if you encounter any further issues.

  5. Really is a simple to install Chat System–I Like simple. However I have a silly question. Hopefully its a quick fix but I am no programmer, the image above shows a window for the chats and a scroll bar to scroll through them to read. On my installation it simply keeps on being entered with no framed scroll window and it accepts hundreds and hundreds of chat entries growing the page to huge size. How can I fix this I am using 3.4.2 and twenty eleven. I sure do appreciate all you’ve done and hope you have a super simple fix for this situation. Thanks

    • Yes easy fix: in the settings custom CSS field, find or add the following selector:

      ul#sac-messages {}

      Inside it, declare a height for the chat box, for example:

      ul#sac-messages { height: 300px; }

      And remember to save the changes :)

  6. Hi developers,

    Is there a way to make the same as: http://wordpress.org/extend/plugins/pierres-wordspew/

    Because they also have stopped development, this version was much simple, all you had to do was drag the widget.

    Someone told me that there is an exploit in pierres-wordspew thats why I removed it.

    • Jeff Starr 2012/11/23 1:39 pm

      It’s just me, Muj :) Are you asking about adding widget functionality?

      • Hi Jeff Starr,

        Not really, but it would be great if it did.

        I like how the Pierres Wordspew is layed out.

        Maybe if you could base it off that.

        Thanks

      • Jeff Starr 2012/11/23 7:16 pm

        Nah, just go ahead and use Wordspew. I rather prefer the semantic HTML markup of Simple Ajax Chat. Have fun.

  7. Is there any exploits in it?

    If you search in Google “wordspew exploit”

    Thanks

  8. What about against WordSpew ;-)

  9. Is there a way to only let 1 person in the chat at a time? For example if i run an eCommerce site, this chat box can be as a quick inquiry or live support. It would be weird if 2 or 3 customers are in the same chat room at a time.

    • Jeff Starr 2012/11/27 1:18 pm

      Hi skaapie, unfortunately this plugin doesn’t have that functionality, but probably there is another that will do what you request.

  10. activated chat, but I’m new to wordpress and don’t understand how or where to place the shortcode or template tag (using Suffusion theme)

    • If you want to display the chat box in a post or page, use the shortcode; else, if you want to include the chat box in your theme template files, use the template tag. I recommend trying the shortcode first and going from there.

  11. Hi there,
    After install and testing I get this massage when I press “say it”

    Warning: stristr() [function.stristr]: Empty delimiter in /.../plugins/simple-ajax-chat/simple-ajax-chat.php on line 282

    also in line 285 & 288

    Plus this:

    Warning: Cannot modify header information - headers already sent by (output started at /plugins/simple-ajax-chat/simple-ajax-chat.php:282) in /plugins/simple-ajax-chat/simple-ajax-chat.php on line 217

    Also in line 218 & 219

    Is this a theme related issue?

    I wanted to have this plugin on a password protected page. But it doesn’t seem to matter what changes I made.

    Hope you can help/fix the issue.
    Kind regards,
    J.

    • Jeff Starr 2012/12/04 1:08 pm

      That’s weird, could have sworn I fixed this issue in the latest version of the plugin. May I ask which version you are using?

  12. Jonathan Chew 2012/12/06 9:39 am

    I’m getting this strange error:

    Warning: Illegal string offset 'sac_script_url' in C:\xampp\htdocs\wordpress\wp-content\plugins\simple-ajax-chat\simple-ajax-chat.php on line 192

    Do you know how I should fix it?

    Exuberantly,
    Jonathan

    • Hi Jonathan, that’s a new one! Not sure what the issue is at this point, but will look into it for the next update. In the meantime the plugin should work fine (I’m using it on a number of sites).

      • That issue is because you have to call $sac_options[] on line 191 and other lines that have that variable(when the variable is first called). I got the same problem :)

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 »
SAC Pro: Unlimited chats.
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.