Conditional Layout Blocks in Magento depending if logged in?
Use conditions in your xml file (local.xml, page.xml, etc.). E.g. to add a cms block if customer is logged in:
<customer_logged_in>
<reference name="name_of_reference_block">
<block type="cms/block" name="block_name">
<action method="setBlockId">
<block_id>block_id</block_id>
</action>
</block>
</reference>
</customer_logged_in>
And same logic for logged out customers, e.g. remove a block:
<customer_logged_out>
<reference name="name_of_reference_block">
<remove name="name_of_block_to_remove"></remove>
</reference>
</customer_logged_out>
You can also use Magento customer helper in your template:
if($this->helper('customer')->isLoggedIn()){
//Show block to logged in customers
}else{
// Show different block to guest users
}
Alternatively use:
Mage::helper('customer')->isLoggedIn()