I can muddle through some basic PHP, I'm pretty sure this is out of my league. I've implemented twitter's badge in a block (here: http://letterstosg.com ), but I'd like to have the block only appear if the last tweet is less than X hours old. I don't know how to do that.

I'd also love to be able to do it so that we don't have to wait on a twitter server to load before deciding whether to show the block. I had thought that the way to do this would be a static page on my own server that cron updates occasionally that contains the time since the last tweet, and then using that for the PHP block visibility code.

Anybody seen anything like this, or know how it would be done? Many thanks.

Comments

alan d.’s picture

You can do this through Drupal using MYMODULE_cron

eg:

<?php

/**
 * Implementation of hook_cron().
 */
function MYMODULE_cron() {
  // Poll server
  // Check result time
  // If old delete record
  // else update record
}

?>

Just make sure that cron is set run correctly.


Alan Davison
www.caignwebs.com.au

Alan Davison