front_page Snippet: Redirecting logged in users to a specific page, such as their profile or blog.

PLEASE NOTE! The following snippet is user submitted. Use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.

<?php
/**
* This php snippet when used in a front_page.module text area for
* authenticated users will redirect users to a specific page on login
*
* Change the values for page and the link to suit
*
* Tested and works with drupal 4.6, 4.5 and 4.7.
*/
global $user;
$output = 'user/($user->id)';
drupal_goto($path = $output, $query = NULL, $fragment = NULL);
?>

Notes: to automatically redirect the logged in user to their own blog, change the 2nd line

from this:

$output = 'user/($user->id)';

to this

$output = 'blog/($user->id)';

Hope that's of use to others

Dub

 
 

Drupal is a registered trademark of Dries Buytaert.