4

Use Case - I've got several Dashboards (some custom View pages) in the site. Depending on the Role associated with a User, I want to direct them to thier respective Dashboard.

So an Editor would go to the Editor Dashboard, a Contributor would go to a Contributor Dashboard, etc. after they login.

(I'm using the OpenPublic distro)

  • Do you want to redirect user just after login??? – Astha chauhan Apr 11 '15 at 10:31
  • You can do this with the rules modules. – itsdarrylnorris Apr 11 '15 at 12:59
2

You can redirect user after checking their role(by using below PHP snippet)

<?php $GLOBALS['user']->roles; ?>

Your code will look something like this:

<?php 
if($GLOBALS['user']->roles == 'editor') {
  drupal_goto("dashboard_editor"));
}
?>

Note: this will work only when a user has single role associated with him.

2

You can use a panels for the dashboard and then create different variants based on roles using the Access rules.

1

Checkout the login destination module. Simple as that.

https://www.drupal.org/project/login_destination

0

Few methods you could do this:

1) hook_init() - check user's role and redirect to the correct address.

2) With the Pages module, you can set each panel's (=view's) display rule as having a certain role. With this you can stay at the same address (say, /dashboard)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.