I am using drupal 7 and entity_registration module ( registration-7.x-1.0-alpha5) for event registration.
There the register link is displayed for the specific role only i.e. if permission is set for authenticated user, them the register link is displayed to the authenticated users.
If we try to manually visit the page for example node/9/register it shows access denied.
Now, I have using LoginToboggan redirected access denied page to user login page. But when I manually create a menu item Named Register having path node/9/register, the menu item itself is not displaying.
I want a way to tell users to login to register or something like that..
I hope you got my point.
Here is the module file code.. I think there is some problem in formatting so I have pasted just hook_menu and hook_permission functions..please visit the link for viewing full code http://www.karyashala.in/code.html
/**
* Implements hook_menu().
*/
function registration_menu() {
$items['registration/%registration'] = array(
'title callback' => 'registration_page_title',
'title arguments' => array(1),
'page callback' => 'registration_view',
'page arguments' => array(1),
'access callback' => 'entity_access',
'access arguments' => array('view', 'registration', 1),
);
$items['registration/%registration/view'] = array(
'title' => 'View',
'page callback' => 'registration_view',
'page arguments' => array(1),
'access callback' => 'entity_access',
'access arguments' => array('view', 'registration', 1),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['registration/%registration/edit'] = array(
'title' => 'Edit',
'page callback' => 'drupal_get_form',
'page arguments' => array('registration_form', 1),
'access callback' => 'entity_access',
'access arguments' => array('update', 'registration', 1),
'weight' => 10,
'type' => MENU_LOCAL_TASK,
);
$items['registration/%registration/delete'] = array(
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => array('registration_delete_confirm', 1),
'access callback' => 'entity_access',
'access arguments' => array('delete', 'registration', 1),
'type' => MENU_CALLBACK,
);
// entity local tasks
foreach (registration_get_registration_instances() as $instance) {
$type = $instance['entity_type'];
if (!in_array($type, array('registration', 'registration_type'))) {
$items[$type . '/%entity_object/register'] = array(
'load arguments' => array($type),
'title' => 'Register',
'page callback' => 'registration_register_page',
'page arguments' => array(0, 1),
'access callback' => 'registration_register_page_access',
'access arguments' => array(0, 1),
'type' => MENU_LOCAL_TASK,
);
$items[$type . '/%entity_object/registrations'] = array(
'load arguments' => array($type),
'title' => 'Manage Registrations',
'page callback' => 'registration_registrations_page',
'page arguments' => array(0, 1),
'access callback' =>
'registration_administer_registrations_access',
'access arguments' => array(0, 1),
'type' => MENU_LOCAL_TASK,
);
$items[$type . '/%entity_object/registrations/list'] = array(
'load arguments' => array($type),
'title' => 'Registrations',
'page callback' => 'registration_registrations_page',
'page arguments' => array(0, 1),
'access callback' => 'registration_administer_registrations_access',
'access arguments' => array(0, 1),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[$type . '/%entity_object/registrations/settings'] = array(
'load arguments' => array($type),
'title' => 'Settings',
'page callback' => 'drupal_get_form',
'page arguments' => array('registration_registrations_settings_form', 0,
1),
'access callback' => 'registration_administer_registrations_access',
'access arguments' => array(0, 1),
'weight' => 9,
'type' => MENU_LOCAL_TASK,
);
$items[$type . '/%entity_object/registrations/broadcast'] = array(
'load arguments' => array($type),
'title' => 'Email Registrants',
'page callback' => 'drupal_get_form',
'page arguments' => array('registration_registrations_broadcast_form', 0,
1),
'access callback' => 'registration_administer_registrations_access',
'access arguments' => array(0, 1),
'weight' => 10,
'type' => MENU_LOCAL_TASK,
);
}
}
if (module_exists('devel')) {
$items['registration/%registration/devel'] = array(
'title' => 'Devel',
'page callback' => 'devel_load_object',
'page arguments' => array('node', 1),
'access arguments' => array('access devel information'),
'type' => MENU_LOCAL_TASK,
'file path' => drupal_get_path('module', 'devel'),
'file' => 'devel.pages.inc',
'weight' => 100,
);
$items['registration/%registration/devel/load'] = array(
'title' => 'Load',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
}
return $items;
}
/**
* Implements hook_permission().
*/
function registration_permission() {
$permissions = array(
'administer registration types' => array(
'title' => t('Administer registration types'),
'description' => t('Manage registration types, fields, and display
settings.'),
'restrict access' => TRUE,
),
'administer registration' => array(
'title' => t('Administer registration'),
'description' => t('View, edit, delete, and manage all registrations,
regardless of type.'),
'restrict access' => TRUE,
),
);
foreach(registration_get_types() as $type_info) {
$permissions += registration_permission_list($type_info);
}
return $permissions;
}
1 Answer