Similar role question, different results
| Project: | Login Destination |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Hi -
I'm trying to create different login destinations per role id. Destinations are static pages I've created.
I looked at a few similar issues, but my results are different:
- My PHP snippet is NOT ignored (as in wonder95's post), it goes to 'node/42' (see below) no matter what role logs in
- I do NOT get a fatal error (as in aikaterine's post)
My steps:
- I installed the module in sites/all/modules
- turned it on in admin › modules
- went to Home › Administer › User management › Login destination
- In 'URL destination settings', I checked 'Preserve destination'
- and selected 'PHP snippet (experts only)' radio
- in the 'URL' field I added my code
- under 'Redirection condition settings' I selected 'Always' & clicked Save Configuration
-- Should work, right?
I tried adding the PHP in 2 ways:
1. I tried ARDAS' code (the two other issues I reference above do as well)
2. But I also tried code based on the README.txt
FIRST TRY:
global $user;
if (in_array('role4', $user->roles)) {
// Redirect users with role4 Owner role
return 'node/47';
} elseif (in_array('role6', $user->roles)) {
// Redirect users with role6 Shoppers role
return 'node/43';
} elseif (in_array('role12', $user->roles)) {
// Redirect users with role12 Merchant Silver role
return 'node/44';
} elseif (in_array('role13', $user->roles)) {
// Redirect users with role13 Merchant Gold role
return 'node/45';
} elseif (in_array('role14', $user->roles)) {
// Redirect users with role14 Merchant Platinum role
return 'node/46';
} else {
return 'node/42';
}SECOND TRY:
global $user;
if ($user->rid == 4) {
// Redirect users with role4 Owner role
return 'node/47';
} elseif ($user->rid == 6) {
// Redirect users with role6 Shoppers role
return 'node/43';
} elseif ($user->rid == 12) {
// Redirect users with role12 Merchant Silver role
return 'node/44';
} elseif ($user->rid == 13) {
// Redirect users with role13 Merchant Gold role
return 'node/45';
} elseif ($user->rid == 14) {
// Redirect users with role14 Merchant Platinum role
return 'node/46';
} else {
return 'node/42';
}Any ideas about this?
Thanks in advance!
Scott

#1
*bump* ?
Realizing it's holiday for a lot of people, things can get overlooked.
By the way, I installed the Devel module to help with testing, but I'm not sure how to apply it with this issue. If you think using that mod could be helpful, please let me know to use with this issue & and I'll be happy to do it
Thanks --
Scott