You are here

function uc_roles_deletion_form in Ubercart 5

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

Form builder for role expirations

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

File

uc_roles/uc_roles.module, line 452
Grants roles upon accepted payment of products

Code

function uc_roles_deletion_form() {
  $expiration = db_result(db_query("SELECT expiration FROM {uc_roles_expirations} WHERE uid = %d AND rid = %d", arg(5), arg(6)));
  if ($expiration) {
    $user = user_load(array(
      'uid' => arg(5),
    ));
    $role = _get_role_name(arg(6));
    $form['user'] = array(
      '#type' => 'value',
      '#value' => $user->name,
    );
    $form['uid'] = array(
      '#type' => 'value',
      '#value' => $user->uid,
    );
    $form['role'] = array(
      '#type' => 'value',
      '#value' => $role,
    );
    $form['rid'] = array(
      '#type' => 'value',
      '#value' => arg(6),
    );
    $form = confirm_form($form, t('Delete expiration of role_name role for the user user_name?', array(
      'user_name' => $user->name,
      'role_name' => $role,
    )), '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' => $user->name,
      'role_name' => $role,
    )), t('Yes'), t('No'));
  }
  else {
    $form['error'] = array(
      '#type' => 'markup',
      '#value' => t('Invalid user id or role id'),
    );
  }
  return $form;
}