Hi,
So I've been pulling my hair on doing my own access callback for a menu item for a few hours now. Searched the web from head to toe but can't find anything that helped.
So this is part of what I've got.
The menu items:
<?php
$items['events/%delta7_signup_event'] = array(
'title' => 'View Event',
'page callback' => 'delta7_signup_view_event',
'page arguments' => array(1),
'access arguments' => array('create signups'),
'file' => 'delta7_signup.pages.inc',
);
$items['events/%delta7_signup_event/signup'] = array(
'title' => 'Signup For Event',
'page callback' => 'delta7_signup_view_event_signup',
'page arguments' => array(1),
'access callback' => 'delta7_signup_view_event_signup_access',
'access arguments' => array(1),
'file' => 'delta7_signup.pages.inc',
'parent' => 'events/%delta7_signup_event',
'type' => MENU_LOCAL_ACTION,
);
?>
So what I've done for the button is to create a access callback function named "delta7_signup_view_event_signup_access". This function is quite simple, it checks if a user has already signed up for an event and hides the menu item if he has. And it also checks that the user has access to doing this action by checking with the user_access function.
The access callback function:
<?php
function delta7_signup_view_event_signup_access($event = array()) {