Twitter Tools Plugin Problem Solved

Posted on Feb 12, 2010 in Wordpress
Twitter Tools Plugin Problem Solved

In the last couple of weeks I’ve been having some problems with Twitter Tools . For some reason , after I upgraded Wordpress to 2.8.6 the plugin stopped working . Whenever I tried to test my user ID and password I got this message :

Sorry, login failed. Error message from Twitter: Rate limit exceeded. Clients may not make more than 150 requests per hour.” .

So I upgraded WP to 2.9.1 , reinstalled the plugin and tried again …. with no luck . I Googled the message and found out that I wasn’t the only one with this problem. Those solutions didn’t work so I uninstalled the plugin (again) and tried an earlier version . This didn’t work either . I started looking for other solutions . This one didn’t work because of my server’s settings , but I found CSS Trick’s “Build your own Social Home” post. They’ve used Twitter’s API and a bit of JSON to load and display tweets on the page.

This is the code I use to display tweets on my home page . It’s basically the same , with some small changes.

<script type="text/javascript">
$(document).ready(function(){
		$.getJSON('http://twitter.com/status/user_timeline/iacobionut.json?count=2&callback=?', function(data){
		$.each(data, function(index, item){
			$('#twitter-home').append('<div class="tweet"><p>' + item.text.linkify() + '</p><p><em>' + relative_time(item.created_at) + '</em></p></div>');
		});

	});
function relative_time(time_value) {
	  var values = time_value.split(" ");
	  time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
	  var parsed_date = Date.parse(time_value);
	  var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
	  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
	  delta = delta + (relative_to.getTimezoneOffset() * 60);

	  var r = '';
	  if (delta < 60) {
		r = 'a minute ago';
	  } else if(delta < 120) {
		r = 'couple of minutes ago';
	  } else if(delta < (45*60)) {
		r = (parseInt(delta / 60)).toString() + ' minutes ago';
	  } else if(delta < (90*60)) {
		r = 'an hour ago';
	  } else if(delta < (24*60*60)) {
		r = '' + (parseInt(delta / 3600)).toString() + ' hours ago';
	  } else if(delta < (48*60*60)) {
		r = '1 day ago';
	  } else {
		r = (parseInt(delta / 86400)).toString() + ' days ago';
	  }

	  return r;
	}

	String.prototype.linkify = function() {
		return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) {
			return m.link(m);
		});
	};

});
</script>

I still have no idea why Twitter Tools doesn’t work , but this solution is really easy to use if you have the same problem.

Enjoyed this post ? Subscribe and Share

  • RSS Feed
  • Get Email Updates
  • Digg
  • Del.icio.us
  • StumbleUpon
  • DesignFloat
  • Reddit

2 Comments

  1. Sanjay says:

    thanks, i will have a look at this one. since upgrading to 2.9 WP has been an issue. glad i am not the only one!

  2. Everything works fine on the blog, but for some reason my twitter shows an error message!! I can’t tweet.I can’t even log out of the account once this error message comes on. I am not sure what the problem might be.

Leave a Comment