Hey,
I'm executing some custom php (string) to choose how users get redirected upon login.
global $user;
if (in_array('Student',$user->roles)) {
return 'studentfeed';
}
else if (in_array('Public User',$user->roles)) {
return 'feed';
}
else if (in_array('SuperUser',$user->roles)) {
return 'feed';
}
else {
return 'publicfeed';
}
The problem is, if a user has multiple roles (which is possible on my site.) Firstly, if a user ONLY has a role of 'student' they're redirected to the 'studentfeed' page. It is however possible for a student to ALSO have a role of 'public user,' and if that is the case they're redirected to the 'feed' page, likewise with 'SuperUser.'
That brings up the problem, since 'Student' is the first stated array, they seem to always get redirected to the 'studentfeed' page (which is ONLY for users with a role of student and nothing more) even if they have another role such as 'public user.'
Lastly, if a user ONLY has a role of 'public user' and nothing more, they should be redirected to the page 'publicfeed.'
Please help!
Jon.
Comments
Comment #1
JonGirard-1 commentedOk.. maybe it was too complicated sounding the first time..
If a user has one role of 'student' they're redirected to a page. If a user has a role of student AND public they're redirected to a different page (which is what I don't know how to do.)
How would you do this?
Jon.
Comment #2
francewhoaSolution can be found here: http://drupal.org/node/179981#comment-677699
Thanks to JStarcher