1/23/2010

Magento – check if user logged in

Many times, you may want to check if a user is logged in while using Magento, to do so, you could use one of the many helper function to do so. The top class for it is Class Mage_Customer_Helper_Data, the method we are going to use is isLoggedIn(), let’s write a simple script to check if a user is logged in:

Code:

<?php
if ($this->helper('customer')->isLoggedIn() ) {
    echo "Welcome!";
} else {
    echo "Please log in.";
}
?>

Source : http://www.blog.highub.com/cms/magento-check-if-user-logged-in/

No comments:

Post a Comment