Modules can be shown only to logged in users of your Mambo web site through the use of PHP in your Mambo templates. Below, I show you how to hide modules from from site visitors and have them displayed to registered users who have logged in. This is achieved by a small snippet of PHP code that tells Mambo when to display the module.
Example:
<?php if ( $my->id ) {
mosLoadModules('logged_in_position');
} ?>
- where logged_in_position is whatever position name you choose for the module you wish to show to registered/logged in users.
If you want to display one module for logged in users and a different module to site visitors that are not logged in, use this:
<?php if ( $my->id ) {
mosLoadModules('logged_in_position');
} else {
mosLoadModules('other_position');
} ?>
- where other position is whatever module position you wish to display to visitors who are not logged on.
This tutorial is part of a series about working with modules. Look for more information about working with modules in our template tutorials.
If you enjoyed this post, make sure you subscribe to my RSS feed!














{ 0 comments… be the first to comment }
Leave a Comment