How to make a turn on/off switch in acp?

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
StylesFactoryCom
Registered User
Posts: 145
Joined: Wed Dec 19, 2007 10:48 pm
Location: Poland
Contact:

How to make a turn on/off switch in acp?

Post by StylesFactoryCom » Mon Aug 10, 2009 8:39 am

Hello,
I have no idea how to write configuration in acp for mchat mod. That mod is pretty good but I want to make it more friendly for admins.
Where can I get some informations about "how to write a configuration by acp" or something like that.
Thanks.
Looking for cheap and cool styles? PM me :P.
--> matti@gamesboard.pl
My official themes site: http://www.stylesfactory.pl

User avatar
ChriZathens
Registered User
Posts: 1477
Joined: Tue Apr 18, 2006 9:11 pm
Location: Athens, Greece
Name: Chris

Re: How to make a turn on/off switch in acp?

Post by ChriZathens » Mon Aug 10, 2009 8:55 am

You initially need to create a new field in mysql. Something like

Code: Select all

INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_chat', '0');
Then in includes/functions.php create the "switch"

Code: Select all

'S_ENABLE_CHAT'		=> ($config['enable_chat']) ? true : false ,
After that, you must locate where there are the options in ACP to control the chat and also add something like

Code: Select all

'enable_chat'			=> array('lang' => 'ENABLE_CHAT',			'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => false),
If no ACP control exists for the mod you can always place the code in includes/acp/acp_board.php. Search for similar code with the one I posted to see where to place it.
You'll also need to create a language entry for this (eg in lang/en/acp/board.php):

Code: Select all

'ENABLE_CHAT'					=> 'Enable chat',
To use the switch in the template, locate where the mod is included and enter at the beginning something like

Code: Select all

<!-- IF S_ENABLE_CHAT -->
and at the end

Code: Select all

<!-- ENDIF -->
Hope you got it... ;)
My mods in MODDB:
Add Homepage link in header - Change user activity post limit - Post number in viewtopic
If you need support click on the support tab there and post your question.
Do not PM me - chances of viewing my PMs are way thinner than viewing the support question in the customization DB...

User avatar
ijhtio
Registered User
Posts: 150
Joined: Sat Feb 28, 2009 10:09 pm
Contact:

Re: How to make a turn on/off switch in acp?

Post by ijhtio » Mon Aug 10, 2009 9:47 am

hahaha ChriZathens, you have pretty much created a mod for mChat...
regards,
ijhtio

User avatar
ChriZathens
Registered User
Posts: 1477
Joined: Tue Apr 18, 2006 9:11 pm
Location: Athens, Greece
Name: Chris

Re: How to make a turn on/off switch in acp?

Post by ChriZathens » Mon Aug 10, 2009 9:54 am

Heh....
I guess I did... :lol:
Loll
My mods in MODDB:
Add Homepage link in header - Change user activity post limit - Post number in viewtopic
If you need support click on the support tab there and post your question.
Do not PM me - chances of viewing my PMs are way thinner than viewing the support question in the customization DB...

User avatar
StylesFactoryCom
Registered User
Posts: 145
Joined: Wed Dec 19, 2007 10:48 pm
Location: Poland
Contact:

Re: How to make a turn on/off switch in acp?

Post by StylesFactoryCom » Mon Aug 10, 2009 4:35 pm

ChriZathens you are the best ;) Thank you for help.
Looking for cheap and cool styles? PM me :P.
--> matti@gamesboard.pl
My official themes site: http://www.stylesfactory.pl

User avatar
StylesFactoryCom
Registered User
Posts: 145
Joined: Wed Dec 19, 2007 10:48 pm
Location: Poland
Contact:

Re: How to make a turn on/off switch in acp?

Post by StylesFactoryCom » Mon Aug 10, 2009 4:43 pm

Hmm something is wrong, the mod disapears as I wanted but it don't want to switch on :P. Why?
Ok, I know what was the problem. Yesterday I was doing querry cache ;D
Looking for cheap and cool styles? PM me :P.
--> matti@gamesboard.pl
My official themes site: http://www.stylesfactory.pl

Locked

Return to “[3.0.x] MOD Writers Discussion”