I Have a New Boss Site Outage…

WordPress Plugins Updated: Similar Posts, Recent Posts, Random Posts, and Recent Comments

Print Version March 17th, 2008

Finally! I have posted the updated (2.5) versions of my post plugins and they are full of enhancements and even the odd fix… Check them out from the plugins page but please take note:

  • They are still beta releases and, given the number of modifications I have made, I am sure I will have a few issues to correct. If you have any problems try reporting them through the in-built bug-reporting tool. Other comments are, of course, welcome on each plugin’s own page.
  • The plugin code has been substantially refactored to minimise duplication and, as a result, the four plugins now share a library. Please take care to read the upgrade directions rather than blundering ahead (the way I usually do myself!).
  • If you have been using the Plugin Output Cache you will need to update to the latest version.

So … new features, new options, and new output tags … and a few bug fixes as well.

New Features

  • Ready for WordPress 2.5 with a new matching admin interface.
  • Random Posts is about twice as fast as before.
  • Similar Posts has had a lot of work. It now uses its own table instead of using custom fields. Tag-based similarity has been added and the balance between content, title, and tags is fully adjustable. You can now add similar posts to your feeds without an extra plugin (Similar Posts Feed has been discontinued). I have supplied stop lists for English, French, German, Spanish, and Italian (with more to come) — and stemming algorithms to match. I also have plans for various refinements and extensions of the similarity algorithm, including some support for Japanese, Chinese and Korean.
  • When used as widgets the plugins have a new option to only show under certain circumstances by using WordPress Conditional Tags like ‘is_single(), e.g.,
    is_single() && is_paged()
  • The plugin display can now be injected on a post-by-post basis by using embedded tags, e.g., <!--SimilarPosts-->.
  • You can now report bugs from the plugin settings pages and automatically send along basic information to aid debugging, like what version of PHP, MySQL etc. are in use.
  • There is now an option to completely remove the plugins and all their settings without having to fiddle with phpMyAdmin.
  • Increased security with proper nonce-protection and better screening of settings.
  • A much better memory footprint, especially when more than one of the plugins is installed.
  • The plugins are set up for internationalisation … but as of yet not translated.
  • It is now much easier to extend the plugins with your own output template tags.
  • The plugins are much more careful of how they handle multi-byte character sets.

New Options (or settings as WP 2.5 calls them)

  • It is now possible to have no output at all if the plugin finds no matching posts.
  • The fallback text when no posts are listed can now contain embedded output tags.
  • You can now choose to only include posts that are more than, or less than, a certain number of days, months, or years old.
  • A content filter can be turned on to expand tags embedded in posts so that plugin output can be injected on a post-by-post basis.
  • The Recent Comments’ option to exclude certain comment authors (which never worked properly!) has been replaced with the option to omit comments left by the post’s author.
  • It is now possible to include ‘&’ in parameters passed by query-string.

New Output Tags

  • {totalposts} and {totalpages}
  • {postid}
  • {postviews}
  • alternate {commentlink2}
  • alternate {excerpt} preserving HTML etc.
  • a variety of ways to crop {title} etc.
  • {image}
  • {categoryid}
  • {commenterip}
  • and {php} which lets you insert your own code!

Bug Fixes

  • Better validation of settings.
  • Fixed an ordering bug in Recent Comments when grouped by post.
  • Fixed a problem on some systems with ‘include’ of relative paths.
  • No longer troubled by the awkward bug in MySQL version 4.1.21.

That should be plenty to play with!

Entry Filed under: WP Plugins

