I have two roles, client & student. Students can edit their profiles, clients cannot. I thought the easiest way to solve this would be to add a permission as per below:
function si_permission() {
return array(
'edit account' => array(
'title' => t('Edit account'),
'description' => t('Allow users to edit their account')
)
}
I then altered the menu item and changed the access callback to my new permission:
function si_dashboard_menu_alter(&$items) {
$items['user/%user/edit']['access callback'] = user_access('edit account');
}
I then set the permission appropriately in permissions settings, but it does not work. It always appears to be false, so the menu item access is always disabled. I have even debugged 'user_access('edit account')' whilst logged in as the appropriate user and it returns TRUE, so I know the permission is working.
All caches cleared, menus rebuilt using developer tools. Any ideas?