You are here

function fbconnect_cron in Facebook Connect 5

Impletementation of hook_cron

File

./fbconnect.module, line 794
This module allows site visitors to connect and register with facebook account

Code

function fbconnect_cron() {
  $expire = time() - FBCONNECT_USER_CACHE_EXPIRE * 3600;

  // Update user picture
  if (variable_get('user_pictures', 0)) {
    $result = db_query('SELECT uid, fbuid FROM {fbconnect_users} WHERE timestamp < %d AND avatar = %d', $expire, FBCONNECT_USE_FBAVATAR);
    while ($tab = db_fetch_array($result)) {
      if ($tab) {
        fbconnect_refresh_user_avatar($tab['fbuid'], $tab['uid']);
        db_query('UPDATE {fbconnect_users} SET timestamp = %d', time());
      }
    }
  }
  cache_clear_all();
}