The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Using a vbulletin variable as the default for a setting in XML file
Hello,
I am working on modifying a product I wrote, and for the product's option settings in the AdminCP, I want to present the user with radio buttons to select a forum, rather than having to enter the forumid manually. This I have working, however, I want the default value to be the forum that has been chosen to receive user-reporting of posts. Here is my code for the setting: Code:
<setting varname="markfl_par_report_forumid" displayorder="35"> <optioncode><![CDATA[" . eval('$options = ""; foreach($vbulletin->forumcache AS $forumid => $forum) { if ($forum[parentid] > 0) { $options .= "\\t\\t<label for=\\"setting[$setting[varname]]$forumid\\" title=\\"forumid: $forumid\\"><input type=\\"radio\\" tabindex=\\"1\\" name=\\"setting[$setting[varname]]"."[]\\" id=\\"setting[$setting[varname]]$forumid\\" value=\\"$forumid\\"" . iif(strpos(",$setting[value],", ",$forumid,") !== false, \' checked="checked"\') . iif($vbulletin->debug, " title=\\"name="setting[$setting[varname]]"\\"") . " />$forum[title]</label><br />\\n"; } } return "<span class=\\"smallfont\\">\\n$options\\t</span>";') . "<input type=\"hidden\" name=\"setting[$setting[varname]][]\" value=\"-1\" />]]> </optioncode> <datatype>free</datatype> <defaultvalue><![CDATA[" . eval('return $vbulletin->options[\'rpforumid\'];') . "]]></defaultvalue> </setting> |
#2
|
|||
|
|||
I'm not 100% sure, but I think the defaultvalue in the xml is only used at the time the product is actually being installed, and I don't think you can put code there. Maybe what you want is to include some install code that sets the initial value of your option by reading the other option?
|
Благодарность от: | ||
MarkFL |
#3
|
|||
|
|||
...but it looks like it's a bit complicated bcause when the install code is run, the settings haven't been created yet. So I think what you want to do is set
Code:
$arr['options']['settinggroup']['groupname']['setting']['settingname']['defaultvalue'] |
#4
|
||||
|
||||
I wasn't able to get this to work, so what I decided to do as a workaround is if the user does not select a forum, then the report forum is used as the default. Perhaps I can get the report forum to be checked by default for a future update.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|