tags:

views:

127

answers:

2

I have to 2 different roles setuped in drupal.

1) Backend Users 2) Authenticate Users

Backend Users I want backend users to be redirected to admin section (were all admin related work is done)

Authenticate Users Authenticate users to be redirected to front page.

What is best way to achieve this.

+2  A: 

You have more than one choice.

There are several contrib modules that can achieve this functionality. On one of my production sites I use with satisfaction login destination, as it allows to include PHP logic to decide where to redirect the user.

If you are already writing some code, though, you could to implement this behavior programmatically (this is surely lighter on the system than a fully-featured module), by implementing hook_user() and defining a case for $op == 'login': you could then use drupal_goto() to give the address of the page you want the user to be redirected according to her/his roles.

HTH!

mac
+1 and an additional note to the op: Be aware that the default 'authenticated user' role gets applied to _every_ logged in user, so if you want to treat your 'backend user' differently, you need to check for their role first, as they would also evaluate as being in the 'authenticated' role.
Henrik Opel
A: 

try 'login toboggan', it is a module that has that funcionality built in. http://drupal.org/project/logintoboggan

barraponto

related questions