PDA

View Full Version : Set custom module inactive without using admincp


corman420
02-29-2008, 02:42 PM
Hi all,

I have a few modules that I wish for my staff to turn off & on when needed. The problem I have is I don't want them in the AdminCP to do this. I've tried setting up a simple query to SET active=0 and vice versa to turn them on. Unfortunatley, the modules don't disappear.

So my next step was to go into the phpmyadmin and double check. Sure enough the module was set to 0, but still showing on the main page.

I figured out that each page also has a field for the module lists, so Im guessing while in the admincp, it must also update the pages as well as the module.

My question is, has anyone done anythign like this before? Use a seperate script to turn modules off and on? And how do I do it?

Thanks in advance!

corman420
03-01-2008, 08:57 PM
No one has ever done this before?

Our Sponsors
 

Brian
03-03-2008, 01:04 PM
Modules are stored in a cache, so after running that query you would need to require the includes/vba_cmps_adminfunctions.php file and then call the update_module_cache(); function.

corman420
03-10-2008, 11:50 AM
Ah perfect. Thanks Brian, that makes total sense!

Our Sponsors
 

corman420
03-11-2008, 09:14 PM
I've tried including includes/vba_cmps_adminfunctions.php and then calling update_module_cache();

but I get this error:

Fatal error: Call to a member function query_read() on a non-object in /includes/vba_cmps_adminfunctions.php on line 25

Im guessing I need to require another file - any clue which one?

corman420
03-11-2008, 09:18 PM
Nevermind, this worked perfectly!

$sql = "UPDATE adv_modules SET active='$stateid' WHERE modid='15'";
mysql_query($sql);
require('./global.php');
require('includes/vba_cmps_adminfunctions.php');
update_module_cache();

$stateid would be 1 or 0 depending on whether or not I want the module enabled or disabled :)

Thanks for the help!