i am creating a web service for login and register.

for login- http://example.com/endpointname/user/login

for register- http://example.com/endpointname/user/register

BUT i want a single url link for register and login, i.e. when user registers, it will automatically logged in. No need of two services for register and login. How can i get this?


When user gets saved in DB using user_save() it returns the user object. All you have to pass it to $GLOBAL['user']; and save session

   //Here is your previous code I assume where you have user_save()

   $user = user_save($userData);

   if($user) {
        $GLOBALS['user'] = $user;

Hope this may help you

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.