I'm trying to redirect to the user edit page just after the user logged in from the login block in the sidebar. I implemented hook_user_login, but no luck. It seems to me that drupal_goto()
or $edit['rediect']
cannot take precedence over $_GET['destination']
function mymodule_user_login(&$edit, $account){
if ( user role is employee and user has not completed profile yet ) {
// both failed to redirect, although my condition is true
$edit['redirect'] = 'user/'.$account->uid.'/edit';
drupal_goto('user/'.$account->uid.'/edit');
}
}
I was at my home page ( mydomain.com ) and tried to log in, but when I exit
in my hook, I found that the URL was changed to mydomain.com/node?destination=node. My home page path is blank in site information.
[Edit]
My condition for redirect is that if the logged in user has empolyee role and his profile is not completed yet. My usecase is very similar to this, but i don't use content profile.
I think the way of overriding $_GET['destination'] would fix my issue.
header("Location: user/".$account->uid."/edit");
, of the redirection.header()
function.drupal_goto()
also uses it.