Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By juampynr on
Since a few months ago the Twitter Developers Blog has been announcing an API cleanup which states that the REST API 1.0 will stop working in the coming days.
This is the list of modules that currently use the old REST API 1.0:
- Twitter Pull. There is a patch that makes a dependency with the Twitter module in order to use the new API.
- Twitter Block.
- Twitter Follow Block.
- Twitter DB.
- Twitter username.
- Twitter Profile.
What I suggest is that these modules depend on Twitter module and change their API requests for the following:
// Connect to Twitter.com and retrieve favorite tweets.
module_load_include('inc', 'twitter');
$twitter = twitter_connect();
if ($twitter) {
try {
// The following retrieves favorite tweets for a user account. See the Twitter class at
// http://drupalcode.org/project/twitter.git/blob/refs/heads/7.x-6.x:/twitter.lib.php for a full list of available methods.
$statuses = $twitter->favorites_list($screen_name);
} catch (Exception $e) {
// Network errors can throw a Twitter exception, which we catch silently.
}
}
Thoughts?
Comments
A nice quick fix
It sounds like a nice quick fix. I'll try it...
Hi. I'm the maintainer of the
Hi. I'm the maintainer of the twitter_username module.
Thanks for the tips about the Twitter API Change. I made a new release of my module which no longer use Twitter API.
I could not make it work
I could not make your code work on Twitter DB. But I have anyway changed the way the module retrieves tweets, so it works with new Twitter API 1.1 now, without any dependencies...
Consumer key and secret?
@dhavyd, how does a user obtain the Consumer key and Consumer secret that he needs to enter at the Twitter DB settings form? I saw these at http://drupalcode.org/project/twitter_db.git/commitdiff/a13f86f.
You can get them on your Twitter App page
You can get them in your Twitter App page...
Hi, Thank you for this, I've
Hi,
Thank you for this, I've committed your patch into a 2.x branch on Twitter Pull. I think this is a good way forward. It makes no sense for all of us to try to OAuth with Twitter through our own mechanisms.
Great!
Glad to know is helping. Any suggestion to make Twitter Oauth support easier for contrib modules is more than welcome.