You are here

function role_expire_rules_action_extend_role_expire in Role Expire 7

Action: Extend expire time for role. Defaults to the current time.

File

./role_expire.rules.inc, line 152
Rules integration for the role expire module.

Code

function role_expire_rules_action_extend_role_expire($account, $rid, $extend) {
  $now = time();

  // $extend comes in as relative to now. We just want the difference.
  $diff = $extend - $now;
  $timestamp = role_expire_get_user_role_expiry_time($account->uid, $rid);
  $base = !empty($timestamp) ? $timestamp : time();
  $new_ts = $base + $diff;
  role_expire_write_record($account->uid, $rid, $new_ts);
}