More TweetSuite Fixes

As I've written before, I love TweetSuite, the best plugin I've found for integrating Wordpress blogs with Twitter. Unfortunately, it's still in beta, and there are a few bugs yet to be worked out. While we wait for Dan Zarella, Tweetsuite's creator, to release a new version, I've come up with some quick stop gap measures that make the current version (0.7) work fine for me.

Here's a list of the problems and the solutions. All involve editing the file "TweetSuite.php" which should be located in the main plugin directory. (As always, when making changes to code, be sure to type them exactly as they appear here, including capitalization.  And be sure to back everything up before messing with it!)

 

Problem: Widgets don't update, or only update occasionally.

Solution: I detailed the fix for this problem here.

 

Problem: Tweetback buttons appear on single pages, but not on posts on the blog home page.

Solution:  This seems to have been a conscious choice on Dan's part, since the code is written to explicitly act this way.  I would suggest that it eventually be made configurable.  In the meantime, if you'd like Tweetback buttons to appear with posts on home pages, make the following adjustment:

In 'TweetSuite.php' search for:

function addTweetBacks($content) {

It should be around line 137.

Directly below that, you should see a line that reads:

if( is_single() ) {

Change it to:

if( is_single() or 1==1) {

That should do it.  The way this works is simple.  The 'if' statement, in the original, is checking if Wordpress is generating a single page.  (That's what 'is_single()' does.)  If it is, it runs the code between the if statement's brackets.  By adding 'or 1==1' my change ensures that the code will always run, since, in this universe at least, 1 always equals 1.  This may look a little silly, but it seems the easiest way to implement the change while make the minimum impact on the original code.

 

Problem: 'RetweetThis' button doesn't appear/creates a broken link

Solution: It looks like TweetSuite is intended to have the ability to display a very nice 'RetweetThis' graphic, with the number of existing retweets embedded in the image.  The problem is that, to do this, Dan is relying on a module that is not included with every build of PHP.  (PHP is the programming language Wordpress uses.)   If your server doesn't provide that module, you're probably seeing one of two things, depending on your browser:  In Explorer, you'll see the dreaded 'broken image' graphic.  In Firefox and its cousins, you'll see nothing.

The following fix just simplifies the whole thing.  It displays the graphic, without trying to embed the existing retweet count.  For my own purposes, that's fine. 

Here's how to do it:

Search for the following code:

if(!$float) { $float = 'left'; }

It should be around line 185.

Directly below it, before the next line of code, insert the following:

$src = WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__))."/rt_this.gif";

Now the plugin will just add the 'rt_this.gif' graphic, without trying any sophisticated image manipulation.

If you stop there, you should see the 'RetweetThis' button at the start of each post.  If you applied the fix above (under Problem: Tweetback buttons appear on single pages, but not on posts on the blog home page) you'll see it with the posts on the home page and on the permalink pages.  Otherwise, just on the permalink pages.

One problem with this behavior:  I'd prefer the RetweetThis graphic on it's own line, at the end of the posts.  Here's what to change to achieve this:

Directly below the line you just inserted, you should see:

$content = "<a href='$tweetthis'><img border='0' style='float:$float; margin-right:5px;' src='$src'></a>".$content;

Erase that line.  Replace it with the following:

$content = $content."<a href='$tweetthis'><img border='0'  src='$src'></a>";

Now the graphic should appear directly after your post.  (I've removed 'float:$float' since it wasn't working anyway.)

 

Problem: Posts always say "Be the first to Tweet this post" and give a count of zero, even when posts have been ReTweeted

Solution: If you added the fix above, you should now have a very nice 'RetweetThis' graphic accompanying your posts.  As far as I'm concerned, once that's working, you don't really need the 'Be the first to Tweet this post' text.  So my solution is to just remove it.  Here's how:

Search for:

return $content . $output;

It should be around line 189.

Erase it and replace it with:

return $content;

That circumvents the whole process.  The extra line is never added, and the posts look nice.

 

That's it!  Enjoy using TweetSuite, and here's hoping Dan finishes it up soon.

Share on Facebook and other services:
  • Facebook
  • Twitter
  • MySpace
  • Digg
  • del.icio.us
  • Print this article!
  • E-mail this story to a friend!

Tags:

4 Responses to “More TweetSuite Fixes”

  1. [...] Gallery | About UsSpecializing in web design and marketing « Blog Setup: Nice PermaLinks More TweetSuite Fixes [...]

  2. [...] detailed several more TweetSuite fixes, [...]

  3. csabot says:

    Thanks for these fixes – very helpful!

  4. I have suddenly started facing a problem with TweetSuite – the short links do not seem to show on my Twitter page
    Visit http://twitter.com/dubaidirectory

    This used to be working fine, but suddenly developed this problem.

    I have tried deactivating TweetSuite, and activating it again, also deleted and installed again, yet this problem persists.

    I would appreciate it if you could find a solution.

    Thanks.

Leave a Reply