WSN Forum https://scripts.webmastersite.net/wsnforum/manual en-us Different Custom Fields Per Forum How to have different forums use different submission forms and different display results. https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/different-custom-fields-per-forum-585.html Sun, 24 Feb 2013 04:32:21 GMT https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/different-custom-fields-per-forum-585.html
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
<IF {CATISBENEATH[1]}>
put fields exclusive to forum id #1 and its subforums here
</IF>

<IF {CATISBENEATH[2]}>
put fields exclusive to forum id #2 and its subforums here
</IF>

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):
<tr>
<td class="labelscolumn"><span class="labels">{LANG_GENERAL_CATEGORY}:</span></td>
<td class="optionscolumn">

<IF {SWITCH_LEVELSELECTOR}>
<div id="catlevels">
<div id="levelbox{LEVELID}" class="floatleft">
<select name="catlevelid[{LEVELID}]" size="5" onclick="wsn_getnextlevel(this.value)">{LEVELOPS}</select>
</div>
<!-- LEVELS ROWS -->
<div class="clear"></div>
</div>
<OTHERWISE>
<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>
</IF>
<IF {THISMEMBERGROUPCANSUBMITCATEGORIES}>
<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>
</div>
</IF>
</td>
</tr>


with this hidden input to force a forum:

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

Then edit the main index template to delete
<IF {THISMEMBERGROUPCANSUBMITLINKS} or {SWITCH_DENIALPAGE}><li> <a href="suggest.php?action=addlink">{LANG_TITLE_SUGGESTNEWLINK}</a></li></IF>

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

<IF {CATISBENEATH[2]}>
put display code exclusive to forum id #2 and its subforums here
</IF>


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.]]>
Custom WYSIWYG Fields Use WYSIWYG editors for custom fields. https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/custom-wysiwyg-fields-503.html Sat, 20 Jun 2009 11:38:41 GMT https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/custom-wysiwyg-fields-503.html
1. At Admin -> Settings -> Tweaks Editor, place your custom field name in the extrawysifields tweak. If you have multiple, separate with commas.
2a. If it's a topic field and you're running WSN 9 or later, go to Admin -> Topics -> Topic Fields and use this code in the display html area when adding/editing the field: <textarea name="yourfieldname" id="yourfieldname" class="submitdescription">{LINKEDITORCONTENT[yourfieldname]}</textarea>
2b. If it's not a topic field, or you're using WSN 8 or older, use this code in the submit/edit template:
<tr>
<td class="labelscolumn"><span class="labels">Your Custom Field:</span>
<p class="center"><select name="editormode">{EDITORMODEOPS}</select></p>
</td>
<td class="optionscolumn">
<textarea name="yourfieldname" id="yourfieldname" class="submitdescription">{LINKEDITORCONTENT[yourfieldname]}</textarea>
</td>
</tr>
]]>
Adding a New Field Tracking new data. https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/adding-a-new-field-98.html Mon, 10 Nov 2003 20:34:13 GMT https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/adding-a-new-field-98.html
Topic Fields in WSN 9.0+

As of WSN 9.0, you can use the field manager utility at Admin Panel -> Topics -> Topic Fields to add and edit topic fields. This utility makes everything easy for you while providing complete control.

Other Fields and Older Versions

Go to Admin Panel -> Customizations -> Add Fields to get started.

For example purposes, suppose you want topic submitters to be able to specify a color for the topic they're submitting. Choose 'topic field' and type a suitable label such as 'color' (please note that the field name has to be alphanumeric, no spaces or accented characters -- keep it short and simple). Next, select the desired way to collect the input from the user -- a simple input box, a dropdown selector, checkboxes or the like. The simplest method is a regular input box, that's what you usually want. If the content will be a large amount of text (perhaps an article), you will want to choose the 'text area' option. If you wish to display options to let the submitter check a box for each one that applies to their topic, use checkboxes. If you want to let them choose a single option from a dropdown menu (like the forum selector in the top right of your screen now), then choose 'dropdown selector'. If you want a combo box that allows multiple selections (like your 'related forums' options on the edit forum page), choose 'multiselect combo box'. To list several options in the same style as checkboxes but only allow the submitter to choose exactly one option (no more, no less), choose 'radio button'. If this field is not something that you want to be selectable or editable by anyone (even yourself), you may wish to make it invisible.

For our color field, we'll likely want these selections:
[image]addfields.jpg[/image]
Note that we've filled in the list of colors in the box that appears for that when we choose to make it a dropdown selector. Make sure you do a comma-separated list.

Next we come to a series of self-explanatory checkboxes which you normally want to leave checked, unless you don't want non-admins to submit or edit or you don't want the field's contents displayed or you don't want people to be able to search the field. We're ready to press the Add Field button now.

Now that the field has been added, you may want to edit the appearance of it. At Admin Panel -> Themes -> Manage Templates you'll find a "Custom Fields" section where all the custom fields code gets inserted by default. For the topic color field we just added, click the "Add/Edit" next to Topic Fields. You'll see the table row there which prompts people to choose the color and you can make any changes you want there. Sometimes, however, you want to control exactly where on the page the field appears -- you can do that by cutting and pasting from here to both the "Submit Topic" and "Edit Topic" templates at the desired location.

