This hack has moved from the mosLoadModules function to the &initModules function since that one is being called first by all the other functions. This will allow for column collapsing if the module is hidden and no other modules are published in the position.
Credits go to BradWaite for pointing out to modify &initModules to collapse modules.
You only need this hack in one place, in function: &initModules()!!!!
For a more elaborate hack allowing hiding of modules for certain user types see my post further down: http://forum.joomla.org/index.php/topic ... #msg795120
[This hack is done in J! 1.0.12]
I had a situation where i had a menu that I wanted to replace with the User menu once a user was logged in. In other words I wanted to hide that public menu when a user logged in.
This is such a simple hack that I don't see why this couldn't be part of the core. It involves adding a parameter to the module's xml file (in my case /modules/mod_mainmenu.xml but you can add this parameter to any module you want to hide.
Simply insert this in the position you want in the module.xml file:
Code: Select all
<param name="show_registered" type="radio" default="1" label="Show Menu When Logged In" description="Show the menu also when a registered user is logged in">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
Code: Select all
foreach ($modules as $module) {
$GLOBALS['_MOS_MODULES'][$module->position][] = $module;
}
Code: Select all
// HACK: added code to check if module should be shown when a user is logged in
$params = new mosParameters( $module->params );
if (!$params->get('show_registered', 1) && $my->id) {
// simply continue the loop without outputting this module
continue;
}
// --- end HACK ---
Now you can go into your module configuration and set the radio button to 'No' for the module you want to hide from logged in users.
Enjoy.