You are here

function role_expire_update_6123 in Role Expire 6

Remove rogue roles from role_expire.

File

./role_expire.install, line 176
Role expire install.

Code

function role_expire_update_6123() {
  $ret = array();
  $result = db_query("SELECT re.rid, re.uid FROM {role_expire} re LEFT JOIN {users_roles} ur ON re.rid = ur.rid AND re.uid=ur.uid WHERE ur.uid IS NULL");
  while ($row = db_fetch_object($result)) {
    $ret[] = update_sql("DELETE FROM {role_expire} WHERE rid = {$row->rid} AND uid = {$row->uid}");
  }
  return $ret;
}