Turks28,
This shouldn’t be too difficult, and you won’t have to edit the plugin files to do it. You can customize the search function with your dropdown in a list template. Copy the plugin template file ‘pdb-list-detailed.php’ to your theme directory in a directory named ‘templates’ and modify this file. Instructions for creating custom templates are in the “other notes” section of this plugin’s page.
In that template, there is a function:
<?php $this->search_form() ?>
This produces all the elements of the search form except the field select dropdown. The easiest way to do this is to view the page in a browser with the search form and copy the part of the search form that this function produces: four input elements: one hidden, a text input and the two submit buttons. Paste these into the template, replacing the search_form() function. Now, you can replace the text input with your dropdown.
To populate the dropdown, you have to query the database, but it’s easy:
global $wpdb;
$last_names = $wpdb->get_col('SELECT p.last_name from '.$wpdb->prefix.'participants_database p');
Gives you an array of all the last names. Change the column it’s getting to the one you want, and you can build your dropdown from there. You can use the same idea to replace the field select dropdown, so they won’t try to search with these search terms on the wrong field. You may want to make the field select a hidden field (name has to be the same) so they are forced to search on the one column you’re getting your dropdown values from.
Hi. I’m try to do so, but I.m not programmer and didn’t where put the cod.
The search form code is:
<legend>Search:</legend>
<input name=”operator” type=”hidden” class=”search-item” value=”LIKE”>
<input id=”participant_search_term” type=”text” name=”value” class=”search-item” value=””>
<input name=”submit” type=”submit” value=”Search”>
<input name=”submit” type=”submit” value=”Clear”>
But where must be put the code?
Depending on the complexity of what you’re trying to do, it may be difficult for you to get it working with limited knowledge.
This code must go into a custom template for the list shortcode. You are really just replacing the search form that is generated by the template with your own, so that will tell you where to put it.
Read this page about custom templates if you need more help on that: http://xnau.com/work-2/wordpress-plugins/participants-database/pdb-templates/
@urryes
Hey mate, did you figure this out? If so, could you share your work?
Hi Sjourney! No, I bypassed bottlenecking. In one project, I used a participant database and it’s search – http://bloominglife.ru/buy/ . In the other – I have created a dropdown list with the plugin “connections” and conventional WordPress taxonomy – http://www.botcol.ru/where-buy/.
Hi Sjourney! No, I bypassed bottlenecking.
In one project, I used a participant database and it’s search – http://bloominglife.ru/buy . In the other – I have created a dropdown list with the plugin /connections/ and conventional WordPress taxonomy – http://www.botcol.ru/where-buy/.