<?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)) {
// Set a different path as the front page for users with the desired roles.
$items['<front>']['page callback'] = 'custom_homepage_role_custom_frontpage';
break; // Once a matching role is found, exit the loop.
}
}
}
/**
* Custom callback for the new front page.
*/
function custom_homepage_role_custom_frontpage() {
// You can return the path of the desired homepage here.
return 'custom-homepage';
}