The right 3 bytes
OR
wordpress plugin bugs solved

A few weeks ago I noticed a very strange bug with all of my wordpress plugins in the newest version of wordpress (2.7). All of the plugins can be used as widgets. When I tried to add one of plugin widgets to the sidebar, it seemed to be okay, but when I clicked on “save changes”, it would disappear. I then later discovered that it was sort of added. If I checked “show unused widgets”, then I would see my widget in the list, and if I tried to add it from here, the changes would stick.

A couple weeks ago I spent several hours trying to figure out what had changed in the widget handling code from wp 2.6 to 2.7, and decided to start from a wordpress default widget – the text widget, and see if I could get it to work, and then gradually change it to my plugin. I made some pretty good progress, but at the end I could not figure it out. I knew that I needed several hours of solid work to unravel the mystery, and with the holidays and moving across the country, I didn’t find the time until today.

But today I finally figured it out, and it actually only took me about an hour. It turns out I needed to change 3 bytes (characters). I happen to like mixed case, so many of my variables and such in my code look like “collapsArch”, or “collapsLink”. It turns out that the widget id in wp 2.7 will not allow mixed case. Or rather, it will exhibit the strange behavior I have been seeing. So changing “collapsArch” to “collapsarch” in 3 places in the widget handling code fixed the problem.

I have released updates to all 4 plugins today, along with a new debugging option, which should make it easier to solve possible problems. When the debug option is selected, some debugging information gets written to the page in a hidden <pre> environment. This way you can see what is going on by viewing the source, but most visitors will not notice the fact that you are debugging.

This entry was posted in php, wordpress and tagged , . Bookmark the permalink.

6 Responses to The right 3 bytes
OR
wordpress plugin bugs solved

  1. Glad to hear you got the problem with activating the widgets fixed. Makes it much easier to use them.

    While I was trying to get a different plugin working, I figured out that your plugins are the cause of an annoyance on my dashboard. This is my Akismet stats page normally. If I have any of the Collapsing Links, Archives, or Categories plugins activated, it looks like this. The window to the stats is only about 100 pixels, and I can’t re-size it. I don’t know if the Collapsing Pages has the same effect, I have not tried it.

  2. robfelty says:

    @Tom,

    Thanks for pointing that out. I have fixed that issue in all 4 plugins now.

    Rob

  3. cindy says:

    Thank you for updating the widgets. I’ve been using them for long and am quite happy with it.

    The new update to the Collapsing Categories widget seems to have problem on my wordpress 2.6 though. (Please see my blog for example. It’s Chinese, but you can see under the categories heading, there are only 2 categories.) I used to have 11 categories. They are not showing up now.

    Could you advise how do I go about fixing it?

    Thank you!

  4. cindy says:

    Thank you for updating the widgets again. They work perfectly now!

  5. Drew says:

    Hi Rob, love the plugins. They have made my life so much easier! With regard to the collapsible archive, is there a way of restricting it to only one category if most of your posts are multi-category? The category i want to display is a single category. Much appreciated

  6. I really like and appreciate your post. Really Cool.