You are here

function role_expire_process_default_role_duration_for_user in Role Expire 7

Same name and namespace in other branches
  1. 6 role_expire.module \role_expire_process_default_role_duration_for_user()

Sets the default role duration for the current user/role combination.

Parameters

$role_id: The ID of the role.

$uid: The user ID.

3 calls to role_expire_process_default_role_duration_for_user()
role_expire_cron in ./role_expire.module
Implements hook_cron().
role_expire_user_insert in ./role_expire.module
Implements hook_user_insert().
role_expire_user_update in ./role_expire.module
Implements hook_user_update().

File

./role_expire.module, line 689
Role Expire module

Code

function role_expire_process_default_role_duration_for_user($role_id, $uid) {

  // Does a default expiry exist for this role?
  $default_duration = role_expire_get_default_duration($role_id);
  if ($default_duration) {
    $user_role_expiry = role_expire_get_user_role_expiry_time($uid, $role_id);

    // If the expiry is empty then we act!.
    if (!$user_role_expiry) {

      // Use strtotime of default duration.
      role_expire_write_record($uid, $role_id, strtotime($default_duration));
    }
  }
}