Twitter Block - Drupal Module

This is related to the Twitter status you see on my homepage.

Update: There will be no support for Twitter Block module. Please use Twitter module instead. Read the reasoning here.

Styled Twitter Block

I was browsing around, when I came across Aaron's on adding Twitter to a Drupal site. Since I am in the process of redesigning my site, I was a little more aware of the closure variable and hence I commented so on his post. He nudged me on his respone through Twitter.

Thus, I created the Twitter Block module. It is quite minor and straight forward at this moment and advanced modules have already been coded. (See the modules download page over at

Download module: Twitter Block

I am yet to put the license files, but it is provided under GPL. The installation is simple - just copy to your modules or sites/all/modules folder. You should get the Twitter Block menu in the admin/settings once you enable it. It lets you configure:

  • Twitter User Account
  • Twitter Block Title
  • Disable/Enable Follow Me link
  • Text of the Follow Me link

As far as the comment goes, I was able to add the Javascript references to the $closure variable. For a background, you can see from Twitter page, that putting the Javascript references near the footer increases the page load times.

Hot tip! To ensure loading of your page even in the case of non-loading, move the two lines that start with <script type="text/javascript"... to the bottom of your page (just above </body>).

While coding this module, I took a wrong turn with the drupal_add_js() function, and after some trial and error, use the hook_footer() to get these Javascripts into the $closure variable properly.

Once you install and configure this module, you can sytle it by lathcing on to the block-twitterblock class. You can see the result of my current theming on the Twitter Block.

Credit goes to DryIcon via SmashingMagazine for providing the Twitter icon.


But as Eaton mentioned over at your blog - now I am wondering why I did not use the Twitter module itself. Going to download that and give it a try.

Dear Vyoma,

i'd like to add an Icon, maybe the original twitterlogo, instead of the titletext. But adding code to the title box in the backend isn't possible. The right codeposition i'm not skilled enough to edit correctly. Might you give this feature request a little glance?

Thankls a lot
Mike Gutzschhahn

There is a blank space needed between the twitter item and the date/time. Right now they run together but they should be separated by a space.

Thanks for a great addition to Drupal!

Add new comment