Ronald Huereca is part developer, part mammal. And he only comes out at night. View the author's website.
 

Making Ajax Edit Comments Compatible With Other Ajax Plugins

One of the many feature requests I have gotten for Ajax Edit Comments was to allow different Ajax-type plugins to be compatible. It works both ways to make a plugin compatible, so I coded in a hook that would allow other plugin authors to initialize the JavaScript code.

Within this post I will explain the hook, and give two examples of plugins that can be made compatible rather easily.

The Plugin Hook

With version 1.1, Ajax Edit Comments now has a JavaScript hook for other plugin authors to tap into. The JavaScript code to call the plugin is simple:


if (window.AjaxEditComments) {
   AjaxEditComments.init();
}

This code should allow the plugin to work with other AJAX-type comment plugins. All you are doing is initializing the plugin.

Ajax Comments

Find in the file “ajax-comments.php” line 97 where it reads:


new Insertion.Bottom(ol, request.responseText);

Add in this code right after that line:


if (window.AjaxEditComments) {
   AjaxEditComments.init();
}

Better Comments Manager

The Better Comments Manager (version 1.3) now has its own edit feature, so it isn’t necessary to make Ajax Edit Comments compatible for the time being.

jQuery Ajax Comments

A developmental version of this plugin and a spin-off of jQuery Ajax Comments have been made compatible. Please visit this jQuery Ajax Comments site for more details.

Conclusion

If any of you plugin authors out there have a fix for making your plugin compatible, please leave a comment and I’ll e-mail you and get the code and post it here. Thank you.

Read the Discussion (8 Responses)

  • Iktomi says...

    Sorry, but where is the hook in plugin code?
    I don’t see it :(

  • Post Author

    Ronald Huereca says...

    http://www.ronalfy.com

    Iktomi,

    All you need to do is call the init function as described in the first part of the post. The actual ‘init’ function is in the ‘js-includes’ folder in ‘wp-ajax-edit-comments.js.php’.

  • kretzschmar says...

    http://diekretzschmars.de

    I made some changes to the original jQueryAJAX Comments so it ALWAYS works. There was just a small bug in the routine to find the proper url of a php file. If you like I could send you my changed Plugin and you could help to make it compatible with your plugin.
    I don’t use the plugin itself but used the code in my theme for my comments. I am not experienced enough to get it to work with your plugin either.

    Send me a mail and I will send you my chnaged Plugin in return.

  • Post Author

    Ronald Huereca says...

    http://www.ronalfy.com

    kretzschmar,

    Sent you an email. Let me know if you got it please.

  • kretzschmar says...

    http://diekretzschmars.de

    I already answered. Hope you can help. And AGAIN. You do a fantastic job and it is nice that you answered so quickly because I think there are plenty of users out there who like John Wranas Plugin a lot (like me).

  • Mint-Tree says...

    http://mint-tree.com

    Oopse, I forgot to give the link to the Text Control plugin, which again is incompatible with Ajax Edit Comment: http://dev.wp-plugins.org/wiki/TextControl. My apology for the reiteration: I just want to know if it is ‘possible’ to make these two plugins compatible =?

    –Mint-Tree–

    Edit: arg…my first comment got flagged as potential spam =(

  • jp says...

    http://jamesqpublic.com

    Hi Ronald, thank you very much for your helpful hooks. I am running into a bit of an issue however. I am using the AJAX comment plugin located here: http://www.smullindesign.com/ (the site seems to be having issues now but maybe it’s just me).

    I did locate an ajax-comments.php file but could not find the line that you mentioned anywhere in the file. I tried putting your hook in a couple of places that I thought looked right but apparently they weren’t because every time I uploaded the file I would get error messages.

    Thanks again for all your help, hopefully we can figure out a fix for this comment plugin as well as I would really like to use your edit comment plugin.

    Thanks

  • Riri Audiya says...

    http://ririaudiya.com/

    thanks. I searched this issues.

Trackbacks (5)

Join the Discussion