Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Hide module when user are connected

Hide module when user are connected

Hi,
i want to hide simply a module
I insert this code but the modul doesn't appear when i'm not connected.

// Hide module when connected
if ( MM_LOGGED_IN ) { $changes->mod(156)->disable();
}


The Module #156 Assignment is on "No page"
It is enable for publication.

I test metamod with a simply return and the modul appear in the good position module.

Regards.

Technichem
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Hide module when user are connected

Hi,

I assume you are using the Pro version? The "disable" method above can only work with the Pro version.

Anyway, you are also mixing up 2 different techniques:
1 - using disable(). When you do it this way (with MetaMod Pro), the module has to be active and assigned to a valid page and module position. That way, it will appear as normal unless the MetaMod explicitly disables it. So the problem you are having at the moment is that it's not showing up because it's not assigned to a page.

2 - the traditional usage of MetaMod, which is that the PHP code returns the value of a module id. If it does that, the module is displayed. If it doesn't, the module does not display. In this case, the module should be set up like you did it, assigned to "no page" so that it DOESN'T show up unless MetaMod includes it.

So using #2, you could do this:

if ( ! MM_LOGGED_IN ) { return 156; }

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Hide module when user are connected

Hi Stephen,

Great !
Thanks a lot.

Technichem
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1685
Total Polls:
6
Total Posts:
5912
Total Posts Today:
4
User Info:
 
Total Users:
11504
Newest User:
toko solo
Members Online:
0
Guests Online:
180

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked