By keirlawson on
Hi,
I was wondering how I would go about seting up drupal so that after logging in users of a certain role would be taken to their own blog, whilst users of another role would be taken to a different page, any pointers as to how to go about this?
Cheers
Comments
Try frontpage module
You could use frontpage module, will allow different accessgroups to have different frontpage. Or you could right a code to redirect frontpage depending on the access control.
refer:http://drupal.org/project/front
Shyamala
Team Leader (http://www.netlinkindia.com)
Shyamala
http://www.unimitysolutions.com
<a href ="http://drupal.org/node/137834">Login Destination</a>
Could try Login Destination
http://drupal.org/node/137834
Shyamala
Team Leader (http://www.netlinkindia.com)
Shyamala
http://www.unimitysolutions.com
The login destination module
The login destination module seems to be exactly what i need! I got the URL destination PHP working fine, however I cant seem to get the redirection condition code working, it looks like:
Even if the users role is set to "candidate", it fails to redirect, any ideas?
Automatic search
I'm trying the same thing and it's not redirecting conditionally for me either. My conditional code uses PHP's in_array() function to search though:
++Andy
Solution
Ahh, and I think I've figured it out ... the conditional is evaluated when the user tries to log in, not after a successful login.
Try moving your PHP snippet into the 'URL Destination Code' settings and determining a URL based on the role, like so:
++Andy
Fantastic!
Thanks - this worked perfectly.
login destination as role based
global $user;
if (in_array('teacher',$user->roles))
{
return 'teacher'; //Page for teacher
}
elseif(in_array('student',$user->roles))
{
return 'student; //Page for student
}
elseif(in_array('parents',$user->roles))
{
return 'parents'; //Page for Parents
}
else
{
return 'home';
}
The above code is for different user with diferent role on the website.I have student,teacher,parents role.kingandy code help me to write this.Thnks kingandy. The login destination module depends on user only.
This works with Drupal 7 and
This works with Drupal 7 and login destination.
subscribing
i have been having problems with this. thanks
Chris
http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.
I've been trying the
I've been trying the different versions of code listed above with no luck. Have also tried the code at http://drupal.org/node/342858 but nothing does it.
My code currently is, or at least I did try, but got a validation error with is:
So I'm stuck how to get this working.
Any suggestions?
Scrub that... Logged out and
Scrub that... Logged out and back in and checked the code and it's working when using:
Perfect.
This works perfectly, it should be added to the "login_destination.module" documentation or readme.
-- If no-one asked Drupal questions there would be no Drupal answers --
Thanks
This worked nicely
how can i get the user id in
how can i get the user id in the path? i'm a php newbie... :(
i want sth like user/$userid/blog
got that working..but now, if
got that working..but now, if a user registers and logs in for the first time, he wont be redirected to the edit account page to change his password. is there a way to make an extra rule for "first time login" and after that the other rules apply?
A bit of shameless
A bit of shameless self-promotion, but you can use the Force Password Change module to force users to change their password on first time login. The way this module is set up should force the user to change their password regardless of the module you have set up.
...or it will cause an infinite loop. Depends on how you have set up the redirect. Try it out and see what happens.
Contact me to contract me for D7 -> D10/11 migrations.
Redirect after login
You can use the module mentioned below to create separate login pages for different kind of roles.
These pages can have their own redirection set after login.
https://www.drupal.org/project/role_login_page