How to add login form to home page in Magento

I found a interesting question on Magento forums. There was a request to add a login page to a home page. I guess somebody wants to show a products only to a registered customers. Here is a quick guide how to do it.
Open customer.xml from layout folder, and locate (around line 91)
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
</reference>
Now open cms.xml and locate (around line 46)
<reference name="content">
<block type="cms/page" name="cms_page"/>
</reference>
Now copy the
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
from customer.xml to cms.xml making it like
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
<block type="cms/page" name="cms_page"/>
</reference>
That’s it. Play with the rest and let us know if this helped someone.
Published in:
Leave a comment
6 comments
How to add customer account login/register into custom controller form.
1. customer account login if login successfully then want to show custom form fields.
2. If click register then directly showing register form.
This should go in the “Layout Update XML” field of the design tab of the cms page used for the home page not in an xml file. Additionally you did not provide a method to have the block removed after login. So pretty much useless. Nice click bate though.
not working for me here is my code that i can see any help as to were i insert the line thanks 🙂
CMS Content Wrapper
Nice trick thanks. Though there is one problem with practical implementation. The login/register block keeps showing after the login.
Logged in users should see some other information instead. Can you advice how to do that?
i want to know how to create my own custom login page ????
1. The quotation marks need to be changed to ” and not the ones shown on the page.
2. If you show full path of customer.xml and other files, it may be more convenient for beginners.
Remaining, it worked. Thanks a lot.