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; ?> 

Comments

Popular posts from this blog

PHP: Date Difference for PHP 5.2

HTML5 video loop src change on end play function

Custom OpenCart 2.3.0.2 theme