Redireccion por ROLE (Drupal)


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. global $user;
  2. $adminRoles= array('monitor','editor');
  3. $adminAble= FALSE;
  4. foreach($adminRoles as $role) {
  5. if( in_array($role, array_values($user->roles)) ) $adminAble= TRUE;
  6. }
  7. if($adminAble) {
  8. return inicio;
  9. } else {
  10. return user;
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.