I'm seeking a good method to direct users to a unique node to act as their homepage, depending on their role.

If the user is not logged in, they would be given the login page as the homepage.

Can anyone offer suggestions? Or should I start writing a module?

Thanks!

Comments

jnvsor’s picture

<?php
function user_page(){
$role = $GLOBALS['user']->roles;
if ($role[1]){
echo "your login form here";
}elseif($role[2]){
echo "your normal user page here";
}elseif($role[3]){
echo "Role #1 page here";
}
} 


// In your homepage code...
user_page()

Just keep doing this (role[4, 5, 6]) and you will get it working...

do the roles in order of first > last...

eg: sam is administrator and moderator... do admin page first then moderator page and he will get the admin page instead of the mod page

nevets’s picture

The front page module has the ability to show a different front page based on role including the ability to show a different page to people not logged in.

spamjim’s picture

...and thanks for the quick replies.