1

I am write some code for user login. But i want when user click on log in button every ,that time checks user already logged in or not . if user logged then throw the informative message and if not throws error. How i do this.. Please help me..

3
  • 1
    If you reder link through the Drupal way using l() function, you dont need to do all these unnecessary things.
    – niksmac
    Mar 27, 2013 at 12:59
  • Please add your code to the question for context. It's difficult to understand what you're asking
    – Clive
    Mar 27, 2013 at 13:41
  • Just i want to validate if user is logged in that time if user again click on log in button that time just throw information message to user like "User is already logged".. For that how i handle such situation .. Thats it......
    – Mahi143
    Mar 27, 2013 at 16:01

1 Answer 1

1

You can check value of field uid of global variable $user:

global $user;

Contains preferences and other account information for logged-in users. When a user is not logged-in, the $user->uid property is set to 0.

http://api.drupal.org/api/drupal/developer!globals.php/global/user

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.