You are here

function uc_roles_menu in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_roles/uc_roles.module \uc_roles_menu()
  2. 7.3 uc_roles/uc_roles.module \uc_roles_menu()

Implementation of hook_menu().

File

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

Code

function uc_roles_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/user/user/expiration',
      'title' => t('Role expiration'),
      'access' => user_access('administer users'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_roles_expiration',
      ),
      'description' => t('Edit and view role expirations set by Ubercart'),
      'type' => MENU_LOCAL_TASK,
    );
  }
  else {
    if (module_exists('uc_notify')) {
      $items[] = array(
        'path' => 'admin/store/settings/notify/edit/role',
        'title' => t('Role assignment'),
        'access' => user_access('administer store'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'uc_roles_notify_settings',
        ),
        'description' => t('Edit the notification settings for roles granted by Ubercart.'),
        'type' => MENU_LOCAL_TASK,
      );
    }
    if (is_numeric(arg(5)) && is_numeric(arg(6))) {
      $items[] = array(
        'path' => 'admin/user/user/expiration/delete/' . arg(5) . '/' . arg(6),
        'title' => t('Delete role expiration'),
        'access' => user_access('administer users'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'uc_roles_deletion_form',
        ),
        'description' => t('Delete a specified role expiration'),
        'type' => MENU_CALLBACK,
      );
    }
    drupal_add_css(drupal_get_path('module', 'uc_roles') . '/uc_roles.css');
  }
  return $items;
}