ThinkTwit Update 1.3.1

I’ve released a very minor update yesterday that should get rid of the “file_get_contents” warning that appears for some users within the admin dashboard – when moving some of the methods in to the ThinkTwit class I forgot to make them static which obviously caused some confusion. Thanks to Sunny Chan and Amir Habibi for pointing out the issue and assisting by testing the fix!

Additionally I’ve added Steven Mcphillips as an additional contributor whom I hope can assist with make some minor additions initially and maybe some on-going efforts on the roadmap.

Thoughts on ThinkTwit improvements

For some time I’ve not been entirely happy with ThinkTwit upgrades – development on ThinkTwit started initially as an internal project for a past employer (Think Consulting Solutions). We had been wanting to contribute to Open Source for some time and this seemed like the perfect solution to both problems: Open Source the code I have written.

When I then left my employer, knowing that there was no development capacity left within the business, I decided to continue maintaining ThinkTwit. From then on I have just been adding new features as I thought of them or as they were requested, as and when I had time. As this was just an aside hobby and I didn’t have much time to contribute a lot of the development was rushed (though as professional as possible in the time constraints) and so upgrades have not been as smooth as I had wished. This has been highlighted by two recent bug reports that I have had (which, though I appreciated the feedback, did not impress me – I felt I had let people down).

After a little bit of searching last night I found an article on the “Top 10 Characteristics of a WordPress Plugin” and it got me thinking a bit about how I can improve ThinkTwit, especially around upgrades. So what I’ll be shortly adding:

  • A method of keeping track of all database options to allow for safe removal and updating of all database options
  • A method of backing up old options (to allow rollback), adding new options when necessary and transforming options where they are changed during upgrades
  • Deprecation of old methods for one version, including keeping the original as a deprecated method when a method is renamed or has additions to it (if not possible to alter the method without causing impact)
  • Automated uninstall on request (rather than manual uninstall as is currently offered)
  • Better error handling – currently there is an unsightly error thrown when Twitter is blocking excessive requests (this will be fixed separately) – such errors need to be handled better
  • Reset options function
I will make these additions the priority to ensure that all future upgrades are more seamless to our users. This will mean a further delay if you are awaiting features already in the roadmap but it will be well worth the wait. Additionally, I’m in discussion with a ThinkTwit user about him becoming a contributor to the project so hopefully we’ll be able to work through the roadmap at a quicker pace.
Finally, one thing I’ve noticed is that there is little documentation on how to design and develop good seamlessly upgraded plugins so once I’ve complete these updates I will try to write an article on here describing on how to achieve this.
As always, if you have any feedback or requests for ThinkTwit please let me know.

Better WordPress reCAPTCHA

I’ve added theĀ Better WordPress reCAPTCHA plugin to the blog in order to reduce the amount of spam accounts that are created by bots. Even though Akismet seems to do a good job of filtering the spam, I’ve still gotta delete it and also the users associated with them – it seems to be a good plugin!

I knew I wanted to add a CAPTCHA plugin but I wasn’t sure which to add – this one had a few very high votes so I thought I’d check it out and as it integrates with Akismet I thought I’d give it a go. It’s actually quite clever as it checks Akismet to see if it is spam before prompting for a CAPTCHA, which means it should actually inconvenience people a lot less than others. It also allows you to automatically display comments if the user has previously had comments approved and it’s quite flexible around styling.

If you have any issues with it, or even if you just like it, please let me know.

AJAX-ifying WordPress Widgets

I recently found the need to give AJAX abilities to a WordPress widget. Notably, I had a request from Kjell Martin Bovre of Scribo.no to allow ThinkTwit to update when used with a caching engine, for instance WP Super Cache. Caching engines work by converting the pages of a site in to HTML and, rather than loading the website code using calls to its database, calling these pages directly when a user makes a request.

The first time that a user visits a site with a caching engine the pages they visit will be converted to HTML. After a period of time these pages will get updated, but if you have a particular item on that page that should be updated more often this will not happen. One way to ensure this item is updated correctly is to enable it to use AJAX. The AJAX code will get called whenever the site is loaded, even in its HTML format – therefore it will work even when cached as the Javascript will make a server call, the server will respond with the up-to-date data and the Javascript will then update the HTML within that page.

After a good few hours research I was able to find a site that helped me do most of this, but there were some errors and it did not work with WordPress widgets as it would break their ability to create multiple instantiations. It was therefore necessary to update the code to allow this, so I thought I would just write a quick and easy guide to writing AJAX capable widgets to allow other developers to quickly and easily resolve this issue. I hope it comes in handy!

Continue reading