Oh no, it’s the Schapelle Corby story again Samuel’s Musicians Of The Week

Twitter Updates for 2008-06-22

June 22nd, 2008 at 11:59pm

***Post Removed shortly after 12am 24 June***

WARNING: My modifications to the Twitter Tools plugin broke the daily update posts. Do not attempt these changes unless you want to break the daily updates on your installation of Twitter Tools

Looks like the Twitter Tools plugin has gone slightly cuckoo and decided to repost the last daily digest. I think the reason it did that is because I disabled and then re-enabled the daily digests as Twitter Tools seemed to be stuck in the wrong timezone.

We’ll see if it’s feeling any better soon I suppose.

Update 1:13am: It seems to be storing tweet creation times in UTC rather than local time but storing the time it downloaded them in local time. I suppose I’ll find out around 10am if it’s worked out that I’m in Canberra and not London. I’ll see if I can find out anything more about this weird behaviour before then. End Update

Update 2:09am: It’s apparently a known issue, but not one that’s likely to be officially fixed any time soon. I didn’t find anything useful on Google either, so I went looking through the plugin and found this section related to digest creation starting on line 214:

$now = ak_gmmktime();
$yesterday = strtotime(‘-1 day’, $now);
$last_post = get_option(‘aktt_last_digest_post’);

if ($last_post != date(‘Y-m-d 00:00:00’, $yesterday)) {
$days = ceil((strtotime(date(‘Y-m-d 00:00:00’, $yesterday)) – strtotime($last_post)) / (3600 * 24));
}
else {
$days = 1;
}
for ($i = 0; $i < $days; $i++) { $n = $days - $i; $digest_day = strtotime('-'.$n.' days', $now); $tweets = $wpdb->get_results(”
SELECT *
FROM $wpdb->aktt
WHERE tw_created_at >= ‘”.date(‘Y-m-d 00:00:00’, $digest_day).”‘
AND tw_created_at < = '".date('Y-m-d 23:59:59', $digest_day)."' GROUP BY tw_id ORDER BY tw_created_at

Which I have altered to read:

$now = ak_gmmktime();
$yesterday = strtotime(‘-1 day’, $now);
$last_post = get_option(‘aktt_last_digest_post’);

if ($last_post != date(‘Y-m-d 10:00:00’, $yesterday)) {
$days = ceil((strtotime(date(‘Y-m-d 10:00:00’, $yesterday)) – strtotime($last_post)) / (3600 * 24));
}
else {
$days = 1;
}
for ($i = 0; $i < $days; $i++) { $n = $days - $i; $digest_day = strtotime('-'.$n.' days', $now); $tweets = $wpdb->get_results(”
SELECT *
FROM $wpdb->aktt
WHERE tw_created_at >= ‘”.date(‘Y-m-d 10:00:00’, $digest_day).”‘
AND tw_created_at < = '".date('Y-m-d 09:59:59', $now)."' GROUP BY tw_id ORDER BY tw_created_at

Basically I’ve added ten hours (the difference between Canberra’s timezone and GMT), hopefully that will fix the problem until it is officially fixed in an update by the plugin’s author. If this works, then I suppose that I’ll need to write a version of the workaround for those people in timezones behind GMT. It should be one extra line and a different variable, but I’ll wait to see if this works first. It hasn’t broken anything yet, so for one of my coding efforts it’s looking promising. End Update

Samuel

Entry Filed under: Blog News

Print This Post Print This Post

4 Comments

  • 1. electricbob  |  July 2nd, 2008 at 8:10 am

    Hi Samuel!

    It was good to see I’m not the only one seeing timezone wierdness with Twitter Tools (which I otherwise love!).

    If you know the secret for making the php do negative timezones I’d like to try it out (I’m in US Pacific time zone, so I’m -7).

    I really like the widget otherwise – did you try to contact the author with a fix for this?

    Hope things are going well. Thanks and have fun! – Bob

  • 2. Samuel  |  July 2nd, 2008 at 1:56 pm

    Hi electricbob,

    Sorry, I should have made it clearer sooner that my modifications broke the daily updates.

  • 3. electricbob  |  July 4th, 2008 at 9:09 pm

    I got an extra day off from my day job, so I worked on this problem yesterday and believe I have a fix – its not the best fix, but it works. Take a look at this entry in the WordPress support forum:

    http://wordpress.org/support/topic/127916?replies=4#post-796201

    Hope that helps; since you pointed me to the problem I thought I’d post the interim solution here for you. Thanks and have fun! – Bob

  • 4. Samuel  |  July 7th, 2008 at 1:42 am

    Thanks Bob. I’ve just applied the fix to the version of Twitter Tools running on this blog. It looks like it’s worked because the publicly visible timestamps just jumped back ten hours on the old twitter updates. I might go through the database and fix them up!


Calendar

June 2008
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930  

Most Recent Posts

Login/Logout


Blix Theme by Sebastian Schmieg and modified for Samuel's Blog by Samuel Gordon-Stewart.
Printing CSS with the help of Martin Pot's guide to Web Page Printability With CSS.
Icons by Kevin Potts.
Powered by WordPress.
Log in