Just worked on adding support for lang and geocode parameters for the request to search.twitter.com.

Example usage:

  $geoloc = array(
    'latitude' => '4.631385',
    'longitude' => '-74.080925',
    'radius' => '200mi',
  );
  if (function_exists('twitter_pull_render')) { 
    print twitter_pull_render('#drupal', 'Drupal en Colombia', 10, NULL, 'ES', $geoloc);
  }

Performed some testing on it, though I think some testing from the people interested in this functionality would be of great help. I didn't test if custom templates still work with this patch, but I'm pretty confident they do.

Also, there are some parts that need to be done (e.g. good validation for new args) and some others refactored.

Comments

jedihe’s picture

Created patch with --no-prefix option (IIRC it is necessary to apply it more easily on a CVS repo).

irakli’s picture

Priority: Normal » Major

I really like this, but need to review.

Many thanks!

Hanno’s picture

for now, this will probably work if you want to filter on language (works at least in the D7 version, doesnt work for geolocations):
<?php echo twitter_pull_render('drupal lang:en'); ?>

Franz-m’s picture

I tried the patch (both versions) on 6.x-1.1 (and 6.x-1.2).

It gave an error "5 out of 5 hunks FAILED ...".

The module still worked without lang/geo params, but if I (nevertheless) tried them, it gave a watchdog-error:
"Non-empty list of tweets returned blank space after applying theme function ..".

Did anybody get "language" (that's what I'm looking for) working?

jedihe’s picture

Hi Franz,

It seems twitter API had some kind of change, since an implementation I used this module for (patched with #1) stopped working correctly suddenly after being months active without problems. Haven't had the time to check for it carefully, though...

Franz-m’s picture

Priority: Major » Normal
Status: Needs review » Needs work

Status update ..

jedihe’s picture

I just found the cause for the problem I was having (Twitter API returning empty result set): the lang parameter must conform to ISO 639-1 lang-codes, which uses only lowercase characters; taking that into account, the example at the opening post must be adjusted to:

  $geoloc = array(
    'latitude' => '4.631385',
    'longitude' => '-74.080925',
    'radius' => '200mi',
  );
  if (function_exists('twitter_pull_render')) { 
    print twitter_pull_render('#drupal', 'Drupal en Colombia', 10, NULL, 'es', $geoloc);
  }

As for the patch not applying, I don't have time now to re-roll it; please try to apply it by hand, it's not hard at all. Of course, doing that poses some risk, so you are on your own when doing it.