You are here

function role_expire_set_default_duration in Role Expire 6

Same name and namespace in other branches
  1. 7 role_expire.module \role_expire_set_default_duration()

API function; Set the default expiry duration for a role.

Parameters

$rid: Role ID.

$duration: The duration integer (days).

2 calls to role_expire_set_default_duration()
role_expire_migrate_complete_role in ./role_expire.migrate.inc
Implementation of hook_migrate_prepare_role().
role_expire_user_admin_role_submit in ./role_expire.module

File

./role_expire.module, line 118
Role Expire module

Code

function role_expire_set_default_duration($rid, $duration) {
  $row_rid = db_fetch_array(db_query("SELECT rid FROM {role_expire_length} WHERE rid = %d", $rid));
  if ($row_rid != $rid) {
    db_query("INSERT INTO {role_expire_length} (rid, duration) VALUES (%d, %d)", $rid, $duration);
  }
  else {
    $result = db_query("UPDATE {role_expire_length} SET duration = %d WHERE rid = %d", $duration, $rid);
  }
}