Notifications
Clear all

search.php: Advanced Search Alphabetical/Most Recent sorting issue solved!

1 Posts
1 Users
0 Reactions
3 Views
(@ami-sapphire)
Posts: 8
Active Member
Topic starter
 

As it stands, the Sort Order next to the Search Term in Advanced Search does not work and uses the user's default sorting order regardless of the selection. Fine for Simple search, but not intended for Advanced Search. This is a very old issue.

How I got it to work: Use some code from browse.php.

Segment:

else {
	if($searchtype == "simple") {

Replacement:

else {
	$disablesorts = array( );
	if($searchtype == "simple") {

Segment:

  </select><br /><br /><label for=\"searchterm\">"._SEARCHTERM.": </label><INPUT type=\"text\" class=\"textbox\" name=\"searchterm\" id=\"searchterm\" size=\"20\">

Hit enter after that line and add this (this is to keep the Sort drop-down menu spaced out from the Search Term textbox):

  ";

Segment:

  <label for=\"sortorder\">"._SORT.":</label> <select name=\"sortorder\" id=\"sortorder\"><option value=\"alpha\">"._ALPHA."</option><option value=\"update\">"._MOSTRECENT."</option></select>";

Replace with this:

  if(!in_array("sorts", $disablesorts)) $output .= "<label for=\"sortorder\">"._SORT.":</label> <select class=\"textbox\" name=\"sort\"><option value=\"alpha\"".(!$defaultsort ? " selected" : "").">"._ALPHA."</option><option value=\"update\"".($defaultsort == 1 ? " selected" : "").">"._MOSTRECENT."</option></select>";

Site: http://cwcyrix.nsupdate.info/fhaven/ (private, archived)
Version: eFiction 3.5.3
Modules: Challenges 1.4, Recs 1.4.2
PHP: 5.6.40, self-patched
Other Setups (same server):
Test Site 1: http://cwcyrix.nsupdate.info/ef-testing-grounds/ (eFiction 3 Mod - chaotic, PHP 8.6.0RC4)
Test Site 2: http://cwcyrix.nsupdate.info/eee/ (eFiction 3 Mod - stable, PHP 8.5.12)
Test Site 3: http://cwcyrix.nsupdate.info/ef-clean/ (patched 'future' eFiction 3.5.9, self-patched PHP 7.4.33)
Rest of Server Details
OS - Distro: Ubuntu Linux Server 26.04 LTS (home)
Web Server: Apache httpd 2.4.69
MariaDB: 11.4.13

 
Posted : 04/11/2026 2:42 pm
Share: