Display Status Updates With Twitter Pull Module

UPDATE: The Twitter Pull module uses the Twitter REST API 1.0 which has already been deprecated and will be shutdown in the next two months. There is an issue open to upgrade Twitter Pull to use the REST API 1.1. A big thank you to R. van ‘t Westende for this comment.

The Twitter Pull module is a light weight solution for pulling in and displaying twitter status updates. The module integrates with the Boxes module and makes it really easy to present a box with a user’s timeline, hashtag results and twitter search results. At its core, the Twitter Pull module is a simple API for pulling in status updates. If you are looking for a more generic solution for Drupal, look at the Twitter module.

Twitter Pull module does not post status updates to Twitter. If you need to push status updates from a Drupal site, use the Twitter module.

Getting Started

Download and install the Twitter Pull and Boxes (optional) module from Drupal.

Run the following Drush command to download and install:

drush dl twitter_pull boxes
drush en twitter_pull boxes

Twitter Pull API

We’ll first look at the Twitter Pull API as this is the most important part of the module. The main API function is twitter_pull_render().

Here is what the function signature for twitter_pull_render() looks like:

function twitter_pull_render($twitkey, $title = NULL, $num_items = NULL, $themekey = NULL, $lazy_load = FALSE) {
}

The most important parameters are the first three, $twitkey, $title and $num_items. The $twitkey variable allows you to pull in a user’s timeline, hashtag results and twitter search result. Here are some examples:

  • @drupal: This will pull in the @drupal timeline.
  • #hashtagdrupal: This will pull in search results for the #hashtagdrupal hashtag.
  • drupalsearch: This will pull in search results for the drupalsearch keywords.

The $title variable allows you to define a title for the Twitter Pull block, and the $num_items variable allows you to define the number of returned results.

If you were to run the following code:

print twitter_pull_render('@drupal', 'Drupal Title', 10);

You should see a list of ten status updates with the title, “Drupal Title”.

Fig 1.1

Integration with Boxes

As stated early, the Twitter Pull module integrates directly with the Boxes module. It allows you to create status listings without writing any custom code.

How To

Make sure you have downloaded and installed the Boxes module.

1. Go to Structure -> Blocks (admin/structure/block) and click on the “Add twitter box” link.

Fig 1.2

2. Fill out the form using the values defined in Table 1.0.

Table 1-0. Define a Twitter Pull box

Option Value
Machine name twitter_drupal
Box description Displays @drupal’s timeline.
Box title @drupal’s timeline
Twitter search @drupal

3. Once you have filled out the form, click on the Save button.

4. Finally, place the new box into a region.

5. Go to the front end, and if everything is working you should see a block loaded with status updates.

Fig 1.3

If you have any questions, please leave a comment.

Ivan Zugec

About Ivan Zugec

Ivan is the founder of WebWash and spends most of his time consulting and writing about Drupal. He's been working with Drupal for 12 years and has successfully completed several large Drupal projects in Australia.

3 thoughts on “Display Status Updates With Twitter Pull Module”

  1. R. van 't Westende

    Hi Ivan,

    We were using the twitter_pull module aswell, but due to developments at Twitter and with this module I am not sure this is a good recommendation at this point.

    I would like to point out that in two months Twitter will have moved completely to API version 1.1 according to https://dev.twitter.com/blog/changes-coming-to-twitter-api.
    Also it doesn’t look like the twitter_pull module will be compatible with Twitter’s new API. See http://drupal.org/node/1781024.

    Besides this Twitter also moved from Display Guidelines to Display Requirements. See https://dev.twitter.com/terms/display-requirements.

Leave a Comment

You have to agree to the comment policy.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Media Management in Drupal

Download a FREE 8 part video course on managing media in Drupal.