Closed (cannot reproduce)
Project:
Twitter
Version:
6.x-2.6
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Apr 2009 at 03:46 UTC
Updated:
19 Nov 2011 at 22:59 UTC
Hi there,
This module appears to not be updating twitter statuses every cron run... In fact, it only updated it when I created registered a new twitter account on the drupal site. Is there something I'm missing? You can view the site here: http://moddinghq.com (it's the block below Who's Online - ModdingHQ Tweets). The view I'm using is fairly straightforward, and is unlikely to be the source of the problem as the tweets shown in the profile pages aren't being updated either. Cron is being ran every 1 hour. No errors have been reported with the cron run.
The exported views data can be found at http://pastie.org/456661
Thanks for any help, this module is most promising.
- Wayne
Comments
Comment #1
watbe commentedPlayed around with settings and guess what - all is well =)
Thanks for the excellent module and sorry to disturb you.
Comment #2
aschiwi commentedHey watbe,
What exactly helped you when playing around with the settings? I have the same problem you had. I have a block showing tweets and it's not updating. the page on the user account page actually does have the latest tweets, but I kinda need the block to do the same ;)
Thanks
Anja
Comment #3
watbe commentedCan't remember for sure, but these settings were set in admin/settings/twitter
Import Twitter statuses - TRUE , Delete old statuses: NEVER.
And make sure that individual twitter account setups (in the account page) have import ticked.
This seems to work well for me, hopefully you can get it working as well :)
Comment #4
aschiwi commentedHey thanks for your reply :-)
I got it working now by removing the uid argument from the block view, since I only want the one twitter account to show up for everybody.
Comment #5
LaurenH commentedI've checked "Import Twitter Statuses," and set "Delete old statuses" to "never," but I still seem to have trouble getting the Twitter feed to update unless I run cron.php while logged in. Am I correct in assuming that cron is only running with anonymous user privs? Is there a way to change this?
Comment #6
candygirl777 commentedI'm also having the same problem - when I initially set up the Twitter block, it imported the statuses, but won't update, and I've tried everything above. Any help will be greatly appreciated!
Comment #7
candygirl777 commentedComment #8
alastair commentedSubscribing. This is a problem for me too; I haven't managed to import any Twitter statuses to my site at all yet.
Comment #9
_adesmith commentedI too have tried the above, but to no avail. I even tried poormanscron as my host does not allow scheduled cron runs, but still no dice.
However I have found a work around by 'cheating'. It has proven to be 100% reliable for me, if all you want is the twitter feed & you're not too fussed over the aesthetics etc. Simply obtain the code for a widget from twitter.com (it's in their goodies section). Enter your account details, grab code & paste into a new block that you have created especially.
The widget's code does all the hard work, updates on page refresh etc, and works just like a feed. I suppose that's because it is a feed.
Like I said, it is not that bright an answer, retro-code even, but if you're stuck on a poor hosting deal like me, well...
Comment #10
YK85 commentedsubscribing
Comment #11
dhouse109 commentedI ran into this problem just today and found a quick fix, but nothing in code to really patch it up.
I manually added the user I wanted tweets from to the {twitter_user} table. That solved it.
INSERT INTO `twitter_user` VALUES ($twitter_user_id_num, $twitter_user_screenname, NULL, 1);
Initially the table was empty. I added this same user using the Twitter Setup config, and saw the username again and again when I came back to the form. But when I started inspecting the queries generated by the cron hook, I found that the {twitter_user} table was empty, causing the cron_hook to think there were no users with twitter accounts to update.
I'm not sure what the cause of this is, since it seemed to be working before today for a while. I'm mostly not sure because I didn't set this site up initially...just found myself on it as it was being rolled out. I'm interested in finding out what went wrong though.
It should also be noted that the Alternate Api URL setting in the Twitter Setup config *must* be filled in, and defaulted to "twitter.com". I deleted this value just because it seemed from the language (being an alternate), that there was some sort of default that this field would override. Not the case however. Leaving it blank will cause an error during the cron job.
Comment #12
dhouse109 commentedSo I just found out my perception of how the Twitter Module works was wrong. It turns out the {twitter_user} table is populated by entering the user info while in the drupal user edit mode. That is, this info is associated with a drupal user account. So in my case the solution would have been to add the twitter user info to the root drupal user.
I wonder if I'm the only one who misunderstood the "Global User" account.
Comment #13
Brodingo commentedI was having a problem with statuses not updating. I made sure under admin>site config>twitter that 'import twitter statuses' was checked and then went to users>(myuser)>edit>twitter account and made sure 'import' was checked. then i ran cron and it refreshed with the most recent status.
Hope this helps someone.
Comment #14
ericquigley commentedI've tried everything under the sun - I can't get the module to update... sigh.
Comment #15
pauloamgomes commentedHello, i have the following and similar problem but its related to retweets:
it works only and only in the first time, after that, running cron, or invoking it directly (using supercron module) it not updates, making a capture i can verify that the problem is not with the module, since during cron it invokes twitter correctly, but for some reason twitter answers with old xml data, ex:
HTTP GET REQUEST
HTTP RESPONSE
so for the answer i have has last update Jun 06 with is not true, because i have some retweets after that and that's the problem, because retweets are stripped from xml and json calls..as defined in http://dev.twitter.com/doc/get/statuses/user_timeline, to handle retweets it's possible to use the retweeted_by_me function.
Comment #16
phoenix commentedI have the same problem.
On my local machine the twitter module is importing new statuses. On dev and production it is not. I added some watchdog statements to log the whole cron process and the problem occurs when the response data is being decoded by json_decode.
On my local machine the decoded data is fine with the right twitter status id per status.
On the two other environments the twitter id of statuses is being changed and they all have the same id. Thus one twitter status gets updated all the time. And no new status is being inserted.
When checking php versions, I see a difference. Local: 5.2.11. On dev 5.2.0-8+etch16. Could this version difference make a difference in the json_decode function? Both version have as json version 1.2.1. Or is it a charset issue?
Thanks for your help!
Comment #17
phoenix commentedFor now I have solved it this way: I abandoned json_decode and used an alternative parser.
Here is an example: http://drupal.org/node/392978
I used the parser mentioned on that page and now I can import statuses again.
The problem was the following. The twitter_ids consist of a number with 11 positions. After the json_decode they were all 10 positions and all set to 2147483647. One status got imported. After that the status with id 2147483647 got updated all the time. Resulting in the same item remaining as most recent status.
Comment #18
ericquigley commentedSo, if one were to attempt #17, abandoning the json_decode for an alternative parser, does anyone know where one might look for reasonably straightforward instructions on doing so? Let's assume that one isn't much of a programmer.
Thanks to anyone who can help!
Comment #19
phoenix commentedThe instructions are in the link I provided in #17
create this function (and give it whatever name you want):
Then place this script in the "JSON" directory: http://pear.php.net/pepr/pepr-proposal-show.php?id=198 (under links > PEAR package file (.tgz)) (Unpack the package and you'll see a json.php file.)
Comment #20
ericquigley commentedWorks beautifully! Thanks phoenix - your help is very much appreciated!
Comment #21
phoenix commentedGreat to hear this is helping you too !
Comment #22
sebasje83 commentedMaybe one of you know a answer to the following problem.... I installed several 6.xxx version of Twitter module but each version makes run cron fail... SO if Twitter module is installed and working then run cron does not work and therefore I had to delete Twitter module in order to get my run cron index my new content. Does anyone have a solution for this? Hope to hear from some of you.. Thanks in advance.
Comment #23
justinlevi commentedI can confirm that this exact same issue is happening for me as well. Using the Devel and the supercron modules I can see the update statement trying to set the same ID each time.
I apologize if I'm missing something super obvious here, but the instructions for implementing an alternative json decode function still don't make sense to me.
1. My understanding is that I should add the following code to my template.php
Then I add the JSON.php file to the JSON directory? Where is the JSON directory?
Any help is much appreciated.
Here are my first two update SQL statements showing the same twitter_id being set.
Comment #24
Gilneas commentedSubscribing for the same issues.
@ justinlevi:
As far as I know Json is a webservice, so your json directory should be located somewhere on your webserver. If your Drupal installation is running on a managed server like mine there is no chance for this quick fix.
Am I wrong, or is somewhere a bugfix which might help me I didn't understand yet?
Comment #25
dooug commentedDrupal 6.17
Twitter 6.x-2.6
PHP 5.2.6
JSON 1.2.1
I am experiencing the same issues mentioned above. I am not sure I want to go messing around with JSON or PHP, because the post mentioned in #17 sounds like it is for <= PHP 5.1.x.
I tried disabling/enabling the module but it only pulled in the latest tweet.
Comment #26
beddoe commentedSame issue, resolved by the following cron entry: (runs every 5 minutes)
*/5 * * * * /usr/bin/curl http://www.beddoeconsulting.com/cron.phpTweets can be seen here:
http://www.beddoeconsulting.com/content/bc-tweets
Wally
Comment #27
Gilneas commentedTrying this fix. Hope it works.
Comment #28
Gilneas commentedI'm Sorry it does not work for me. Any other suggestions?
Comment #29
dooug commentedbeddoe,
Does running cron that frequently affect the system performance much? It might especially if there are many modules using the hook_cron. Or is every 5 minutes a safe option?
Comment #30
Gilneas commentedFor my installations running the cron every 5 min I can say it is not a problem.
It shouldn't be less than 5 mins between the runs, because sometimes the cron takes some time and then two crons might be started at the same time.
This may slow down your server system.
Are there no new suggestions on this issue?
Comment #31
beddoe commentedNo, the command takes milliseconds and should have no noticeable effect on overall system performance.
Comment #32
pcoucke commentedThe number 2147483647 is exactly 2^31 and indicates an integer overflow. See also http://www.lullabot.com/articles/drupocalypse-now-or-dangerous-integer-h....
I have the issue that there's only one row in the twitter table and when I run cron, I see the content of this row changing but the id stays the same. The strange thing is that this only happens on our production servers and not on our local or testing environment. Our production servers are still 32-bit.
I use version 6.x-3.0-beta3.
Comment #33
pcoucke commented#985544-16: {twitter}.twitter_id incompletely stored (final digits are zeroes) due to json_decode limitation in PHP<5.3 fixed it for me.
Comment #34
steinmb commentedA lot of different issues in this thread, and a lot of the code have changed. Closing this. Anyone that still got issues with this, pls create an separate issues.