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.

ThinkTwit Update 1.2.2

Have finally found to add another update to ThinkTwit – it’s been just over a month since the last release as I’ve had a lot on in work. I set down today to make 3 minor changes, one of which was in the FAQ, and ended up making 7 changes in total:

  • Fixed incorrect PHP function call example in FAQ
  • Fixed incorrect “Show Username” type in FAQ
  • Fixed incorrect boolean values in FAQ
  • Removed silly copyright statement in comments
  • Added link to FAQ within Plugins description to aid use of shortcode
  • Fixed (intermittent) bad check of boolean for displaying avatars
  • Function call and added limit to the maximum days of tweets to be output (at the request of Keith this week)

NOTE: if upgrading and already using PHP function call please add the max_days parameter after limit - parameter 5.

In addition to these changes I found two further bugs which I’ve added to the roadmap, one of which I realised I’d made a hideous oversight (passing each individual argument to the PHP function call rather than simply passing args). I’ll try to get on these a little sooner this time.

ThinkTwit Update 1.2.1

Just released a minor ThinkTwit update (1.2.1). It basically includes some pieces I wanted to include in 1.2.0 but didn’t have time, as I like to update in discrete units and to finish them before taking a break – although this break was smaller than I intended, I got a bit bored :/

It just includes some donation code, should you wish to donate to ThinkTwit’s development, and a quite useful ability to expand and contract sections of the ThinkTwit widget settings.

jQuery in WordPress Widgets admin pages

I’ve been struggling for a few days with trying to get jQuery working within the widgets part of the WordPress 3.2.1 admin pages. Even the most basic of tests does not seem to allow me to, for instance, append some text to a div, using:

<div id="test">Test: >/div>

<script type="text/javascript">
  jQuery(document).ready(function($){
    $("#test").append("HELLO!");
  });
</script>

It seems to work fine within the widget on the front page, but as soon as I try to use any jQuery within the admin pages it seems to mess up. There are a few articles out there suggesting how to get it working but everything I’ve tried so far seems to fail.

So in the meantime, until someone works out how to get this working (because I give up!), I’ve hacked the code used to expand the widgets themselves when placed in the sidebar. Hopefully someone else who’s also struggling to achieve what I have attempted will find this useful:

<div class="widget" style="border: 0">
  <div class="widget-top" style="border: 0; background: inherit; cursor: default; width: 94%">
    <div class="widget-title-action"><a class="widget-action hide-if-no-js" href="#available-widgets"></div>
    <div class="widget-title" style="padding: 6px 0 0"><h3 style="margin: 0; cursor: default">General Settings</h3></div>
  </div>
  <div class="widget-inside" style="display: block; border: 1px solid #DFDFDF; padding: 5px; width: 86%;">
      // Your menu here
  </div>
</div>

If you wish to have your menu start expanded when the page is loaded the above code will do the trick. However, if you want it contracted then you will have to remove “display: block” from the div with the class named widget-inside.

Hope that helps!

ThinkTwit Update 1.2.0

I’ve just released a new minor release of ThinkTwit – version 1.2.0. This release demanded a minor release (e.g. 1.x.0, rather than maintenance, e.g. 1.1.x) due to a significant re-write of the code – specifically around the visibility of functions.

The ThinkTwit class now contains all of the core functionality that operates on processing data within ThinkTwit (the tweets), especially caching and output. The only code outside of this is the Tweet class, code to register the widget, and handling of shortcodes and public function calls.

Many new features have also been introduced and there has been a major update of the readme and screenshots to reflect the changes made:

  • Massive update to the readme, including updated screenshots
  • Re-write of code to make better use of object orientation and private/public functions
  • More flexibility in shortcodes and output anywhere function (thinktwit_output) – including ability to use caching
  • Introduced ability to alter time output text e.g. “This happened 16 minutes ago”
  • Added class to style error message when using AJAX
  • General readability improvements to code

Hope everyone finds this useful – if you have any comments please make them below, including any requests for new features (feature list available on the ThinkTwit page).

NOTE: After updating you may need to go in to your widget settings and press Save if you find that your times (e.g. “This happened…”) do not show.

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.

ThinkTwit Update 1.1.6

So I recently noticed that although my last update included caching, there were some times in which the cache would not be accessed correctly – specifically, when updating from Twitter it was overwriting the cache rather than updating it and then displaying the cache. This wouldn’t be a problem if the live update was full of tweets, but if it had only one it would overwrite the cache with only 1 tweet.

Additionally, have split the Live option in to “Live (uncached)” and “Live (cached)”. The former will not use the cache at all and will always go straight to Twitter (meaning if Twitter is down it will not display anything) and the latter will always check for updates from Twitter (rather than waiting x since last update to check it) and then store the updates in the cache before displaying cached tweets.

I’ve updated the ThinkTwit page on my blog with the roadmap as during this update I’ve realised a few other minor bugs. I’ll get on to these in the coming weeks.