Chip's Tips for Developers

Contains coding, but not narcotic.

A couple of relieving fixes for Jerome’s Keywords 2.0 beta

September 8th, 2007 1:49:11 pm pst by Sterling Camden

Since I haven’t heard from Jerome in quite a while, I took it upon myself to fix a couple of nagging problems in the Jerome’s Keywords plugin for WordPress:

  1. When editing, moderating, or deleting comments, the tags on the post get deleted.
  2. Some users get a nasty duplicate alias SQL error due to the combination of other plugins with JK.

The download below should fix both of those.  If/when Jerome incorporates these fixes into his next version, I’ll take down this copy and point to him instead.

In the first case, I removed the action hook for ‘edit_post’.  This gets triggered when the comment count changes, and the action for it deletes all tags and re-adds them from the request.  Unfortunately, if the request doesn’t contain any tags (as in the case with editing comments) you lose your tags.  It turns out that the ‘save_post’ and ‘publish_post’ actions are sufficient for handling cases where you can edit the tags.

In the second case, it seems that the ‘posts_join’ action gets triggered more than once.  So I changed this action to build the join clause we need in a separate variable, then make sure it doesn’t already exist in $join before appending it. I made a similar change to posts_where as well.

UPDATE 9-17-2006: Found a bug in my correction for the duplicate alias error, and applied the changes to the beta 3 version.

Happy tagging!

Posted in PHP, Web, Wildly popular, WordPress | 7 Comments » RSS 2.0 | Sphere it!

7 Responses to “A couple of relieving fixes for Jerome’s Keywords 2.0 beta”

  1. [...] Chip has released a modified version of Jerome’s Keywords, that’s meant to fix it, but for some reason I still get the error. I’m going to take a look at it later when I have more time, but for now I’m just hiding any links that lead to the tag search pages. [...]

  2. Roger says:

    Chip is the download beta2a here a mmodified version of Jerome’s version beta2 or beta3?

    Thanks.

    - Roger

  3. Beta 2. Is there a beta 3?

  4. Actually, I think it’s beta 3 — but it looks like Jerome didn’t update the comment at the top.

  5. I’ll have to compare…

  6. Roger, thanks for the heads up — I had NOT used beta 3. But I have now updated the download.

    I also discovered that I made the old !strpos mistake in my correction to the duplicate alias error. I’ve fixed that, so hopefully nobody will get that anymore!

  7. [...] I ran into yesterday (not for the first time) is PHP’s partial distinction between false and zero.  In [...]

Leave a Reply

Better Tag Cloud