24 Comments

  • 1. Sara  |  March 17th, 2008 at 2:19 pm

    great!

    thank you very much for that update

    greetings

    Sara

  • 2. Nick  |  March 17th, 2008 at 4:05 pm

    Upgraded both Recent Comments and Random Posts as instructed in preparation for 2.5 (currently using 2.3.3). Options subpages don’t display in either plugin. Downgraded.

  • 3. Rob  |  March 17th, 2008 at 4:26 pm

    Nick: That’s a discouraging start! I have sent you a file with a possible fix to see if it helps. Could you please let me know some server details to help finding the problem.

  • 4. Nick  |  March 17th, 2008 at 4:38 pm

    Hi Rob,

    Fix didn’t work. Just to clarify – Options subpage General displays but each subsequent subpage doesn’t, I’m presented with the WordPress interface header and footer only.

    Apache. MySQL 4.1.2. PHP 4.3.9.

  • 5. Rob  |  March 17th, 2008 at 6:30 pm

    Nick: Can you check if 2.5 b3 fixes the issue? Thanks.

  • 6. Nick  |  March 17th, 2008 at 6:42 pm

    Rob,

    2.5 b3 seems to work just fine. Thanks for the quick fix.

  • 7. Nick  |  March 17th, 2008 at 6:52 pm

    Spoke too soon! The subpages work as expected, but the Random Posts plugin is set to display 10 posts but is outputting either 8, 9, or 10 posts arbitrarily.

  • 8. Rob  |  March 17th, 2008 at 9:27 pm

    Nick: Thanks for the help! Try 2.5 b3a.

  • 9. Nick  |  March 18th, 2008 at 12:55 am

    Rob,

    2.5 b3a is still showing a random number of posts – between 7-10.

  • 10. Nick  |  March 18th, 2008 at 11:05 am

    Rob,

    2.5 b3a didn’t fix the issue – it’s still outputting between 7 and 10 posts.

  • 11. Nick  |  March 18th, 2008 at 5:05 pm

    Rob,

    Tested Random Posts 2.5 b3a using WordPress 2.5 RC1 on a server running PHP 5.2.5 and MySQL 5.1.23 RC. The plugin continues to output anywhere from 6 to 10 random posts when it’s set to output 10.

  • 12. Rob  |  March 18th, 2008 at 9:40 pm

    Nick, Sorry, I didn’t catch your comments … akismet keeps marking them as spam! I’ll give the plugin another look.

  • 13. Rob  |  March 18th, 2008 at 10:24 pm

    Nick: I’ve backtracked to the previous version’s code in 2.5 b4. I really do think it’s working properly now. I hope I don’t have to eat my words again!

    Good luck!

  • 14. Nick  |  March 18th, 2008 at 10:40 pm

    Thanks, Rob – Random Posts is now working on both servers, and in WordPress 2.3.3 and 2.5 RC1.

  • 15. Rob  |  March 18th, 2008 at 10:47 pm

    Nick: (sigh of relief!!!)

  • 16. Barend  |  March 22nd, 2008 at 2:00 pm

    Hi. I’m trying to get the most recent comment for each individual posting, displayed under the corresponding posting in archive view.

    But what I’m getting is the same most recent comment displayed with each posting.

    Is it possible to do what I need with this plugin? It seems so close… Thanks in advance.

  • 17. Rob  |  March 22nd, 2008 at 2:40 pm

    Barend: Recent Comments would be overkill for what (I think) you are trying to do. Its intention is do a global listing of comments rather than the comments per post. Maybe the WordPress tag comments_link() would do the job for you?

  • 18. Barend  |  March 22nd, 2008 at 3:38 pm

    Hi Rob, thanks for your reply. Yes it seems like overkill. I thought it would be very straightforward to include the last comment with each post. Your suggestion only puts a link to the comments below the post. What I’d like to achieve is the following:

    ” Post A”
    latest comment on Post A

    “Post B”
    latest comment on Post B

    etc.

    I hope I’m missing something really obvious here, so any help is appreciated.

  • 19. Rob  |  March 22nd, 2008 at 4:38 pm

    Barend: It rather depends on how you are generating the post listing but the following code will get the last comment from a post ID:

    
    function get_latest_comment($post_id) {
    	global $wpdb;
    	return $wpdb->get_var($wpdb->prepare("SELECT comment_content FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date LIMIT 1", $post_id));
    }
    

    Let me know if this helps.

  • 20. Barend  |  March 22nd, 2008 at 5:44 pm

    Rob: thank you so much for thinking along. I’m in slightly over my head I’m afraid. I’m guessing i need to place that code into functions.php, and then how exactly do I call that function in the “loop”? If you want to take this off this list you’ve got my email address I’m sure.

  • 21. Dan at Necessary Roughness  |  March 26th, 2008 at 1:29 am

    Tested Similar Posts 2.5beta9 on my WP 2.3.3, upgrading from previous Similar Posts, and I’m getting nothing but “None Found” for similar posts. Does the similar posts table need some sort of update?

  • 22. Dan at Necessary Roughness  |  March 26th, 2008 at 1:30 am

    btw…I did deactivate and delete the old plugin first. Thanks 🙂

  • 23. Rob  |  March 26th, 2008 at 7:42 am

    Dan: Can you try re-indexing the posts via the Manage|Similar Posts screen? There seems to be a serious issue here that I’d like to solve.

  • 24. Gardening Advice | Winter Gardening | Indoor Gardening  |  September 27th, 2008 at 11:50 pm

    awsome!!! been looking for these kind of plugins – yours seem to be the only ones that provide the functionality I need. Awsome, keep up the good work amigo


Calendar

March 2008
M T W T F S S
« Jan   Apr »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Related Reading