Untitled
unknown
plain_text
2 years ago
570 B
8
Indexable
<?php
/**
* Implements hook_menu_alter().
*/
function custom_homepage_role_menu_alter(&$items) {
global $user;
$desired_roles = ['IS', 'MMS', 'AA IS'];
// Check if the user has any of the desired roles.
foreach ($desired_roles as $role) {
if (in_array($role, $user->roles)) {
// Redirect users with desired roles to the custom page.
$items['<front>']['page callback'] = 'drupal_goto';
$items['<front>']['page arguments'] = ['sr-dashboard'];
break; // Once a matching role is found, exit the loop.
}
}
}
Editor is loading...