You can also change how the value in the field is displayed on the topic details page, or make it be displayed in other templates like the topic bit. First click the "Display" next to "Topic Fields" on the Manage Templates Page. Cut and paste the display code for your field from there to your desired location in the "Topic Details" template (or "Combined Details + Posts" if that switch is on). You can also copy it to any other template where topic variables are applicable. You may want to use template conditionals to control the display.

For types of fields other than topic fields, there's no autogenerated display code. Instead, you'll have to write your own using the template variable it gives you when you make the field... that'll be { + TYPE + FIELDNAME + }, for example {CATSPECIAL} for a forum field named special. For a forum field, you'll probably want to show it in the main index template. For a member field, the view profile template.

Selectors and Checkboxes Notes

If you're dealing with a single checkbox or single selector and want to test if a value is selected, you can use {LINKCHECKED[fieldname]} (or {CAT, {MEMBER etc) in your template conditional. If dealing with multi-value checkboxes or selectors, you can use {LINKCHECKED[fieldname <,> value]}> to test for each value. If you just want a comma-separated list of all selected values, use {LINKSELECTIONSLIST[fieldname]}. Don't use the plain {LINKFIELDNAME} template variable as it will not produce the expected results for a mutli-value field.

Advanced Notes

If you add a custom setting, as of 7.1 it will go to the "custom settings" template in the admin cp templates. A new "custom settings" option will appear in your admin panel left frame menu at the bottom of the settings section.]]>
Custom Rating Fields Letting people vote on more specific details. https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/custom-rating-fields-32.html Thu, 25 Sep 2003 14:45:47 GMT https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/custom-rating-fields-32.html
A custom rating field can be added in the same way as any other new topic field (go to Admin Panel -> Topics -> Topic Fields in WSN 9.0+, or Admin Panel -> Customizations -> Add Fields in earlier versions), the only difference in the process being that you must give the template variable a name that includes 'rating' in it. For example, 'stylerating'. If you select rating field and don't include rating in the field name, it'll be appended automatically.

In the display html, you will need to make use of these separate topic template variables for your new rating field:

{LINKSTARS[fieldname]} - Graphically displays the current rating with stars and allows voting by clicking a star.
{LINKRATING[fieldname]} - Shows the rating, which is a decimal number normally between 1 and 5 (depending on your min and max vote value settings).
{LINKVOTES[fieldname]} - Shows the number of votes so far.

Using the example of a field stylerating, you will have {LINKSTARS[stylerating]}, {LINKRATING[stylerating]} and {LINKVOTES[stylerating]}.

In the vote template you'll probably want to use {LINKSTARS[stylerating <,> own]} instead to show only the current viewer's vote (indicating to them what their vote was, and allowing them to change it if applicable).

To make showing/editing of individual votes work for custom rating fields, pass &field=ratingfieldname at the end of the normal show votes url.

To do custom ratings for members, use memid={MEMBERID} in place of id={LINKID} in your form.

If using the rating posts switch:

Those of you including posts with ratings will probably will need to make some further modifications to the Admin -> Themes -> Manage Templates -> "Vote" template. To collect the vote in the rating submission form, use this:
<tr>
<td class="labelscolumn"><span class="labels">Rate {LINKTITLE}'s Style:</span></td>
<td class="optionscolumn"><select name="styleratingvotevalue"><option value=""></option>{RATINGVOTEOPS[stylerating]}</select></td>
</tr>

To display a person's full set of ratings plus their post in one spot. The toplist in the default "vote" template does this for you, but it doesn't include your custom rating fields. Then to display the vote above the post after submitted, find
<div class="ratingsstars">
{RATINGSTARS}
</div>
and change it to
<div class="ratingsstars">
Overall rating: {RATINGSTARS}
<br>Style rating: {RATINGSTARS[stylerating]}
</div>
]]>
Removing and Renaming Taking out fields you don't want. https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/removing-and-renaming-33.html Thu, 25 Sep 2003 06:46:10 GMT https://scripts.webmastersite.net/wsnforum/manual/extending/adding-fields/removing-and-renaming-33.html
If it's a topic field in WSN 9.0+, you can edit or remove it via Admin Panel -> Topics -> Topic Fields. Otherwise, if you're absolutely certain that the field isn't being used anywhere, you can remove it through Admin Panel -> Customizations -> Add Fields by clicking the "Show/hide advanced options" link. Note that removing a field via the add fields page (unlike the Topic Fields page) may not remove all of the associated HTML from your templates unless the code is nearly unchanged from the default... you may thus have to manually edit your templates to remove stuff.

If you rename a field, be certain that you edit all templates to use the new name of the field and the new template variable for it. You may wish to use the Admin Panel -> Miscellaneous -> Advanced Options page to do a bulk replace of all instances of the old field name and template variable in all templates with the new name and template variable of the field. In doing this be sure to replace both the field itself and the associated template variable -- in you rename field1 to field2, you must mass-replace field1 with field2 AND mass replace {LINKFIELD1} with {LINKFIELD2}.]]>