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!

Better Tag Cloud