WordPress.org

Support

Support » Plugins and Hacks » New Plugin: CommentLuv – luv your commenters!

New Plugin: CommentLuv – luv your commenters!

  • I’ve made a new plugin called CommentLuv to spread the luv to your loyal readers!

    CommentLuv appends the authors last blog post to their comment before saving it to the database. It can parse a WordPress, Blogspot or Typepad feed found in the default location, if one doesn’t exist there, it parses the comment authors page for a feedburner feed and uses that instead.

    version 0.8 is available at http://www.fiddyp.co.uk/commentluv-wordpress-plugin/

    I made it with WordPress 2.2 in mind, it’s been tested on a few different blogs and it’s working well!

    just download, unzip, upload, activate. no template editing required.

Viewing 15 replies - 1 through 15 (of 42 total)
  • now up to version 0.91 for compatibility with other comment enhancement plugins. Available from the wordpress plugins page.

    Just wanted to bump this up a say that this plugin rules! Plugin of the year nomination.

    I’ve had a problem in the rendering of this plugin and though fiddy has been of great help, i’ve still been unable to resolve the problem.

    there is a block of text explaining that “this blog uses commentluv…” that is SUPPOSED to appear below the comment form. However, on my blog it appears above the form. Here’s the code:

    some code from the plugin:

    // hooks, call comment_luv function just before comment is posted . gets passed array of comment fields
    // hooks, call add_text when comment form is shown, gets passed id of post
    add_filter('preprocess_comment','comment_luv');
    add_action('comment_form','add_text');
    
    // function to add text to bottom of form field
    function add_text($id){
    	echo "<br><em>This blog uses the <a href='http://www.fiddyp.co.uk/commentluv-wordpress-plugin'>CommentLuv plugin</a> which will try and parse your sites feed and display a link to your last post, please be patient while it tries to find it for you.</em>";
    	return $id; // need to return what we got sent
    }

    a portion of my theme’s comment.php:

    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
    <?php if ( $user_ID ) : ?>
    
    <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
    <table border="0" cellpadding="1" cellspacing="4" align="center" width="95%">
    
    <?php else : ?>
    
    <p>You are currently not logged into an account. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php" title="Log in to your account">Login &raquo;</a></p>
    <table border="0" cellpadding="1" cellspacing="4" align="center" width="95%">
    
    	  <tr>
    		<td width="50%">
    		  <label for="author">Name</label><br />
    		  <center><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" tabindex="1" /></center>
    		</td>
    
    		<td width="50%">
    		  <label for="email">Email</label><br />
    		  <center><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" /></center>
    		</td>
    	  </tr>
    
    	  <tr>
    		<td colspan="2">
    		  <label for="url">Website URL:</label><br />
    		  <center><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" tabindex="3" /></center>
    		</td>
    	  </tr>
    
    <?php endif; ?>
    
    	  <tr>
    		<td colspan="2">
    		  <label for="comment">Message:</label><br />
    		  <center><textarea name="comment" id="comment" rows="10" cols="" tabindex="4"></textarea></center>
    		</td>
    	  </tr>
    
    	  <tr>
    		<td colspan="2">
    		  <center><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /><input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /></center>
    		</td>
    	  </tr>
    
    <?php do_action('comment_form', $post->ID); ?>
    
    </table>
    
    </form>

    can anyone help me resolve this problem? check it out on my blog

    I’ve been using this plugin for a few days now and am happy to say I think it’s great!

    JSD: your ‘do_action’ is at the bottom of your form and that’s where commentluv is supposed to add it’s text, you could try adding a lower priority on the add_action function of commentluv..
    add_action('comment_form','add_text',10);
    and see if that puts it in the right place..

    team, thanks so much for the info. i attempted the fix you recommended, but to no avail. The text remains above the comment form. any other ideas?

    thanks SO MUCH for your help!

    my issue is resolved, thanks to teamplay/fididyp. thanks!

    Thatโ€™s quite clever, but you should probably consider parsing out the actual feed location from the webpage given instead of trying to work it out based on the blog type. All blogs announce their feed addresses for you, all you have to do is to look for this sort of thing: link rel=”alternate” type=”application/rss+xml”

    This is better than guessing based on the blog type or looking for feedburner or any of that.

    It would also have let your plugin find my latest blog post, which it canโ€™t seem to accomplish, as far as I can see. The combination of redirects and the fact that though it’s running WordPress it doesn’t actually have the generator tag seems to be too much for your plugin to cope with. I’m even using feedburner, just not with a feedburner.com web address.

    I have included a parsing routine in the plugin that looks for “alternate” in the head of the authors page, it doesn’t rely on that to find the feed location first because not all hosting provides the ability to do ‘curl’ commands or open remote files with ‘file’ and ‘fopen’ and I wanted to have the most compatible way done first, the parsing routine gets called if no default feed location is used.

    also, if it is an own domain blog it will by default, try to look in /feed/ first and then /?feed=rss next, if there is an alternate link in the head then the second option should get to it.

    it is quicker to see if it is a blogspot blog by examining the author url because then no parsing is needed and the internal wordpress rss.php function will be able to read that with no problems, the code is very small and is executed at server side so it’s more efficient to check the string than to open a file.

    I have a new version running as a test on my blog and it’s having great success with removing nofollow and also parsing blogspot blogs hosted on their own domain which I only found out because of the feedback I get from people that use it and people that code like you. I hope to get commentluv working on as many, and parsing as many blogs as possible so I appreciate your input.

    there are improvements to the cache of the feeds too and an ability to make it show the debug info to make tracking down of errant blogs easier..

    I hope you get a chance to use the new version when it’s released soon and spread the luv ๐Ÿ˜‰

    Andy Bailey of fiddyp.co.uk

    I don’t understand. If you can’t pull the main blog page itself (via whatever method), then you can’t pull the feed either, so it’s kinda pointless to know the feed address at that point.

    Yes, pulling the page is an extra request, and you can skip it for wordpress.com or blogspot.com or other commonplace blogging services. But for all other blogs that are not on these services, you have to pull the page anyway, so getting the alternate URL is the best way. Trying to get /feed/ and /?feed=rss2 first is rather a waste of time.

    I see where you’re checking for the alternate in the code, that’s not really the best way to do it, but it is simple and easy, I suppose. But it will probably miss some blogs where the link gets spread across multiple lines. And on some other blogs, it might pick up the comments feed, which would be weird.

    Fantastic plugin! Thank you ๐Ÿ™‚

    YEAH!!!

    I am so VERY HAPPY that you now can support those of us with host providers that will not let us use curl – which I use on my own, they just don’t support it (grrr).

    THANK YOU THANK YOU THANK YOU!!!

    ๐Ÿ™‚

    My Staff IT Right blog thanks you!

    http://staffitright.com/blog

    thanks for letting me know snowlark! I have wanted to do that for some time so that as many blogs as possible can use the autodiscover link in the head of the authors page.

    my next step is to ajax the process so that the last post gets found while the author is typing away in the comment box.
    I’ve got it working on a local install but it’s using prototype.js which causes my blog to hang when I include it in the header so I need to work out a better way for getting a working event listener..

    thanks for the luv!

    Awesome plugin! I just wish I could get it to work properly with Nofollow Free (http://www.michelem.org/wordpress-plugin-nofollow-free/).

    stshores: what blog are you trying it on? if you look at comments in the admin or email notification then wordpress will add the nofollow attribute, if you check the source of the page with commentluv installed then the links should show no nofollow.

Viewing 15 replies - 1 through 15 (of 42 total)
  • The topic ‘New Plugin: CommentLuv – luv your commenters!’ is closed to new replies.
Skip to toolbar