I am doing mobile apps and I would like to know how to check whether user is already logged in or not. Is there any observer event to track? If it is detected that the account is logged in, the user will be directed to Account Information page. If not, the user will be directed to login or registration page.

<?php 
    if(!Mage::getSingleton('customer/session')->isLoggedIn()){
        //not logged in
    }else{
        // logged in
    }
?>

You can check if user is logged in in the application with this piece of code:

Mage::getSingleton('customer/session')->isLoggedIn()

After you can get information about user. For example:

$customer_data=Mage::getSingleton('customer/session')->getCustomer();
echo "<pre>" print_r($customer_data);

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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