You are here

function uc_roles_deletion_form in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_roles/uc_roles.module \uc_roles_deletion_form()
  2. 7.3 uc_roles/uc_roles.admin.inc \uc_roles_deletion_form()

Form builder for role expirations.

See also

uc_roles_deletion_form_submit()

1 string reference to 'uc_roles_deletion_form'
uc_roles_menu in uc_roles/uc_roles.module
Implements hook_menu().

File

uc_roles/uc_roles.admin.inc, line 79
Roles administration menu items.

Code

function uc_roles_deletion_form($form_id, $account, $rid) {
  $expiration = db_result(db_query("SELECT expiration FROM {uc_roles_expirations} WHERE uid = %d AND rid = %d", $account->uid, $rid));
  if ($expiration) {
    $role_name = _uc_roles_get_name($rid);
    $form['user'] = array(
      '#type' => 'value',
      '#value' => $account->name,
    );
    $form['uid'] = array(
      '#type' => 'value',
      '#value' => $account->uid,
    );
    $form['role'] = array(
      '#type' => 'value',
      '#value' => $role_name,
    );
    $form['rid'] = array(
      '#type' => 'value',
      '#value' => $rid,
    );
    $form = confirm_form($form, t('Delete expiration of %role_name role for the user %user_name?', array(
      '%user_name' => $account->name,
      '%role_name' => $role_name,
    )), 'admin/user/user/expiration', t('Deleting the expiration will give %user_name privileges set by the %role_name role indefinitely unless manually removed.', array(
      '%user_name' => $account->name,
      '%role_name' => $role_name,
    )), t('Yes'), t('No'));
  }
  else {
    $form['error'] = array(
      '#type' => 'markup',
      '#value' => t('Invalid user id or role id.'),
    );
  }
  return $form;
}