You are here

function userpoints_menu in User Points 5.3

Same name and namespace in other branches
  1. 5 userpoints.module \userpoints_menu()
  2. 5.2 userpoints.module \userpoints_menu()
  3. 6 userpoints.module \userpoints_menu()
  4. 7.2 userpoints.module \userpoints_menu()
  5. 7 userpoints.module \userpoints_menu()

Implementation of hook_menu().

File

./userpoints.module, line 84

Code

function userpoints_menu($may_cache) {
  $items = array();
  global $user;
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/userpoints',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'userpoints_admin_settings',
      ),
      'title' => t('!Points settings', userpoints_translation()),
      'description' => t('Configure userpoints settings'),
      'access' => user_access(USERPOINTS_PERM_ADMIN),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/user/userpoints',
      'callback' => 'userpoints_admin_points',
      'title' => t('!Points', userpoints_translation()),
      'description' => t('Manage !points', userpoints_translation()),
      'access' => user_access(USERPOINTS_PERM_ADMIN),
    );
    $items[] = array(
      'path' => 'admin/user/userpoints/list',
      'callback' => 'userpoints_admin_points',
      'title' => t('List'),
      'description' => t('List users by !points', userpoints_translation()),
      'access' => user_access(USERPOINTS_PERM_VIEW),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -2,
    );
    $items[] = array(
      'path' => 'admin/user/userpoints/moderate',
      'callback' => 'userpoints_admin_manage',
      'title' => t('Moderation'),
      'description' => t('Review !points in moderation', userpoints_translation()),
      'access' => user_access(USERPOINTS_PERM_ADMIN),
      'type' => MENU_LOCAL_TASK,
      'weight' => -1,
    );
    $items[] = array(
      'path' => 'admin/user/userpoints/add',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'userpoints_admin_txn',
      ),
      'title' => t('Add'),
      'description' => t('Admin add/delete userpoints'),
      'access' => user_access(USERPOINTS_PERM_ADMIN),
      'type' => MENU_LOCAL_TASK,
      'weight' => 0,
    );
    $items[] = array(
      'path' => 'admin/user/userpoints/edit',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'userpoints_admin_txn',
      ),
      'access' => user_access(USERPOINTS_PERM_ADMIN),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/user/userpoints/approve',
      'callback' => 'userpoints_admin_approve',
      'access' => user_access(USERPOINTS_PERM_ADMIN),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/user/userpoints/decline',
      'callback' => 'userpoints_admin_approve',
      'access' => user_access(USERPOINTS_PERM_ADMIN),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'userpoints',
      'title' => t('Users by !points', userpoints_translation()),
      'callback' => 'userpoints_list_users',
      'access' => user_access(USERPOINTS_PERM_VIEW),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'myuserpoints',
      'title' => t('My') . ' ' . t('!points', userpoints_translation()),
      'callback' => 'userpoints_my_userpoints',
      'access' => user_access(USERPOINTS_PERM_VIEW) && $user->uid,
      'type' => MENU_NORMAL_ITEM,
    );
  }
  return $items;
}