Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
570 B
1
Indexable
Never
<?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.
    }
  }
}