Blog Fix: Twitter Tools plugin and WordPress 2.3

I’m going through and reviewing my site after updating it to WordPress 2.3 and it looks like there are still some hidden “issues” stemming from the migration to the new Category/Tagging structure. The latest one that I found is related to the “Twitter Tools” plugin. Update: Some people were reporting…

Written By
Michael Sheehan
Published On
September 25, 2007

I’m going through and reviewing my site after updating it to WordPress 2.3 and it looks like there are still some hidden “issues” stemming from the migration to the new Category/Tagging structure. The latest one that I found is related to the “Twitter Tools” plugin.

Update: Some people were reporting that “term_ID” was not working where “ID” was in capitals so I have changed the code references below to lower-case (e.g., “term_id”). Remember to retype your quotes!

Here is what I did to fix:

- Advertisements -
  1. Find, (Download), Open and Edit the “twitter-tools.php” file which resides in the “wp-content/plugins/twitter-tools/” directory
  2. Locate the following lines of code (around line 868):

    function aktt_options_form() {
    global $wpdb, $aktt;
    $categories = $wpdb->get_results(”
    SELECT *
    FROM $wpdb->categories
    ORDER BY cat_name
    “);
    $cat_options = ”;
    foreach ($categories as $category) {
    if ($category->cat_id == $aktt->blog_post_category) {
    $selected = ‘selected=”selected”‘;
    }
    else {
    $selected = ”;
    }
    $cat_options .= “\n\t<option value=’$category->cat_id‘ $selected>$category->cat_name</option>”;
    }

    and change it to:

    function aktt_options_form() {
    global $wpdb, $aktt;
    $categories = $wpdb->get_results(”
    SELECT *
    FROM $wpdb->terms
    ORDER BY name
    “);
    $cat_options = ”;
    foreach ($categories as $category) {
    if ($category->term_id == $aktt->blog_post_category) {
    $selected = ‘selected=”selected”‘;
    }
    else {
    $selected = ”;
    }
    $cat_options .= “\n\t<option value=’$category->term_id‘ $selected>$category->name</option>”;
    }

    Note: you may need to change the quotation marks if you cut and paste from this entry. Simply highlight the quote marks and enter them again using your keyboard. (Sorry about the loss of code formatting…there are tabs in there to nest things properly but it shouldn’t affect the code.)

    • The database items that changed are (pre-2.3 –> post 2.3):
      • categories –> terms
      • cat_name –> name
      • cat_id –> term_id
  3. Save your changes to the twitter-tools.php” file and save to the “twitter-tools” plugin directory. That’s it!

HTD Says: More tweaks to themes and plug-ins because of WordPress 2.3 upgrade potentially coming. Stay tuned.

- Advertisements -