Active
Project:
Login Destination
Version:
6.x-2.8
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Jun 2008 at 12:04 UTC
Updated:
26 Aug 2011 at 20:37 UTC
I'd like this feature implemented in logindestination:
1. The ability to redirect a user to a particular node depending on what role they belong to.
2. The ability to redirect a user to a particular node the first time they log in depending on the role they belong to.
Regards,
Raj
Comments
Comment #1
perandre commentedI'd love to see #1 in Drupal 6 version.
Comment #2
butler360 commentedI'd also like to see #1 in the 6.x version. It's actually what I downloaded the module for.
Comment #3
Sakrecoer commentedhere is how to do it in both 5.x and 6.x (taken from: http://drupal.org/node/179981 ) :
paste this in the URL window of the login destination administration menu, having ticked the "PHP snippet option:
replace special user with the role name
replace node/5 with your desired url
copy paste this:
for all the roles you want to give special redirections to
"thank you drupal community!!!"
/reSet Sakrecoer the hyper-n00b
Comment #4
abamarus commentedOK - looking at the examples means I'm learning about how this code snippet thing works. Can you very helpful guys point me in the right dorection for working out what I want to do....
Basically I want to redirect based on weather the user has filled in their profile (which uses the content profile module). If they have then I want to go to a particular node so I return 'node/42' ... that's cool. It is how to test for if the profile node exists that I am stuck on. Any tips would be appreciated (or even a snippet that you use and work to do the same thing)
Many thanks
Comment #5
asak commentedHey guys - any idea on the second issue Raj has pointed?
2. The ability to redirect a user to a particular node the first time they log in depending on the role they belong to.
I can't seem to find how to do this...
Comment #6
volocuga commentedIt does not work for names with non-latin characters.I tried to replace role name with role ID but no success :(
Please help :)
Comment #7
asak commentedvolocuga: i've noticed multiple issues with non-latin characters in roles, i found it's always best to stick with the latin chars...
Comment #8
mgladding commentedAwesome! Perfect!
Thanks!
Comment #9
ressaThanks guys, I got this working on my site:
Comment #10
lavack commentedI entered the following code into the "Redirection conditions" PHP snippet area.
global $user;
if (in_array('school admin', $user->roles)) {
return 'user'; // Custom page for 'school admin'
}
if (in_array('editor', $user->roles)) {
return 'user'; // Page for 'editor'
}
if (in_array('student', $user->roles)) {
return 'games'; // Page for 'student'
}
else {
return ''; //User does not have 'special users' role.
}
---
"Destination URL settings" only has "Static URL" checked, no other code is entered. Should something be here too?
I recieve the following message after saving configuration:
Your settings: (double-check them)
[ld_url_type] => 'static'
[ld_url_destination] => ''