Step1
First goto “app\design\frontend\default\[your theme directory]\template\page”
make a copy of your template page it can be “1column.phtml” or “2columns-right.phtml”…. whatever you are using.
rename it to “restricted.phtml” and paste the below code just after body tag starts.
First goto “app\design\frontend\default\[your theme directory]\template\page”
make a copy of your template page it can be “1column.phtml” or “2columns-right.phtml”…. whatever you are using.
rename it to “restricted.phtml” and paste the below code just after body tag starts.
<?php <code>$login</code> <code>= Mage::getSingleton( </code><code>'customer/session'</code> <code>)->isLoggedIn(); </code><code>//Check if User is Logged In</code><div><code> </code><code>if</code><code>(!</code><code>$login</code><code>)</code></div><div><code> </code><code>{</code></div><div><code> </code><code>$msg</code> <code>= Mage::getSingleton(</code><code>'core/session'</code><code>)->addError(</code><code>$this</code><code>->__(</code><code>'Please Sign in / Register first to access this page.'</code><code>));</code></div><div><code> </code><code>header(</code><code>'Location: '</code><code>. Mage::getUrl(</code><code>'customer/account/login'</code><code>));</code></div><div><code> </code><code>exit</code><code>;</code></div><div><code> </code><code>}</code></div><div>?></div><div>
goto “\app\code\core\Mage\Page\etc” and open “config.xml”
add this code just befor “</layouts>” tag
add this code just befor “</layouts>” tag
<div><div><code><</code><code>allowed_user</code> <code>module</code><code>=</code><code>"page"</code> <code>translate</code><code>=</code><code>"label"</code><code>></code></div><div><code> </code><code><</code><code>label</code><code>>Only Registerd / Sign in users</</code><code>label</code><code>></code></div><div><code> </code><code><</code><code>template</code><code>>page/restricted.phtml</</code><code>template</code><code>></code></div><div><code> </code><code><</code><code>layout_handle</code><code>>page_allowed_user</</code><code>layout_handle</code><code>></code></div><div><code> </code><code></</code><code>allowed_user</code><code>></code></div><div></div></div>
Now open you “admin” ,” cms” and “add new page”
and you will find new select option under “design” tab in “Layout” option.
just select “Only Restricted/ sign in user”. Rest will be handelled by the code

and you will find new select option under “design” tab in “Layout” option.
just select “Only Restricted/ sign in user”. Rest will be handelled by the code
No comments:
Post a Comment