Redirection per role
data18 - July 11, 2008 - 15:11
| Project: | Login Destination |
| Version: | 5.x-1.0 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
is it possible to make a redirection per role?
Thanks & regards
Alexander

#1
Yes
global $user;if (in_array('admin', $user->roles)) {
// Redirect the Administrator
return 'admin';
} elseif (in_array('unverified', $user->roles)) {
// Redirect Unverified
return 'node/4';
} else {
return 'node';
}
#2
How would you redirect users of a specific role and insert their user id in the url?? For example, user/[USER ID]/foo... Basically, I'm looking for the array to return 'user/'.$user->uid.'/my/example'
#3
Use this snippet to print the user id.
<?phpglobal $user;
print $user->uid;
?>
If you wanted to return a link for a logged in user you could use something like this
<a href="user/<?phpglobal $user;
print $user->uid;
?>">My Account</a>
--
Need professional help with your Drupal project? Goodwin Solutions