Multi-Prefix Sorting on ForumDisplay

by Shadab

On Forumdisplay pages in stock vBulletin, you can select only one prefix while sorting and filtering threads. This modification will allow you to select multiple prefixes while filtering threads via the 'Display Options' on Forumdisplay.

Single selection of Prefix on Forumdisplay:
Default Single-Selection Sorting on ForumDisplay

NOTE: Multiple-prefix select option is already available on the 'Advanced Search' page (Search this Forum » Advanced Search). But the purpose of this modification is to make it available right on the Forumdisplay page.

Template Edit

1. Go to: AdminCP » Styles & Templates » Style Manager

2. Click on the Expand Templates [« »] button for the skin which you want to edit; and then expand the Forum Display Templates group.

3. Double click on the FORUMDISPLAY list item to edit that template.

4. Then ADD and REMOVE the codes highlighted below:

TIP: Search for <table cellpadding="0" cellspacing="1" border="0"> or
$vbphrase[sorted_by] to find the <table> element we need to edit.

<table cellpadding="0" cellspacing="1" border="0">
<tr valign="bottom">
	<if condition="$prefix_options">
	<td class="smallfont" rowspan="2" style="padding-$stylevar[right]:$stylevar[cellpadding]px">
		<div><label for="sel_prefixid">$vbphrase[prefix]</label></div>
		<select name="prefixid[]" id="sel_prefixid" multiple="multiple" size="3">
			<option value=""$prefix_selected[any]>$vbphrase[any_prefix_meta]</option>
			<option value="-1"$prefix_selected[none]>$vbphrase[no_prefix_meta]</option>
			$prefix_options
		</select>
	</td>
	</if>
	<td class="smallfont" style="padding-$stylevar[right]:$stylevar[cellpadding]px">
		<div><label for="sel_sort">$vbphrase[sorted_by]</label></div>
		<select name="sort" id="sel_sort">
			<option value="title" $sort[title]>$vbphrase[thread_title]</option>
			<option value="lastpost" $sort[lastpost]>$vbphrase[last_post_time]</option>
			<option value="dateline" $sort[dateline]>$vbphrase[thread_start_time]</option>
			<option value="replycount" $sort[replycount]>$vbphrase[number_of_replies]</option>
			<option value="views" $sort[views]>$vbphrase[number_of_views]</option>
			<option value="postusername" $sort[postusername]>$vbphrase[thread_starter]</option>
			<if condition="$show['threadratings']"><option value="voteavg" $sort[voteavg]>$vbphrase[thread_rating]</option></if>
		</select>
	</td>
	<td class="smallfont" style="padding-$stylevar[right]:$stylevar[cellpadding]px">
		<div><label for="sel_order">$vbphrase[sort_order]</label></div>
		<select name="order" id="sel_order">
			<option value="asc" $order[asc]>$vbphrase[ascending]</option>
			<option value="desc" $order[desc]>$vbphrase[descending]</option>
		</select>
	</td>
	<td class="smallfont">
		<div><label for="sel_daysprune">$vbphrase[from_the]</label></div>
		<select name="daysprune" id="sel_daysprune">
			<option value="1" $daysprunesel[1]>$vbphrase[last_day]</option>
			<option value="2" $daysprunesel[2]>$vbphrase[last_2_days]</option>
			<option value="7" $daysprunesel[7]>$vbphrase[last_week]</option>
			<option value="10" $daysprunesel[10]>$vbphrase[last_10_days]</option>
			<option value="14" $daysprunesel[14]>$vbphrase[last_2_weeks]</option>
			<option value="30" $daysprunesel[30]>$vbphrase[last_month]</option>
			<option value="45" $daysprunesel[45]>$vbphrase[last_45_days]</option>
			<option value="60" $daysprunesel[60]>$vbphrase[last_2_months]</option>
			<option value="75" $daysprunesel[75]>$vbphrase[last_75_days]</option>
			<option value="100" $daysprunesel[100]>$vbphrase[last_100_days]</option>
			<option value="365" $daysprunesel[365]>$vbphrase[last_year]</option>
			<option value="-1" $daysprunesel[all]>$vbphrase[beginning]</option>
		</select>
	</td>
</tr>
<tr valign="bottom">
	<td class="smallfont" colspan="2">
	<if condition="$prefix_options">
		<div><label for="sel_prefixid">$vbphrase[prefix]</label></div>
		<select name="prefixid" id="sel_prefixid">
			<option value=""$prefix_selected[any]>$vbphrase[any_prefix_meta]</option>
			<option value="-1"$prefix_selected[none]>$vbphrase[no_prefix_meta]</option>
			$prefix_options
		</select>
	<else />
		&nbsp;
	</if>
	</td>
	<td colspan="3" class="smallfont" align="$stylevar[right]" style="padding-top:$stylevar[cellpadding]px">
		<input type="submit" class="button" value="$vbphrase[show_threads]" />
	</td>
</tr>
</table>

5. Hit the [Save] button when you're done making the above mentioned changes.

Product & Plugins

Download Product FileWe just need to import the product file which consists of two plugins, now. Download the zipped product file (product.zip) and unzip it on your desktop. (Filename: multi_prefix_sort.xml)

6. Go to: AdminCP » Plugins & Products » Manage Products » [Add/Import Product]

7. Click on [Browse] button and select the multi_prefix_sort.xml file you just unzipped.

8. Finally, hit the [Import] button.

We're done!

Now you can select multiple prefixes while filtering the threads. This is how the 'Display Options' block would look like, after the template edit and product import:

Multiple Prefix Sorting

If you are not at ease with making the above mentioned changes, or fear that you’ll end up messing your vBulletin Forum; feel free to open a thread in our Forum Management section or simply add a comment here; asking for further assistance.