Drupal 6: Ask user to complete user profile when login
If you want your website users to have to complete their user profile when they’re login, you can use the module login destination.
- Install module login destination
- Go to Administer > User Management > Login Destination
- In the Destination URL Settings, choose PHP Snipplet. Input this code:
global $user;
profile_load_profile($user);
if ($user->uid == 1) {
return 'admin';
} elseif ($user->profile_first_name == "" ||
$user->profile_last_name == "" ||
$user->profile_address == ""
) {
drupal_set_message('Please Complete your Personal Information', 'status');
return 'user/' . $user->uid . '/edit/Personal%20information';
} else {
return 'node';
}
This code will verify the user who login. If its admin (user with uid 1), he/she will be redirect to admin page. If other user is login, it will verify the user profile information. If the information is still blank, it will redirect the user to the profile page to complete the profile information.
Hope this help.
Thanks
Recent Comments