How to redirect a user to a destination after login
This is how you can redirect a user to a destination after login
<?php
function mymodule_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'login') {
$_REQUEST['destination'] = "mymodule/some/path";
}
}
?>
Operations:
- after_update: The user object has been updated and changed. Use this
(probably along with 'insert') if you want to reuse some information from
the user object. - categories: A set of user information categories is requested.
- delete: The user account is being deleted. The module should remove its
custom additions to the user object from the database. - form: The user account edit form is about to be displayed. The module
should present the form elements it wishes to inject into the form. - insert: The user account is being added. The module should save its
custom additions to the user object into the database and set the saved
fields to NULL in $edit. - load: The user account is being loaded. The module may respond to this
and insert additional information into the user object. - login: The user just logged in.
- logout: The user just logged out.
- register: The user account registration form is about to be displayed.
The module should present the form elements it wishes to inject into the
form. - submit: Modify the account before it gets saved.
- update: The user account is being changed. The module should save its
custom additions to the user object into the database and set the saved
fields to NULL in $edit. - validate: The user account is about to be modified. The module should
validate its custom additions to the user object, registering errors as
necessary. - view: The user's account information is being displayed. The module
should format its custom additions for display, and add them to the
$account->content array.
More info:http://api.drupal.org/api/drupal/developer!hooks!core.php/function/hook_...
...and there is a module for that:http://drupal.org/project/login_destination
Knowledge keywords: