The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Create checkbox group at your hack's options (usergroup selection for example)
Hello. In this article I will show how to create a checkbox group in your hack's options. It's easy. Just do the following: 1. Create an option. Datatype validation type = free. 2. Enter the following code to Option code: Code:
" . eval('$options=""; $fritems = array( "Test1Code" => "Test option checkbox", "Test2Code" => "Another test option checkbox", ); foreach($fritems AS $fritem_id => $fritem_name) { $options .= "\\t\\t<label for=\\"setting[$setting[varname]]$fritem_id\\" title=\\"item id: $fritem_id\\"><input type=\\"checkbox\\" tabindex=\\"1\\" name=\\"setting[$setting[varname]]"."[]\\" id=\\"setting[$setting[varname]][$fritem_id]\\" value=\\"$fritem_id\\"" . iif(strpos(",$setting[value],", ",$fritem_id,") !== false, \' checked="checked"\') . iif($vbulletin->debug, " title=\\"name="setting[$setting[varname]]"\\"") . " />$fritem_name</label><br />\\n"; } return "<span class=\\"smallfont\\">\\n$options\\t</span>";') . "<input type=\"hidden\" name=\"setting[$setting[varname]][]\" value=\"-1\" /> 4. Now create a admin_options_processing hook with the following code: PHP Code:
5. That's all. Now $vbulletin->settings['my_setting_name'] will be a string like "Test1Code,Test1Code" depending on what user checked at options page. A little moment on option text localization. Instead of PHP Code:
PHP Code:
Code:
<phrasetype name="vBulletin Settings" fieldname="vbsettings"> <phrase name="my_setting_phrase_name1" date="1218041520" username="FractalizeR" version=""><![CDATA[Test option checkbox]]></phrase> <phrase name="my_setting_phrase_name2" date="1218040714" username="FractalizeR" version=""><![CDATA[Another test option checkbox]]></phrase> </phrasetype> Code:
" . eval('$options =""; foreach($vbulletin->usergroupcache AS $usergroupid => $usergroup) { $options .= "\\t\\t<label for=\\"setting[$setting[varname]]$usergroupid\\" title=\\"usergroupid: $usergroupid\\"><input type=\\"checkbox\\" tabindex=\\"1\\" name=\\"setting[$setting[varname]]"."[]\\" id=\\"setting[$setting[varname]]$usergroupid\\" value=\\"$usergroupid\\"" . iif(strpos(",$setting[value],", ",$usergroupid,") !== false, \' checked="checked"\') . iif($vbulletin->debug, " title=\\"name="setting[$setting[varname]]"\\"") . " />$usergroup[title]</label><br />\\n"; } return "<span class=\\"smallfont\\">\\n$options\\t</span>";') . "<input type=\"hidden\" name=\"setting[$setting[varname]][]\" value=\"-1\" /> |
#12
|
||||
|
||||
Quote:
Quote:
Quote:
|
#13
|
||||
|
||||
Thanks for your replies.
Can you please tell me what to do after creating the plugin at admin_options_processing hook. Is this correct ? PHP Code:
See.. I am showing 3 radio buttons via template. Simple ! Now.. I have created 3 checkboxes (corresponding to radio buttons) so that whichever is checked THAT radio button would show. How do I achieve this ? What should I wrap around my radio button code in template so that the corresponding one shows only when it is allowed (checked in admincp). Thank you |
#14
|
||||
|
||||
PHP Code:
|
#15
|
||||
|
||||
oh i still can't get it to work. See this is all what I had done:-
1. I created a setting $vbulletin->options['vin_mysetting'], Free datatype, with the following option code:- Code:
" . eval('$options=""; $fritems = array( "option1" => "First Radio", "option2" => "Second Radio", "option3" => "Third Radio", ); foreach($fritems AS $fritem_id => $fritem_name) { $options .= "\\t\\t<label for=\\"setting[$setting[varname]]$fritem_id\\" title=\\"item id: $fritem_id\\"><input type=\\"checkbox\\" tabindex=\\"1\\" name=\\"setting[$setting[varname]]"."[]\\" id=\\"setting[$setting[varname]][$fritem_id]\\" value=\\"$fritem_id\\"" . iif(strpos(",$setting[value],", ",$fritem_id,") !== false, \' checked="checked"\') . iif($vbulletin->debug, " title=\\"name="setting[$setting[varname]]"\\"") . " />$fritem_name</label><br />\\n"; } return "<span class=\\"smallfont\\">\\n$options\\t</span>";') . "<input type=\"hidden\" name=\"setting[$setting[varname]][]\" value=\"-1\" /> PHP Code:
PHP Code:
HTML Code:
<if condition="$show['option1']"> <input type="radio" name="radiotype" value="0"/>My First Radio<br /> </if> It never shows up now, whether checked or unchecked ! Thank you |
#16
|
|||
|
|||
Thanks for the info, Ive been in need of this type of info... now I just need to figure out how to create options in the UserGroup and User settings
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|