Should I use this Module?
chotamonk - August 30, 2007 - 16:32
| Project: | Login Destination |
| Version: | 5.x-1.0 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I am a newbie and really lost. I have several roles setup for users and I want to create a redirect page after login so that different splash pages are displayed depending on user role. What is the best way to make this happen?

#1
Greetings,
The snippet will look like this:
global $user;
if (in_array('role1', $user->roles)) {
// Redirect users will role1 role
return 'role1-url';
} elseif (in_array('role2', $user->roles)) {
// Redirect users will role2 role
return 'role2-url';
} else {
return 'default-url';
}
#2
#3
Hi,
since this is probably the most logical way to use this module (role based over user based is always more maintainable unless each of your users have to do something completely different) it would be great to add this snippet to the main page.
#4
I dont write PHP but I'd like to achieve the following functionality for a homepage:
- Logged in users with an account are forwarded to a dashboard-style page /user/dashboard
- Users without an account, or not logged in, are sent to the normal homepage.
- In the future, I may like to forward each role to a different url.
Can someone suggest a lower-brow module to achieve this. Or perhaps supply me with the snippets I need to achieve this with Login Destination?
Thanks!
#5
I dont write PHP but I'd like to achieve the following functionality for a homepage:
- Logged in users with an account are forwarded to a dashboard-style page /user/dashboard
- Users without an account, or not logged in, are sent to the normal homepage.
- In the future, I may like to forward each role to a different url.
Can someone suggest a lower-brow module to achieve this. Or perhaps supply me with the snippets I need to achieve this with Login Destination?
Thanks!
#6
I couldn't agree more with the post above.
This is what I've downloaded this module for, and role-based login redirection is by far more important & useful than user-based redirection.
I, too, suggest that role-based redirection be built as the core functionality of this module. Particularly, the module's interface should be revised so as to populate the roles programmatically and enable admins to assign pages to them, instead of the PHP snippet method, which might confuse non-coders admins.
Edit: I'm sorry, just noticed this an old thread from an year ago. My suggestion is still viable though, as I'm using the latest D6 version and the functionality I've described applies to this newest version as well. :)
#7
There is 'front' module as well for set front page per role, but it's not working properly for me (tested on 6.x), but you can try it, you don't need to put any PHP code.