Wednesday, February 9, 2011

Hiding Modules when a User Logs In

<?php // Get the user object $user = &JFactory::getUser(); 

// Now work out the User ID $userId = $user->get('id'); 

// Now hide the module if user is logged in if ($userId == 0) :   

// Now we break out of the PHP tags and display the JDOC tag to include the module 

?> 
<jdoc:include type="modules" name="public-right" style="xhtml" />

<?php endif; ?> 

No comments:

Post a Comment