[development] How to Log in a user

stuff at trackingsolutions.ca stuff at trackingsolutions.ca
Mon Feb 27 11:00:25 UTC 2006


I just fixed it!

I know it is a hack but it is awesome customer purchase flow and it is such a 
minor change. With a small diff and half an our I should be able to upgrage 
easily.

<code>

if(ereg("cart/checkout", urldecode(drupal_get_destination())))
{
        //1. Login new user here

        $tsiedit['name'] = $account->name;
        $tsiedit['pass'] = $pass;
        user_login($tsiedit);

        $mytext = 'Your account has been created. For security purposes you 
have been sent an e-mail with your account
information. Click the Checkout button below to and enter your account 
information from the e-mail';
        $mytext .= '<br/><br/>';
        $mytext .= '<a href="?q=cart/checkout"><img 
src="themes/tsilinux/images/checkout.png" ></a>';

        return $mytext;
}
else
{
       //This is the original flow. I go here if the request is not from the 
cart
       return t('Your password and further instructions have been sent to your 
e-mail address.');
}


</code>

Thanks


More information about the development mailing list