I have 2 users on my drupal7 website(client and user1(admin)). I'd like that client user, using metatag module has access to only 1 tab(By Path tab) or metatag:context node. If i use function hook_menu_alter:
function MODULE_menu_alter(&$items) {
$items['node']['access callback'] = FALSE;
}
will this deny that client user to use other tabs of that module?
So function would look like this
function Metatag_menu_alter(&$items) {
$items['admin/config/search/metatags/settings']['access callback'] = FALSE;
}
Correct me if im wrong.
Thanks!
The hook_menu_alter does not know the context of your user, that function there would deny all access to all users for the page admin/config/search/metatags/settings What you are wanting is to actually define a callback function. This piece is called "access callback" because menu router calls back to the listed function to determine access at the time that someone is visiting the page.
function Metatag_menu_alter(&$items) {
$items['admin/config/search/metatags/settings']['access callback'] = 'metatag_admin_access';
}
function metatag_admin_access() {
global $user;
if( [check your metatag context] ) {
// this user is permitted
return TRUE;
}
return FALSE;
}