Repeatable: Always (three attempts)
Steps to repeat:
1. Upgrade Drupal Core from 7.14 to 7.17
2. Upgrade Twitter module from 7.x-3.0-beta4 to 7.x-4.1
3. Install Twitter library from github in libraries /sites/all/libraries/twitter/ directory
4. Install Oauth module 7.x-3.0
5. Run update.php
6.. Configure Twitter module with oauth consumer key and secret
7. Clear caches
8. Run cron from Drupal Administration

Expected Results:
Cron runs successfully and Twitter feed gets latest information

Actual Results:
After pressing the "Run cron" button, there is a ~2 second pause and then a white screen results. This error is generated:

Fatal error: Call to a member function user_timeline() on a non-object in /var/www/staging/sites/all/modules/contrib/twitter/twitter.inc on line 139

Line 139 in twitter.inc: $statuses = $twitter->user_timeline($account->id, $params);

Twitter feed does not update, and cron is not run successfully. With the Cron Debugger module, when cron is run with the Twitter hook disabled, cron runs normally. No error is logged, but the following message from the Cron Debugger module appears when the page is refreshed:

Cron presumably failed while running the cron hook twitter_cron() in the module twitter.

Note: When Twitter module was upgraded, it was not disabled first due to other module dependencies. The directory twitter was simply deleted, then the new version replaced it, and update.php was run. When Oauth was installed, it automatically was enabled. Also, here are the Twitter settings in the configuration:

Twitter host: http://twitter.com
Twitter API: https://api.twitter.com/1/ (also tried without the "1/" at the end)
Twitter Search: http://search.twitter.com
TinyURL: http://tinyurl.com

Oauth settings are configured with the dev.twitter.com, with the key/secret combination reset and re-input several times and the callback URL correct.

Comments

adamdash’s picture

Issue summary:View changes

Mistake: error logging wasn't set up properly, the above error was generated referring to: Fatal error: Call to a member function user_timeline() on a non-object in ( $statuses = $twitter->user_timeline($account->id, $params);)

adamdash’s picture

Status:Active» Fixed

I'm marking the issue as fixed - I was able to track down that it was the change from not requiring Twitter to authenticate to requiring it. When the Twitter account was removed and readded (in the user settings), and then authorized, everything started working.

betarobot’s picture

Status:Fixed» Active

I'd reopen ticket. The issue is: it's ok if you have one user and you (re)authorise it with twitter, but if there are aplenty?

I think instead of showing this error message (for me it comes at the bottom of every the page, because I have twitter block?) twitter module should have a message / call to action at user account screen (main screen, not only twitter) to update users's account with twitter authorisation.

juampynr’s picture

Version:7.x-4.1» 7.x-4.x-dev
Status:Active» Fixed

This issue has been fixed in 7.x-5.0. Download it from the projects homepage.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

vibrasphere’s picture

Status:Closed (fixed)» Needs work

Drupal 7.19 here. Tried 7.x-5.4 and latest dev and I get:
Fatal error: Call to a member function user_timeline() on a non-object in /sites/all/modules/twitter/twitter.inc on line 197

I also started getting this error after upgrading from older versions. Error crashes down the site when cron is executed manually for example. OAuth and everything installed and configured.

Ambient.Impact’s picture

I'm also getting the error as mentioned in #5 above, with the same versions, after upgrading from 3.x.

eosrei’s picture

Status:Needs work» Active

Setting correct status. There is no patch here.

juampynr’s picture

Title:Upgrade prevents twitter_cron() from running, breaks module» twitter_cron() breaks when there are no authenticated accounts
Version:7.x-4.x-dev» 6.x-5.x-dev

I think that you only have unauthenticated Twitter accounts installed, and no authenticated ones.

I have added a check to prevent twitter_cron() to proceed when the above scenario occurs.

http://drupalcode.org/project/twitter.git/commitdiff/e42ed34

Also I suggest you to upgrade to 7.x-5.x. It does not need libraries module and has an improved UI.

juampynr’s picture

Status:Active» Fixed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary:View changes

removed client information