Magento Expert Forum - Improve your Magento experience

Results 1 to 3 of 3

Frontend Login form.

  1. #1

  2. #2
    Administrator david's Avatar
    Join Date
    Nov 2012
    Posts
    261
    Thanks
    22
    Thanked 42 Times in 34 Posts

    Default

    In your magento module, you can use this code to check if current user is logged in

    Code:
    if (Mage::app()->isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) {
                echo Mage::getSingleton('customer/session')->getCustomer()->getName();
    }
    And get current user information

    Code:
    $customer_data = Mage::getSingleton('customer/session')->getCustomer();
    
    echo "<pre>" print_r($customer_data);
    Then what you need is if user is not logged in you redirect to login URL. Your code will not check if the URL is login URL or register URL.

  3. #3
    Moderator shunavi's Avatar
    Join Date
    Mar 2013
    Posts
    124
    Thanks
    9
    Thanked 25 Times in 16 Posts

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •