Based on the answer from this question How do I programmatically log in a user?

I know how to login in a user, but is there a way to test if user_login_submit was successful or not? It does not have a return value.

1 Answer 1


You can check if user is logged in or not by using global $user variable, if user is not logged in then $user->uid will be 0 for anonymous users.

  • I would up vote you to but I can not. Thanks a ton.
    – JLamkin
    Jun 19, 2012 at 17:49
  • my pleasure.. :)
    – Ashu
    Jun 19, 2012 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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