Editing the search and sort options

With the configurations of Meta fields to search by previously completed, your members are now searchable not only by the default fields used by the plugin but, also, using all of the custom fields that you specified. While this will make it quite easy for visitors to locate information, there's one problem. Take a moment to visit the members' page on your website and then click the drop-down menu located next to the search bar. As you can see, any custom field of two or more words contains an underscore between each word.

To hide the fact that the searchable fields aren't being displayed properly, you need to remove the drop-down menu. With it gone All Fields will become the default search behavior, which means that any search terms that your visitors enter will be checked against all fields.

To remove the drop-down menu, open tern_wp_members.php which is located in the plugins/members-list folder. Once this file is open, look for the following line and then delete it:

by ,.$getOPTS->selectPaired($o,,by,,,by,/,,/,,/,All Fields',array($_ REQUEST['by'])).'

Now, with that problem solved, it's time to move on to the Sort by section of the screen. It doesn't really make sense for your sort options to include Last Name, First Name, and Email if those fields aren't being displayed on your members' page. It would be better to, instead, allow your users to search by fields such as company name, city, and what ever other fields you chose to include on this page.

To alter these Sort by links you will, once again, need to make some changes to the tern_wp_members.php file, so locate this line.

$a = array('Last Name'=>,last_name,,,First Name'=>'first_ name','Registration Date'=>,user_registered,/,Email,=>,user_email');

To remove the options for last name, first name, and email and, instead, display sort options for company name and city, you will need to replace that line of code with the one that follows.

$a = array('Company Name,=>,company_name,,,City,=>,city,/,Registration Date'=>'user_registered');

If you would like to include any other fields among these sortable links, then you will need to enter them using the following format:

Now that these edits have been performed, don't close this file because you will be making additional changes to it in the next section.

Was this article helpful?

0 0

Post a comment