TwitterX
TwitterX is a MODX extra that loads Twitter statuses, timelines and basic Twitter searches by using the new (and very annoying) Twitter 1.1 API.
View the previous article on TwitterX
Multiple users using &screen_name
Thanks to Huub van der Voort (@hvoort), TwitterX now supports multiple screen_name values. This can be done by specifying a comma-separated list of Twitter usernames:
..
&screen_name=`Qodo,Microsoft`
..
This still supports single screen_names should you only want one. By not specifying a screen_name, it defaults to the user that created the API keys.
Basic Twitter Searches
TwitterX has been updated to now support basic Twitter searches by using the new parameter &search. When using this parameter, screen_name and timeline are ignored.
..
&search=`MODX`
..
This query will be cached as before but can be run much more frequently as this type of query doesn't use the API authentication so is not restricted by the Twitter request limitations. Here's an example of how this looks:
- TwitterX Error: Could not load tweets as Twitter responded with the error: 'Could not authenticate you.'.
Bringing in multiple feeds
Something not mentioned in the last update is that TwitterX now allows you to bring in multiple feeds in separate calls. This can be done by specifying a unique value for &cache_id. TwitterX caches the Twitter data by using the resource ID and if you have more than one TwitterX call on one page, it will think it has already cached the data and will show the first one multiple times. Get around this by adding a unique id for each snippet call:
..
&cache_id=`TwitterSearch1`
..
..
&cache_id=`TwitterSearch2`
..
Bug fixes
- An error in the code was preventing the snippet from outputting errors. This has been corrected and should let you know if there was an error when trying to load the Twitter data.
- A problem reported by Sean Lang meant that Twitter topic links where not working correctly and creating 404s because Twitter changed the URL.
Got something to say?
Join the discussion! You know how these things work; enter your details and comments below and be heard.
Comments 7