Magento Expert Forum - Improve your Magento experience

Results 1 to 3 of 3

Frontend Login form.

  1. #1
    New member
    Join Date
    Jun 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Frontend Login form.

    Hi There,

    I have search almost everywhere, and I can't fine how to force a customer to login. I only want registered customers to be able to see and access my shopping site (members only!). I want a blank page with only a login form, How do I do that?

    Will appreciate your help!

    Br.
    Hanan

    View more threads in the same category:


  2. #2
    Administrator david's Avatar
    Join Date
    Nov 2012
    Posts
    265
    Thanks
    22
    Thanked 39 Times in 32 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 22 Times in 14 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
  •