Customizing the First time login...............

victor bhai - July 3, 2009 - 05:41

i have a registration form in the site. Once the user completes it an email will be send. As usual i mean by default the drupal provides a first time login when the user click the url provided.

After the user clicked an url provided a page is displayed. The url of the page is given in the module called user (file name is user.pages).
So my question is can i redirect the a custom page when the user click the url for the first time..

how to modifiy this default code... in the user.pages

$form['message'] = array('#value' => t('

This is a one-time login for %user_name and will expire on %expiration_date.

Click on this button to login to the site and change your password.

', array('%user_name' => $account->name, '%expiration_date' => format_date($timestamp + $timeout))));
$form['help'] = array('#value' => '

'. t('This login can be used only once.') .'

');
$form['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
$form['#action'] = url("user/reset/$uid/$timestamp/$hashed_pass/login");//this specific line
return $form;

plz looking forward for the suggestion

Yes you can.

lalit.cms - July 3, 2009 - 09:53

Yes, but for this you need to create your own module and then you can change the action of this form using hook_form_alter function in your custom module and on new defined path you can call other function to define further process.

hey thanks for the

victor bhai - July 3, 2009 - 10:59

hey thanks for the suggestion.. i have created a module where i have used hook_alter_form to change the action.. but it is not working..
can u tell me what i need to write in the module i wrote just like:

function firsttimelogin_form_alter(&$form, $form_state, $form_id) {

/* if ($form_id == 'user-pass-reset') {
$form['#action'] = url('teagal/welcome_page');
} */

if($form_id=='user-pass-reset')
{
if($form['#action']=url("user/reset/$uid/$timestamp/$hashed_pass/login"))
{

//$form_state['redirect'] = 'teagal/welcome_page';

$form['#action']=url("teagal/welcome_page");
}
}
}

i am really confused and i have been trying it for long time... if u can have some scrap code as an sample i will be grateful to u.. thank u

vijay

 
 

Drupal is a registered trademark of Dries Buytaert.