< Back to Adding Fields

Different Custom Fields Per Forum

Suppose you have two different types of submissions, so you want a different set of fields to appear when submitting in one forum compared to another.

In WSN 9.0 or later:

Go to the field manager at Admin Panel -> Topics -> Topic Fields. When you add a new topic field or edit one of the existing ones here, find the "Bind to Forums" prompt and select the forums you want the field to appear in. If no forums are selected, the field will appear in every forum.

In WSN 8.0 or earlier:

In older versions there are two approaches you can take to make the submit end edit topic templates appropriate to their forums:

(A) Create custom templates (At Admin -> Themes -> Manage Templates -> create custom template) that are copies of the submit topic and edit topic templates to be used for your second type of submissions, on which you remove unwanted fields and add any new wanted ones (you can cut and paste standard fields from the standard submit end edit topic templates, and custom fields from the "Topic Fields - Add/Edit" template which is where they'll have gone by default when they're added). Then go to the edit forum page for the forums which will use the second type of submission and select the custom templates you made in the "Custom Templates" section where it asks for submit topic and edit topic templates.

The drawbacks of this method are that you have to maintain four submit and edit templates instead of two (still manageable but if you have 8 different types of submissions then your templates will be multiplying out of control), and that you have to edit each subforum (if they're supposed to apply to all subforums below a forum) to assign the appropriate submit and edit custom templates because there's presently no option to inherit them automatically.

(B) Alternately, use single submit topic and edit topic templates with conditionals to distinguish the fields like this
put fields exclusive to forum id #1 and its subforums here

put fields exclusive to forum id #2 and its subforums here

You can find the forum id number on the edit forum page where it says "Edit Forum #50 (Forum Name)".

The drawback of this method is that you'll also have to prevent people from changing their forum selection during the submission process, since if they changed the forum they'd be looking at the wrong fields. To stop them changing the forum, first replace this block from both the submit and edit topic templates (it may look different depending on whether you have an english-only install or a different theme, but it's always the forum selection area):
<td class="labelscolumn"><span class="labels">{LANG_GENERAL_CATEGORY}:</span></td>
<td class="optionscolumn">

<div id="catlevels">
<div id="levelbox{LEVELID}" class="floatleft">
<select name="catlevelid[{LEVELID}]" size="5" onclick="wsn_getnextlevel(this.value)">{LEVELOPS}</select>
<!-- LEVELS ROWS -->
<div class="clear"></div>
<IF {SWITCH_CATSELECTOR}><select name="catid" required="required" class="required">{CATSELECTOR}</select><ELSE><input type="<IF {CATID}>hidden<ELSE>text</IF>" name="catid" value="{CATID}" >{CATNAME}</IF>
<br ><input type="checkbox" name="setnewcat" onclick="wsn_showorhide('div1');" value="1" {SUGNEWCATCHECK} > {LANG_SUGGESTLINK_SUGGESTCAT}
<div id="div1" style="position: relative;<IF not {SUGNEWCATCHECK}> display: none;</IF>">
<input type="text" name="suggestcatname" size="{STANDARDSIZE}" value="{SUGGESTCATNAME}" > {LANG_SUGGESTLINK_ASSUB}
<IF {SWITCH_CATSELECTOR}><select name="suggestcatparent"><option value="0">{LANG_TOPLEVEL}</option>{FUNC_CATSELECTOR[{SUGGESTCATPARENT}]}</select><ELSE><input type="text" name="suggestcatparent" value="{SUGGESTCATPARENT}" size="4" ></IF>

with this hidden input to force a forum:

<input type="hidden" name="catid" value="{CATID}" >

Then edit the main index template to delete

so that they have to go into a forum in order to submit to it.

Finally we come to the matter of how to display the topics differently. Using conditionals like in option B above is normally the best way here -- go to Admin -> Themes -> Manage Templates -> Topic Details (or combined details+posts if that switch is on) and just customize your display with conditionals that check

put display code exclusive to forum id #2 and its subforums here

For custom fields, you can cut and paste their display code out of the "Topic Fields - Display" template which they're automatically added to when you add the field.

At this point, your site should be displaying the two separate types of forums appropriately.