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.

 

Disable module

Disable module

hello, I want to disable a form to a page every day at a time but not working. I put this code:
$changes->mod( 197 )->disable();

197 is id

thanks, Gianni

pataranda
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Disable module

Hi Gianni,

Firstly, in order for this to work in a MetaMod, the MetaMod has to:

1 - be published
2 - be assigned to a valid module position that appears in the template
3 - be assigned to some or all pages (menu items), at least for the menu item for the page you are viewing at the time.

The easiest way to check that all these are valid is to set Debug mode (in the MetaMod) to ON and see if you get some debug output on the page in the position where the MetaMod is. If you see that then everything is set up right.

The syntax you are using above is correct and should disable module 197.

There are some things that can prevent this from working - hopefully these are not the case for you:

1 - if the module is something that is processed directly by the template. e.g. some templates do special things with menu modules e.g. the module is assigned via the template manager rather than with the module manager.

2 - if you are using some other plugin that interferes with the MetaMod Pro plugin, then the "Pro" part may not work. In that case, MetaMod cannot alter the parameters (e.g. disabling it as per your code) of any module UNLESS that module is included directly inside the MetaMod.

To deal with (2) and selectively disable a module, you can simply do this to include it inside the MetaMod depending on condition, and negate the condition if you need to:

if (php condition of some sort here...) {
  return 197;
}

In this case of course you need to ensure module 197 is not assigned to any other pages (set to None to be on the safe side) so that it only appears when your MetaMod includes it.

I hope this helps,
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

Board Info

Board Stats:
 
Total Topics:
1681
Total Polls:
6
Total Posts:
5912
Posts this week:
6
User Info:
 
Total Users:
11501
Newest User:
riley58745
Members Online:
0
Guests Online:
189

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