That’s the reason why I try to make some modifications if I find a problem which will hopefully improve its handling and functionality. I am glad that I could already add my 2 cents that made it into the current version. As of now, I thought it would be nice to write an article of my own instead of just contributing via comment on Andy’s blog.
I actually came across the following problem because a comment that I did not approve had a URI added via CommentLUV. That link showed up in the stats for my site on commentluv.com.
Up to that moment, CommentLUV was enabled by default on my blog. That always added a link automatically unless you unchecked the box. So, when the form was filled out by a robot, even that link would show up. That’s why I then decided to disable CommentLUV by default.
Now, every user has to tick the checkbox if they want a link to be added.
But there seems to be a little problem:
When commentluv is disabled from the start and the user ticks the checkbox after filling everything in and writing the comment, simply nothing happens. One will have to click into the comment field again to re-trigger the link-fetching process.
I think/hope that I have found a simple fix.
Here is what to do:
Find the following code (should be line 44 in /js/commentluv.js):
jQuery('#luv').click(function() {
if(jQuery(this).is(":checked")){
// was unchecked, now is checked
jQuery('#cl_post').val(jQuery('#mylastpost abbr em').html());
jQuery('#lastposts').attr("disabled", false);
jQuery('#mylastpost abbr em').fadeTo("slow", 1);
First, it checks if the URI has changed by comparing the content of the URI field to cl_settings[99] – which is not yet defined when ticking the checkbox for the first time, so cl_dostuff() is triggered and the links will be fetched (if a URI is provided at all, that is).
The current URI will then be stored in cl_settings[99] (I just needed a storage – that array came handy).
When the next tick happens, the current URI and that from cl_settings[99] are compared. If they are the same, nothing will happen – the already fetched links will remain in the selection bar without an unnecessary re-triggering of the link-fetching process. If the URI has changed, the fetching process will start over again. Before, any old links will be erased via “.empty()”.
Hope that works.
I leave it to Andy if he wants to put it into the next version.
the link gets shown at commentluv because it stores it as soon as it gets asked for which is when the user starts to comment (I have no way of knowing if they submit it or not unless I middle man the process which could slow things down for commenters).
both the plugin and commentluv list are populated by javascript so a cURL robot or script posting direct to wp-comments.php wont fire the commentluv.
doing it this way has reduced spam hits to my server by over a million per month which is nice for me!
I think you could have got away with doing a call to cl_dostuff(cl_settings) on line 50 so it fires if they click the checkbox. if they click it first before they enter their details then it will fire when they click into the commentarea.
yours works for you though, maybe I’ll put it in the next version thanks!
both the plugin and commentluv list are populated by javascript so a cURL robot or script posting direct to wp-comments.php wont fire the commentluv.
OK, I understand – JavaScript is also often used to spam protect comment forms: if the user has JavaScript enabled, they don’t even see the spam protection, because JS fills out the necessary field automatically – robots can’t (or don’t) do that. Point taken. Must have been a “manual” spam comment, then (who does that?).
I think you could have got away with doing a call to cl_dostuff(cl_settings) on line 50 so it fires if they click the checkbox.
I tried that, but that way, it was fired each time the box was de- and reactivated (which I did not want – it’s unnecessary traffic for your server, right?). In addition to that, I needed the “.empty()” – otherwise, there would have been the well-known “link accumulation” in the selection tab.
http://www.fiddyp.co.uk Andy Bailey
if it is around line 50 then the only time it would fire will be when a user activates it if it is unchecked. how many times do you think the average user will click it? tick goes in, tick goes off, tick goes in, tick goes off hehehe homer would love it.
maybe a little bit of me wants everyone to have it on by default …might have to bring that up with my code psych
http://www.saphod.net Marco
I love the one about Homer.
http://weeblemouth.weebly.com/ Lisa
This is interesting to read about this fix, though frankly, I’ve not noticed any problems personally when posting comments on blogs with the commentluv plugin. So far I’ve not had any issues, but I will return here to apply this fix if I do.
Graham G
I occassionally get messages that i cant comment on blog because i am behind a proxy does anyone know why this occurs?
Little Fix For The CommentLUV Plugin v2.5.4
October 29th, 2008 | View Comments
Did I already mention that I love the CommentLUV plugin?
That’s the reason why I try to make some modifications if I find a problem which will hopefully improve its handling and functionality. I am glad that I could already add my 2 cents that made it into the current version. As of now, I thought it would be nice to write an article of my own instead of just contributing via comment on Andy’s blog.
I actually came across the following problem because a comment that I did not approve had a URI added via CommentLUV. That link showed up in the stats for my site on commentluv.com.
Up to that moment, CommentLUV was enabled by default on my blog. That always added a link automatically unless you unchecked the box. So, when the form was filled out by a robot, even that link would show up. That’s why I then decided to disable CommentLUV by default.
Now, every user has to tick the checkbox if they want a link to be added.
But there seems to be a little problem:
When commentluv is disabled from the start and the user ticks the checkbox after filling everything in and writing the comment, simply nothing happens. One will have to click into the comment field again to re-trigger the link-fetching process.
I think/hope that I have found a simple fix.
Here is what to do:
jQuery('#luv').click(function() { if(jQuery(this).is(":checked")){ // was unchecked, now is checked jQuery('#cl_post').val(jQuery('#mylastpost abbr em').html()); jQuery('#lastposts').attr("disabled", false); jQuery('#mylastpost abbr em').fadeTo("slow", 1);if(cl_settings[99] != jQuery(cl_settings[2]).val()) { jQuery('#lastposts').empty(); cl_dostuff(cl_settings); cl_settings[99] = jQuery(cl_settings[2]).val(); }Done!
The code actually does the following:
Hope that works.
I leave it to Andy if he wants to put it into the next version.
Geeks unite!
Filed under: WordPress Stuff · Tags: commentluv, comments, fix, modification, plugin, wordpress