Posted on by

Creating Links to Show a Filtered List Result

This post is about how to construct a link that when followed, shows a specific search result in the Participants Database list display.

So, first of all you need to set up your base URL. This is the URL that takes you to the page that shows the [pdb_list] shortcode.

In the following examples, you would add the ? and everything after that to your base URL to get the URL to use on your site.

Important: if your base URL has a ? in it, then to use the examples, replace the ? in the example with a & so that the variables will be added to the variable that is already in your base URL.

For Example

Let’s say you have a list of people who have specific skills. They’ve filled in their information using a “multiselect” to indicate which skills they have. Now, you want to show a link on your site that will show all the people with a particular skill.

This is easy to do, because it’s possible to include simple search parameters in a URL to a page with the [pdb_list] shortcode.

Let’s say the name of your skills field is “skills” and you want to show all the web designers. First, take a look at the values you have defined for your Skills multiselect so you know the exact string to look for. In this case, it’s ‘web designer’. The case is not important.

In a URL, the search parameters are ‘search_field’ and ‘value’ so we tell the list which value we are seeking in which field. Now, our search term has a space in it, so because we are using the term in a URL, we need to convert that space into a URL-encoded value. The value for a space is %20, so this will be what you will add to the URL for the search result page:

?search_field=skills&value=web%20designer

And that will show you all the people who checked “Web Designer” in their skills.

You can only do simple searches this way: on a single field with a single search term. If you want something more complex than that, you’ll need to create a custom WordPress template that can process a more complex search from the URL and build those into the filter attribute of the list shortcode.

Wildcards

You can use the wildcard characters (*?) in the search value. For instance, if you want the URL to match just the first letter, you could set up a URL like this:

?search_field=last_name&value=a*

That will show all the records with a last name that begins with “a”.

Advanced Use: Operators

If you need to tweak the results some, you can use an “operator” to change how the search is performed. If an operator is not specified, it defaults to matching the record if the serch term is found within the field data. If you need it to show only exact matches, you can add an operator to the URL, like this:

?search_field=thing&value=car&operator=eq

That will match only a thing value of “car” and not something like “cart” (Note: you can’t use wildcards with the “eq” operator.)

Other operators you can use are:

codeoperator
eqequals
~like (find within the data)
gtgreater than
ltless than
nenot equals

Links like these will work with the Multi-Search feature of the Combo Multisearch add-on. Note that this only works with fields that are configured in the Multisearch section of the add-on, also operators in the URL won’t change how the search works. This is because the URL is simply preselecting the multi-search fields and submitting the search.

It’s also possible to create a URL that filters on multiple fields with a syntax like this:

?search_field[]=city&value[]=Huntsville&search_field[]=state&value[]=Alabama

Note the brackets which allow multiple values for “search_field” and “value.” In order for this to work, the “search_field” value must be paired with a “value” value and in the same order.

When using multiple search fields on Combo Multisearch, you can’t use the comparison operators, but you can set how they will be joined with the “operator” variable, as in this example where both the city and state must match:

?search_field[]=city&value[]=Springfield&operator=AND&search_field[]=state&value[]=MA

The default is “OR” so you will only need to do this to achieve an AND with the search terms.

Combo Search

With the Combo Multisearch add-on, you can preload the Combo search with the URL by using the “combo_search” field…for example:

?search_field[]=combo_search&value[]=tennis&search_field[]=combo_search&value[]=pickleball

Sorting The List

It is also possible to set the sort of the list in the URL. The variable names to use for that are ‘sortBy’ and ‘ascdesc’ which should hold the field name and the direction of the sort, respectively. For example, to sort by last name in normal alphabetical order, you’d use a URL with variables like this:

?sortBy=last_name&ascdesc=asc

Of course, this can be combined with sort terms by using the & symbol…for example:

?search_field=last_name&value=a*&sortby=last_name&ascdesc=asc

Troubleshooting

If you find that you’re not getting the expected results, there are several things to check.

The most common culprit: page caching. Make sure page caching is off for the page you’re showing your search results on. A page cache will often show an un-updated page, so it looks like you didn’t get any result at all. The page with the [pdb_list] shortcode should be exempt from page caching.

(You should never use page caching, or any kind of site acceleration at all when developing and setting up a site. Once the site is doing what you want it to do, turn the cache or accelerator plugin on, then test the site to make sure it works with it on.)

Another common source of problems is the use of the [pdb_search] shortcode. If you have both the search shortcode and the list shortcode on a page, you won’t get the results displayed correctly when using a search result URL. It is best to use the list shortcode alone. Details here…

Next, make sure the spelling in your URL is correct. The name of the field must exactly match the name as shown on the Manage Database Fields page. Don’t try to use the field’s title, it won’t work. If the search terms contain things like spaces or punctuation, you probably need to “urlencode” the value.

If you’re sure the URL is correct, you’ll need to look deeper to understand the results. First, turn plugin debugging on. This is in the Participants Database settings under the Advanced tab. What this will do is record the database query that was used to produce the result.

When using the debugging log, it is important to clear the log before performing a test. Then check the log right away after you do the test so that the only messages in there will be caused by your test. What you’re looking for is the list query, it will be a MySql query that is pretty easy to understand.

If you understand the query, and it looks correct, but the results are not what you expect, you need to look at the database data directly. Open your database using phpMyAdmin or a similar tool. The table you want to look at is named wp_participants_database (your “wp_” prefix may be different), in there you will see the raw data. Sometimes the actual data is different than you expect it to be, this will tell you what’s really going on.

104 thoughts on “Creating Links to Show a Filtered List Result

  1. Hi, this sounds like it’s along the lines of what I want to do but I’m not sure I understand it enough. I’m a book blogger creating a database of all my books and I’d like a way to then search my entire collection (I have over 1000 books) for a book that suits what I feel like reading. For example, a book by an Australian author that’s a romance. Ideally I’d like to just select these parameters from say drop down lists and then have all the results that don’t match BOTH of these parameters to hide, therefore only showing my books that match what I feel like reading.
    By sounds of it, what you’ve explained here is creating set customer searches without the ability to dynamically change what you’re searching for. Have I misunderstood? Can this plugin even do what I’m looking for?

    1. Hi Anthea,

      It sounds like what you’re looking for is offered by the Combo Multisearch add-on to Participants Database.

      This tutorial is for the purpose of providing links to records so they can be edited.

      1. That looks great thank you!

      2. Hi Roland,
        This is probably silly but I’ve just spent the last 40 minutes going through all the instructions for the Combo Multisearch add-on and I can’t figure out how to set it up. When I stuffed up I ended up having to go through the history of the page to find the code to get even the basic search back.
        I feel like it took me 2 seconds to find the right search code when I initially installed this. Yet this time, I can’t find any short code that I can just copy and paste in.
        Has the updates made this more difficult? How can I set up the multisearch to feed from the settings I’ve set up?
        Anthea

        1. The multisearch add-on requires that the multisearch template be named in the shortcode, so it should be

          [pdb_list template=multisearch]

          For the standard search, the shortcode is:

          [pdb_list search=true]

          As to configuring the multisearch, the basic configuration you need to do is to tell it which fields to search on. There are two ways to do this, depending on how you want the search to work. If you want to present a single search input that searches on multiple fields, you put the list of fields into the “Combo Search Fields” setting.

          If you want each field to have its own input in the search, use the “Multi Search Fields” setting.

          Let me know if you are still not getting the results you want.

  2. Hi Roland,

    I’m trying to combine search fields in the query using the syntax shown in the examples, but I just get every listing in the database instead. Will take a look and see what I’m doing wrong?

    Here’s an example: http://tinyurl.com/y2yu6mkx

    1. First, I would suggest you put the “approved=yes” into the shortcode as a filter there: you don’t need a dynamic value for that, and it also makes it too easy for someone to see the unapproved records should they want to.

      Second, when testing complex filters such as this, you should turn plugin debugging on (plugin settings, advanced tab), then look at the debugging log after loading the page. That will show you the resulting query and you can easily see why you are getting the results. The syntax of your link looks OK, but what really matters is what value you’re trying to match in the database.

      1. Hi Roland,

        Thank you for your help and quick response. Adding the filter did the trick. I got so stuck on adding more filters to the query that I forgot about the simplest solution. Thanks for the reminder about the plugin debug tool as well. I keep forgetting that’s there.

        Cheers!

    2. Hi Roland, I am having the same difficulty as Kirk described. (Still a noob here)

      I want to publicly display a filtered list based on the Approved field, which I have as a check box (yes or no). I have tried to add the suggested “approved=yes” into the short code, but I obviously have the wrong syntax. I’ve tried a variety of different combinations, but all either display the entire list, with both approved and not approved names, or an error on the site.

      This is what I’ve tried, in various formats:
      [pdb_list search=true?search_field=approved&value=yes]

      The part up to the ? followed by a close bracket was what I had originally for the short code. Can you guide me in the right direction?

      Thanks for your assistance.

      1. I forgot to mention that I want the search function available, if it’s not apparent from the code string.

      2. This article is about creating a URL that will show a filtered list, in other words, it tells you how to create a link to the page that shows your list where the results are filtered by a value in the URL.

        Your question is about a different thing: how to configure the list shortcode so that it does not show unapproved records. So, to answer your question about the shortcode, I suggest you try a shortcode like this:

        [pdb_list filter="approved=yes" search=true]

        The syntax of shortcodes is to put a space between each attribute in the shortcode. The use of the “filter” attribute in the shortcode is explained here: Using List Shortcode Filters

        1. Thank you, thank you!! It works perfectly.

          I miss Kauai and Kapaa is my favorite town there. I hope to come back to visit again some day. Maybe I can see your vanillery.

        2. You know Kauai? Cool! I’m happy to show people around the vanilla operation, I do it about 3 times a month now.

  3. Hi,
    Thank you for your nice plugin.
    I am facing some difficulties with filtering content.
    On my computer in google chrome the filtering works perfectly.
    When I try to use the filter option in internet explorer or mobile chrome or mobile firefox then the filtering does not work. It just shows all the results.
    Could you hel me with this problem?
    Thanks

    1. Are you asking about using the “filter” in the [pdb_list] shortcode…or is it the search form for the list display? Do you have a link I can test?

      1. Roland – I am having the same issue: using the links to show a search criteria doesn’t work on mobile. Do you have any ideas how to fix that?

        Here’s a link to the page (search criteria are linked to the year buttons): https://illinipulse.com/recruit-database-basketball/
        Thanks!

        1. Generally, this is due to how your theme handles delivering content to mobile devices. I can’t be specific, but you’ll need to look into any settings that have to do with showing your site on mobile devices. It looks to me like the theme is caching the page and so it’s not showing the result of the search term in the URL.

        2. Thanks for the reply Roland. My theme uses a separate mobile theme (tagDiv Mobile Theme). I guess I’ll have to disable the buttons on mobile.

  4. https://www.totem-forbes.com/ean/?pdb=2587

    i want to add UPC/EAN Number in URL which should be come from another page thru search. but i am not able to do also i want to redesign pdb_list which should come from URL query string.

    Please help

    1. The technique in this article will allow you to do this, but it is up to you to figure out how to set up the URLs on your site. The plugin can’t do that part for you.

      You have to have a field in your Participants Database that holds the UPC, then you can use a link to the page with the [pdb_list] shortcode that has the UPC number in it. If your UPC field is named ‘upc” and your [pdb_list] is on a page named ‘find-products” you can make a URL like this that will show a specific product:

      /find-products?search_field=upc&value=123456

  5. Hi Roland—I have installed PDB and search.

    All working EXCEPT search field values that contain a space, such as “Los Angeles” in City or “Addiction Medicine” in Specialty 1.

    I found that the space is being converted to %2520.
    Do you have a fix for this? Thanks!

    1. Where are you seeing this code?

      %20 is the correct code for a space, but it’s not something you’d see on the frontend.

      Also: is the search not matching if there is a space?

      1. The space is being converted first to %20, and then %2520. You can go to the site and try it yourself —you’ll see that the search won’t find Los Angeles. Same with values in specialties that contain a space. I researched this—it means the submitted value with a space is going through encoding twice. I can see it in Firebug.

        1. You’re right about the double encoding, it’s just that it’s not doing this on the backend as far as I can see. I figured it was something to do with your browser or WP theme. Can you tell me how you have your search configured and what you’re doing to get this result?

        2. Hmmm-I just used your plugin settings (multisearch). I’m using the Divi theme. The encoding seems to happen first in the web browser (Chrome or Firefox) when the form is submitted. Then it is encoded again when the form information goes into the site server. The search values for the Specialty dropdowns are populated from the values already entered. I’ve seen a couple options for changing the php to deal with the double encoding but they don’t really get at the root of the problem. Thanks for any help you can give me.

        3. Can you share a link so I can see what it’s doing? I don’t see the encoding issue you’re talking about in my tests.

        4. When I select “Addiction Medicine” in the Specialty 1 dropdown, here’s what comes up (you can see that the search value is properly encoded, and then the filter that’s generated contains the double-encoded space) :

          action
          pdb_list_filter
          instance_index
          1
          listpage
          1
          orderstring
          pagelink
          /graduatedirectory/?listpage=%1$s
          postID
          764
          sortstring
          specialty_1
          Integrative%20Medicine
          submit
          search
          subsource
          pdb-multi-searchform
          target_instance
          1
          Source
          postID=764&submit=search&listpage=1&action=pdb_list_filter&target_instance=1&instance_index=1&pagelink
          =%2Fgraduatedirectory%2F%3Flistpage%3D%251%24s&sortstring=&orderstring=&subsource=pdb-multi-searchform
          &specialty_1=Integrative%2520Medicine

        5. I really need to see it to make sense of what you’re asking about. Using the list search doesn’t generate a URL like that, so I’m confused as to the circumstances you’re referring to.

        6. Hmmm—Can you give me more specifics on what link you want to see? Just to give you the full context, this is hosted on GoDaddy, where I installed PDP, added the Combo Multisearch plugin, configured the data fields in PDB, imported a csv file with the participant info, set up the search settings and set the list to be suppressed until a search is performed. The shortcode for this is on the GraduateDirectory page: [pdb_list template=multisearch suppress=true orderby=last_name order=asc]
          The information I just sent is from the Net part of Firebug, which I used to see what’s happening from user’s browser side when a search is performed: 1) value is being submitted from the browser form (and has the %20 encoded representation of a space). 2) Then, it looks like the system generates something to actually do the search of the database field. Somewhere in that process, it appears that a second encoding creates the %2520 (%25 is the encoded expression of a percent sign) which messes up the search value.

        7. Now I understand. I’m looking at your search page, and as far as I can see it’s working as expected. The place to look is in the form Params (in Firefox) where you can see the search term is getting sent correctly.

          Are you using Whole Word Match Only? If you don’t need it, it may be preventing matches in some cases.

        8. Hi Roland—Yes, the search form generally works fine, EXCEPT the search values that contain a space, as I described. I went into File Manager in Cpanel and examined the java files for your search extension and found one (jquery_formsaver.js) that (I think) grabs the submitted form values (which are already encoded as they come from the browser) then encodes them again, so I think this is where the double encoding is happening. I noticed that cpanel will allow me to change to another encoding . Would that help? Or is there a line of code to add that will turn off encoding of the value? Not sure i am thinking about this correctly so any guidance you can offer is much appreciated!

        9. I am releasing an update to Participants Database today that I expect will help with this.

        10. Great, thank you!

        11. Hi Roland—thanks for releasing the new update—still getting 0 result when I submit a search control with a value that contains a space. If I enter Los I get Los Angeles plus Los Altos, Los Gatos, etc. If i enter Angeles I get Los Angeles. If I enter Los Angeles I get nothing. In firebug I see Source:
          postID=764&submit=search&listpage=1&action=pdb_list_filter&target_instance=1&instance_index=1&pagelink
          =%2Fgraduatedirectory%2F%3Flistpage%3D%251%24s&sortstring=&orderstring=&subsource=pdb-multi-searchform
          &city=Los%2520Angeles

          (Note the %2520 value)

        12. Michael,

          I can’t reproduce your result here, so if possible, the next step would be to set up debugging on your site: if you get your php error log set up and enable WP_DEBUG, we can see exactly what is going to the database, the db query gets written to the log.

        13. Michael,

          I just released an update to Combo Multisearch that may fix your issue.

        14. Was about to turn on WP_debug per your suggestion. I’ll try this first. I was thinking the combo-multisearch files could be affecting the search value. Thanks!

        15. Roland—It worked! Thanks so much!

          Michael

  6. Hi Roland,

    links work well if I use only pdb_list shortcode in target page.

    In case I am using pdb_search and pdb_list shortcodes in the same target page (but in different divisions from design point of view) links do not work: the list is not filtered, only search form fields are prefilled with search and value parametrs brought from the link.

    Any ideas, please?

    Roman

    1. Well, first, it’s important to configure the [pdb_search] shortcode so that it targets the correct list. Take a look at the HTML of the list you want to update with the search. At the top, you’ll see something like:

      That means that the instance number of that list is 7. The search shortcode should then be [pdb_search target_instance=7]

      As to the issues with the list itself…I don’t know what that might be. Can you share a link so I can see what it’s doing?

  7. Hello, I have installed this and i am very happy with its functionality. I have read the above comments and found one with almost the same problem as mine. I want to be able to show just the search field on a page, with the list being hidden, and i have managed that with the supress tag (although it still show like a little blank field right below the search field). Well the problem is that i want to enforce exact match search.. like to show the result of a search only if you input the exact value of that element. For example: you are searching for a certificate. And i want the plugin to show details of that certificate only if you input the exact certificate number, not more of it, not less. How can i do that? thanks a bunch.

    1. Try the “Strict User Searching” setting under the advanced tab of the plugin settings.

      1. Hello, thanks for your reply, i already did that. It was checked but for some reason doesn’t work? the tag i am using that page is [pdb_list suppress=true search=true search_fields=city sort=false display_count=true template=detailed list_limit=2]. And if ty searching for a word starting with H for example, it will show all the entries that start with that letter.
        If i try using the [pdb_search] tag instead, when i press the search button, it redirects me to the same page but with a /#participants-list-1 at the end of the link, but no search results.
        I don’t think i am using the plugin right? For what i want to get out of this (hiding the list and searching for 1 specific item on the list but with the exact match word) what do i need to do ? create a new page and just add the shortcode there? or is the something else i am not aware of? Thank you for your help. Is there any way to donate?

        1. That should work. I just checked it. With “strict user searches” on, if I type in a single letter, I get zero results because there isn’t a record with only the one letter as the value.

          What kind of field is it you’re searching on?

          You’ve got the shortcode right, you don’t need the pdb_search shortcode unless you want the search control in a different location from the list of results. It’s takes a bit of setup to get that working.

        2. Hey, thanks again for your reply. Indeed it works, but only in this form: [pdb_list suppress=true search=true search_fields=cod_certificat sort=false]. Maybe it`s something do to with my theme, i don’t know. I use the ark theme if you know it and it uses a modular builder for pages. If i try to use the shortcode inside that builder it goes berserk :) I have to do more testing with it. I will be back with more feedback of this matter. Ah 1 more important thing: how can i change the button text for the search button and the clear button, and also the “Search: ” text above the search field? I found something about this in /wp-content/plugins/participants-database/templates/pdb-list-detailed.php “$values = array( ‘submit’ => ‘Search Records’, ‘clear’ => ‘Clear the Search Parameters’ );” but adding that code does nothing for the buttons. Also, as i have asked earlier, please tell me if there is anyway to donate. The plugin is important to me and long term updates are also important. I want to see it alive also in the distant future :)

        3. I’m curious to know in what form the strict search doesn’t work if you have that info handy.

          Working with themes that have complex builders can be troublesome, I know. I don’t know if your builder has this feature, but with Visual Composer, there is a way to add shortcodes to the builder so that it recognizes them and adds them to the insert menus. Something like that may help in your case.

          On the submit button text, you’re very close. You need to use the “detailed” template, and supply the print_search_submit_buttons method with the text to use for the buttons like this:

          $values = array( 'submit' => 'Search Records', 'clear' => 'Clear the Search Parameters' );
          $this->print_search_submit_buttons($values); ?>

          Thanks for wanting to support the plugin, I appreciate it. If you go to the main Participants Database page, you’ll see it in the right sidebar.

  8. Hi Roland –

    I am the web designer for a non for profit group — not my real job.. i own a campground.. hahaha.
    Anyway, we have set up a members directory using participants database it works very well. thank you for this great plug in.

    We have started a new year, and now have members that are no longer with the group.
    I thought I could use the simple filtering you display above to not delete the old records, but to “hide” them in case the members choose to rejoin.

    I created a field called active. and have two options y or n.
    i was trying to set the parameters to show only n to test it. 2 records have n in the field
    i am doing something wrong with my url argument.

    I am using page builder to call the pdb_list from a button on a members only page
    in the url i have the following code: http://scknittingguild.com/index.php/sckg-directory/

    i have tried putting /list-participants?search_field=active&value=n at the end of that.
    i have changed participants to sckg-directory
    i have changed the url to http://sckknittingguil.com /list-participants?search_field=active&value=n
    both with participants and sckg-directory.

    i am thinking this filtering is applicable.

    am i goofy?
    what am i missing?
    thanks
    tom

    1. It’s important to understand that the base URL you will use is the part that comes before the “?” So, if your list shortcode is on a page reached by the URL http://scknittingguild.com/index.php/sckg-directory/ then the URL for showing all the records with an “active” value of “n” your URL would be http://scknittingguild.com/index.php/sckg-directory/?search_field=active&value=n

      does that help?

      1. Perfect. Thank you from an old fart.

  9. Hello,

    I was looking for a database solution for my website so I found your participants database plugin.
    It’s up and running, and I’m impressed by the possibilities… Excellent job, cograts for that! :-)

    Now am I trying to show a list result like mentioned above but it seems like I’m doing something wrong.
    In your example with the search for “webdesigners”, how can I make a button that will list the result to another page? So when a vistor clicks the button, the result is listed on a new page…

    The button on my website has the URL: http://premium.be/?page_id=5157 where do I have to add the search syntax?

    Thanks for your help!

    1. Good question, I probably should have covered that. If your URL already has a “?” in it, you can add more variables to it by using an ampersand:

      ?page_id=5157&search_field=skills&value=web%20designer

  10. I have a page that allows a visitor to search the Participants Database. On this page is used the suggested code: [pdb_list search=true sort=true display_count=true template=detailed list_limit=10]. This code is great because it shows the search box info at the top and someone can search on any field. I don’t like the fact that going on to this page also shows a list of all database records below the search information. I would like the visitor to be able to enter the search information and then only see the results of that search.

    I have a testing/learning website for this is: http://www.liesoftwaredevelopment.com/WPSite/pieces-of-energy-search-Giver/

    Thank You
    Joy

    http://www.liesoftwaredevelopment.com/WPSite/pieces-of-energy-2/

    1. Hi Joy,

      You can use the “suppress” attribute to prevent anything showing until a search is performed:

      [pdb_list suppress=true]

      1. Hi,

        Thank you for getting back with me. I have another questions, is there a way for me to format the record information that is output? It seems cramped across the screen. I would like to adjust the spacing between the fields.

        http://www.liesoftwaredevelopment.com/WPSite/pieces-of-energy-search/

        Thank You,
        Joy

        1. You’ll need to adjust the CSS to format the layout how you want. The plugin just gives you a standard layout, you’re expected to give it the finishing touches. There is a place to put your CSS rules in the plugin settings under the “custom CSS” tab.

          One thing to try that might get you closer is to use the “bootstrap” template instead of the default template. that might get you closer to the desired result. Either way, you’ll need to tweak the CSS to get your final layout.

      2. Hi Roland,

        I hate to keep bothering you but I am new to WordPress. I am trying to read your documentation on CSS and I am very frustrated because I don’t understand how this works. I find the beginning of an article and can’t figure out how to see the rest of it.

        Example:
        So far, we’ve covered some CSS Syntax, How CSS Rules Work, and How to Create New CSS Rules. In this article, we’ll look at how to add CSS rules to your WordPress site. Making Permanent Changes to the CSS Once you’ve determined how your CSS needs to change to get what you want, you’ll need […]

        What do I need to do to see the rest of the article?

        Thanks,
        Joy

        1. Part 4 of the article is here: https://xnau.com/simple-css-techniques-for-wordpress-part-4/

          I understand how difficult CSS is to get a handle on at first. I tried to make it accessible in the article, but it is a complex subject. I don’t give people direct advice on CSS because it is so particular to the person’s site, it’s better to give them the ability to make their own changes. If you have a specific question about a problem you’re having with the layout I can try to help.

        2. Hi,

          Looking at the results of a search from the Participants Database or the list function, I think it would really help aesthetically if I could get the column titles to be centered on the field. It would also be great if I could add a few spaces between each field.

          The shortcode for the search page is:
          [pdb_list search=true sort=true display_count=true template=detailed list_limit=10]

          What can I add to the line above to achieve this? Or do I need a totally separate shortcode?

          Thank you for your help!
          Joy Graceffo

        3. Hi Joy,

          Making these kinds of adjustments can be done using CSS rules. For instance for your column headers, you could use something like:

          .pdb-list th { text-align: center; }

          That could be added to the custom CSS setting, you may have to make some changes to it to get the effect you’re looking for.

          I don’t exactly know what you mean by adding spaces between each field, but you can try adding some padding to the table cells.

          I’m sorry the plugin doesn’t have settings for things like this, it relies on you using your own CSS rules to make things look the way you want.

Leave a Reply to Roland Barker Cancel reply

Your email address will not be published. Required fields are marked *

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.

104 thoughts on “Creating Links to Show a Filtered List Result

  1. Hi, this sounds like it’s along the lines of what I want to do but I’m not sure I understand it enough. I’m a book blogger creating a database of all my books and I’d like a way to then search my entire collection (I have over 1000 books) for a book that suits what I feel like reading. For example, a book by an Australian author that’s a romance. Ideally I’d like to just select these parameters from say drop down lists and then have all the results that don’t match BOTH of these parameters to hide, therefore only showing my books that match what I feel like reading.
    By sounds of it, what you’ve explained here is creating set customer searches without the ability to dynamically change what you’re searching for. Have I misunderstood? Can this plugin even do what I’m looking for?

    1. Hi Anthea,

      It sounds like what you’re looking for is offered by the Combo Multisearch add-on to Participants Database.

      This tutorial is for the purpose of providing links to records so they can be edited.

      1. That looks great thank you!

      2. Hi Roland,
        This is probably silly but I’ve just spent the last 40 minutes going through all the instructions for the Combo Multisearch add-on and I can’t figure out how to set it up. When I stuffed up I ended up having to go through the history of the page to find the code to get even the basic search back.
        I feel like it took me 2 seconds to find the right search code when I initially installed this. Yet this time, I can’t find any short code that I can just copy and paste in.
        Has the updates made this more difficult? How can I set up the multisearch to feed from the settings I’ve set up?
        Anthea

        1. The multisearch add-on requires that the multisearch template be named in the shortcode, so it should be

          [pdb_list template=multisearch]

          For the standard search, the shortcode is:

          [pdb_list search=true]

          As to configuring the multisearch, the basic configuration you need to do is to tell it which fields to search on. There are two ways to do this, depending on how you want the search to work. If you want to present a single search input that searches on multiple fields, you put the list of fields into the “Combo Search Fields” setting.

          If you want each field to have its own input in the search, use the “Multi Search Fields” setting.

          Let me know if you are still not getting the results you want.

  2. Hi Roland,

    I’m trying to combine search fields in the query using the syntax shown in the examples, but I just get every listing in the database instead. Will take a look and see what I’m doing wrong?

    Here’s an example: http://tinyurl.com/y2yu6mkx

    1. First, I would suggest you put the “approved=yes” into the shortcode as a filter there: you don’t need a dynamic value for that, and it also makes it too easy for someone to see the unapproved records should they want to.

      Second, when testing complex filters such as this, you should turn plugin debugging on (plugin settings, advanced tab), then look at the debugging log after loading the page. That will show you the resulting query and you can easily see why you are getting the results. The syntax of your link looks OK, but what really matters is what value you’re trying to match in the database.

      1. Hi Roland,

        Thank you for your help and quick response. Adding the filter did the trick. I got so stuck on adding more filters to the query that I forgot about the simplest solution. Thanks for the reminder about the plugin debug tool as well. I keep forgetting that’s there.

        Cheers!

    2. Hi Roland, I am having the same difficulty as Kirk described. (Still a noob here)

      I want to publicly display a filtered list based on the Approved field, which I have as a check box (yes or no). I have tried to add the suggested “approved=yes” into the short code, but I obviously have the wrong syntax. I’ve tried a variety of different combinations, but all either display the entire list, with both approved and not approved names, or an error on the site.

      This is what I’ve tried, in various formats:
      [pdb_list search=true?search_field=approved&value=yes]

      The part up to the ? followed by a close bracket was what I had originally for the short code. Can you guide me in the right direction?

      Thanks for your assistance.

      1. I forgot to mention that I want the search function available, if it’s not apparent from the code string.

      2. This article is about creating a URL that will show a filtered list, in other words, it tells you how to create a link to the page that shows your list where the results are filtered by a value in the URL.

        Your question is about a different thing: how to configure the list shortcode so that it does not show unapproved records. So, to answer your question about the shortcode, I suggest you try a shortcode like this:

        [pdb_list filter="approved=yes" search=true]

        The syntax of shortcodes is to put a space between each attribute in the shortcode. The use of the “filter” attribute in the shortcode is explained here: Using List Shortcode Filters

        1. Thank you, thank you!! It works perfectly.

          I miss Kauai and Kapaa is my favorite town there. I hope to come back to visit again some day. Maybe I can see your vanillery.

        2. You know Kauai? Cool! I’m happy to show people around the vanilla operation, I do it about 3 times a month now.

  3. Hi,
    Thank you for your nice plugin.
    I am facing some difficulties with filtering content.
    On my computer in google chrome the filtering works perfectly.
    When I try to use the filter option in internet explorer or mobile chrome or mobile firefox then the filtering does not work. It just shows all the results.
    Could you hel me with this problem?
    Thanks

    1. Are you asking about using the “filter” in the [pdb_list] shortcode…or is it the search form for the list display? Do you have a link I can test?

      1. Roland – I am having the same issue: using the links to show a search criteria doesn’t work on mobile. Do you have any ideas how to fix that?

        Here’s a link to the page (search criteria are linked to the year buttons): https://illinipulse.com/recruit-database-basketball/
        Thanks!

        1. Generally, this is due to how your theme handles delivering content to mobile devices. I can’t be specific, but you’ll need to look into any settings that have to do with showing your site on mobile devices. It looks to me like the theme is caching the page and so it’s not showing the result of the search term in the URL.

        2. Thanks for the reply Roland. My theme uses a separate mobile theme (tagDiv Mobile Theme). I guess I’ll have to disable the buttons on mobile.

  4. https://www.totem-forbes.com/ean/?pdb=2587

    i want to add UPC/EAN Number in URL which should be come from another page thru search. but i am not able to do also i want to redesign pdb_list which should come from URL query string.

    Please help

    1. The technique in this article will allow you to do this, but it is up to you to figure out how to set up the URLs on your site. The plugin can’t do that part for you.

      You have to have a field in your Participants Database that holds the UPC, then you can use a link to the page with the [pdb_list] shortcode that has the UPC number in it. If your UPC field is named ‘upc” and your [pdb_list] is on a page named ‘find-products” you can make a URL like this that will show a specific product:

      /find-products?search_field=upc&value=123456

  5. Hi Roland—I have installed PDB and search.

    All working EXCEPT search field values that contain a space, such as “Los Angeles” in City or “Addiction Medicine” in Specialty 1.

    I found that the space is being converted to %2520.
    Do you have a fix for this? Thanks!

    1. Where are you seeing this code?

      %20 is the correct code for a space, but it’s not something you’d see on the frontend.

      Also: is the search not matching if there is a space?

      1. The space is being converted first to %20, and then %2520. You can go to the site and try it yourself —you’ll see that the search won’t find Los Angeles. Same with values in specialties that contain a space. I researched this—it means the submitted value with a space is going through encoding twice. I can see it in Firebug.

        1. You’re right about the double encoding, it’s just that it’s not doing this on the backend as far as I can see. I figured it was something to do with your browser or WP theme. Can you tell me how you have your search configured and what you’re doing to get this result?

        2. Hmmm-I just used your plugin settings (multisearch). I’m using the Divi theme. The encoding seems to happen first in the web browser (Chrome or Firefox) when the form is submitted. Then it is encoded again when the form information goes into the site server. The search values for the Specialty dropdowns are populated from the values already entered. I’ve seen a couple options for changing the php to deal with the double encoding but they don’t really get at the root of the problem. Thanks for any help you can give me.

        3. Can you share a link so I can see what it’s doing? I don’t see the encoding issue you’re talking about in my tests.

        4. When I select “Addiction Medicine” in the Specialty 1 dropdown, here’s what comes up (you can see that the search value is properly encoded, and then the filter that’s generated contains the double-encoded space) :

          action
          pdb_list_filter
          instance_index
          1
          listpage
          1
          orderstring
          pagelink
          /graduatedirectory/?listpage=%1$s
          postID
          764
          sortstring
          specialty_1
          Integrative%20Medicine
          submit
          search
          subsource
          pdb-multi-searchform
          target_instance
          1
          Source
          postID=764&submit=search&listpage=1&action=pdb_list_filter&target_instance=1&instance_index=1&pagelink
          =%2Fgraduatedirectory%2F%3Flistpage%3D%251%24s&sortstring=&orderstring=&subsource=pdb-multi-searchform
          &specialty_1=Integrative%2520Medicine

        5. I really need to see it to make sense of what you’re asking about. Using the list search doesn’t generate a URL like that, so I’m confused as to the circumstances you’re referring to.

        6. Hmmm—Can you give me more specifics on what link you want to see? Just to give you the full context, this is hosted on GoDaddy, where I installed PDP, added the Combo Multisearch plugin, configured the data fields in PDB, imported a csv file with the participant info, set up the search settings and set the list to be suppressed until a search is performed. The shortcode for this is on the GraduateDirectory page: [pdb_list template=multisearch suppress=true orderby=last_name order=asc]
          The information I just sent is from the Net part of Firebug, which I used to see what’s happening from user’s browser side when a search is performed: 1) value is being submitted from the browser form (and has the %20 encoded representation of a space). 2) Then, it looks like the system generates something to actually do the search of the database field. Somewhere in that process, it appears that a second encoding creates the %2520 (%25 is the encoded expression of a percent sign) which messes up the search value.

        7. Now I understand. I’m looking at your search page, and as far as I can see it’s working as expected. The place to look is in the form Params (in Firefox) where you can see the search term is getting sent correctly.

          Are you using Whole Word Match Only? If you don’t need it, it may be preventing matches in some cases.

        8. Hi Roland—Yes, the search form generally works fine, EXCEPT the search values that contain a space, as I described. I went into File Manager in Cpanel and examined the java files for your search extension and found one (jquery_formsaver.js) that (I think) grabs the submitted form values (which are already encoded as they come from the browser) then encodes them again, so I think this is where the double encoding is happening. I noticed that cpanel will allow me to change to another encoding . Would that help? Or is there a line of code to add that will turn off encoding of the value? Not sure i am thinking about this correctly so any guidance you can offer is much appreciated!

        9. I am releasing an update to Participants Database today that I expect will help with this.

        10. Great, thank you!

        11. Hi Roland—thanks for releasing the new update—still getting 0 result when I submit a search control with a value that contains a space. If I enter Los I get Los Angeles plus Los Altos, Los Gatos, etc. If i enter Angeles I get Los Angeles. If I enter Los Angeles I get nothing. In firebug I see Source:
          postID=764&submit=search&listpage=1&action=pdb_list_filter&target_instance=1&instance_index=1&pagelink
          =%2Fgraduatedirectory%2F%3Flistpage%3D%251%24s&sortstring=&orderstring=&subsource=pdb-multi-searchform
          &city=Los%2520Angeles

          (Note the %2520 value)

        12. Michael,

          I can’t reproduce your result here, so if possible, the next step would be to set up debugging on your site: if you get your php error log set up and enable WP_DEBUG, we can see exactly what is going to the database, the db query gets written to the log.

        13. Michael,

          I just released an update to Combo Multisearch that may fix your issue.

        14. Was about to turn on WP_debug per your suggestion. I’ll try this first. I was thinking the combo-multisearch files could be affecting the search value. Thanks!

        15. Roland—It worked! Thanks so much!

          Michael

  6. Hi Roland,

    links work well if I use only pdb_list shortcode in target page.

    In case I am using pdb_search and pdb_list shortcodes in the same target page (but in different divisions from design point of view) links do not work: the list is not filtered, only search form fields are prefilled with search and value parametrs brought from the link.

    Any ideas, please?

    Roman

    1. Well, first, it’s important to configure the [pdb_search] shortcode so that it targets the correct list. Take a look at the HTML of the list you want to update with the search. At the top, you’ll see something like:

      That means that the instance number of that list is 7. The search shortcode should then be [pdb_search target_instance=7]

      As to the issues with the list itself…I don’t know what that might be. Can you share a link so I can see what it’s doing?

  7. Hello, I have installed this and i am very happy with its functionality. I have read the above comments and found one with almost the same problem as mine. I want to be able to show just the search field on a page, with the list being hidden, and i have managed that with the supress tag (although it still show like a little blank field right below the search field). Well the problem is that i want to enforce exact match search.. like to show the result of a search only if you input the exact value of that element. For example: you are searching for a certificate. And i want the plugin to show details of that certificate only if you input the exact certificate number, not more of it, not less. How can i do that? thanks a bunch.

    1. Try the “Strict User Searching” setting under the advanced tab of the plugin settings.

      1. Hello, thanks for your reply, i already did that. It was checked but for some reason doesn’t work? the tag i am using that page is [pdb_list suppress=true search=true search_fields=city sort=false display_count=true template=detailed list_limit=2]. And if ty searching for a word starting with H for example, it will show all the entries that start with that letter.
        If i try using the [pdb_search] tag instead, when i press the search button, it redirects me to the same page but with a /#participants-list-1 at the end of the link, but no search results.
        I don’t think i am using the plugin right? For what i want to get out of this (hiding the list and searching for 1 specific item on the list but with the exact match word) what do i need to do ? create a new page and just add the shortcode there? or is the something else i am not aware of? Thank you for your help. Is there any way to donate?

        1. That should work. I just checked it. With “strict user searches” on, if I type in a single letter, I get zero results because there isn’t a record with only the one letter as the value.

          What kind of field is it you’re searching on?

          You’ve got the shortcode right, you don’t need the pdb_search shortcode unless you want the search control in a different location from the list of results. It’s takes a bit of setup to get that working.

        2. Hey, thanks again for your reply. Indeed it works, but only in this form: [pdb_list suppress=true search=true search_fields=cod_certificat sort=false]. Maybe it`s something do to with my theme, i don’t know. I use the ark theme if you know it and it uses a modular builder for pages. If i try to use the shortcode inside that builder it goes berserk :) I have to do more testing with it. I will be back with more feedback of this matter. Ah 1 more important thing: how can i change the button text for the search button and the clear button, and also the “Search: ” text above the search field? I found something about this in /wp-content/plugins/participants-database/templates/pdb-list-detailed.php “$values = array( ‘submit’ => ‘Search Records’, ‘clear’ => ‘Clear the Search Parameters’ );” but adding that code does nothing for the buttons. Also, as i have asked earlier, please tell me if there is anyway to donate. The plugin is important to me and long term updates are also important. I want to see it alive also in the distant future :)

        3. I’m curious to know in what form the strict search doesn’t work if you have that info handy.

          Working with themes that have complex builders can be troublesome, I know. I don’t know if your builder has this feature, but with Visual Composer, there is a way to add shortcodes to the builder so that it recognizes them and adds them to the insert menus. Something like that may help in your case.

          On the submit button text, you’re very close. You need to use the “detailed” template, and supply the print_search_submit_buttons method with the text to use for the buttons like this:

          $values = array( 'submit' => 'Search Records', 'clear' => 'Clear the Search Parameters' );
          $this->print_search_submit_buttons($values); ?>

          Thanks for wanting to support the plugin, I appreciate it. If you go to the main Participants Database page, you’ll see it in the right sidebar.

  8. Hi Roland –

    I am the web designer for a non for profit group — not my real job.. i own a campground.. hahaha.
    Anyway, we have set up a members directory using participants database it works very well. thank you for this great plug in.

    We have started a new year, and now have members that are no longer with the group.
    I thought I could use the simple filtering you display above to not delete the old records, but to “hide” them in case the members choose to rejoin.

    I created a field called active. and have two options y or n.
    i was trying to set the parameters to show only n to test it. 2 records have n in the field
    i am doing something wrong with my url argument.

    I am using page builder to call the pdb_list from a button on a members only page
    in the url i have the following code: http://scknittingguild.com/index.php/sckg-directory/

    i have tried putting /list-participants?search_field=active&value=n at the end of that.
    i have changed participants to sckg-directory
    i have changed the url to http://sckknittingguil.com /list-participants?search_field=active&value=n
    both with participants and sckg-directory.

    i am thinking this filtering is applicable.

    am i goofy?
    what am i missing?
    thanks
    tom

    1. It’s important to understand that the base URL you will use is the part that comes before the “?” So, if your list shortcode is on a page reached by the URL http://scknittingguild.com/index.php/sckg-directory/ then the URL for showing all the records with an “active” value of “n” your URL would be http://scknittingguild.com/index.php/sckg-directory/?search_field=active&value=n

      does that help?

      1. Perfect. Thank you from an old fart.

  9. Hello,

    I was looking for a database solution for my website so I found your participants database plugin.
    It’s up and running, and I’m impressed by the possibilities… Excellent job, cograts for that! :-)

    Now am I trying to show a list result like mentioned above but it seems like I’m doing something wrong.
    In your example with the search for “webdesigners”, how can I make a button that will list the result to another page? So when a vistor clicks the button, the result is listed on a new page…

    The button on my website has the URL: http://premium.be/?page_id=5157 where do I have to add the search syntax?

    Thanks for your help!

    1. Good question, I probably should have covered that. If your URL already has a “?” in it, you can add more variables to it by using an ampersand:

      ?page_id=5157&search_field=skills&value=web%20designer

  10. I have a page that allows a visitor to search the Participants Database. On this page is used the suggested code: [pdb_list search=true sort=true display_count=true template=detailed list_limit=10]. This code is great because it shows the search box info at the top and someone can search on any field. I don’t like the fact that going on to this page also shows a list of all database records below the search information. I would like the visitor to be able to enter the search information and then only see the results of that search.

    I have a testing/learning website for this is: http://www.liesoftwaredevelopment.com/WPSite/pieces-of-energy-search-Giver/

    Thank You
    Joy

    http://www.liesoftwaredevelopment.com/WPSite/pieces-of-energy-2/

    1. Hi Joy,

      You can use the “suppress” attribute to prevent anything showing until a search is performed:

      [pdb_list suppress=true]

      1. Hi,

        Thank you for getting back with me. I have another questions, is there a way for me to format the record information that is output? It seems cramped across the screen. I would like to adjust the spacing between the fields.

        http://www.liesoftwaredevelopment.com/WPSite/pieces-of-energy-search/

        Thank You,
        Joy

        1. You’ll need to adjust the CSS to format the layout how you want. The plugin just gives you a standard layout, you’re expected to give it the finishing touches. There is a place to put your CSS rules in the plugin settings under the “custom CSS” tab.

          One thing to try that might get you closer is to use the “bootstrap” template instead of the default template. that might get you closer to the desired result. Either way, you’ll need to tweak the CSS to get your final layout.

      2. Hi Roland,

        I hate to keep bothering you but I am new to WordPress. I am trying to read your documentation on CSS and I am very frustrated because I don’t understand how this works. I find the beginning of an article and can’t figure out how to see the rest of it.

        Example:
        So far, we’ve covered some CSS Syntax, How CSS Rules Work, and How to Create New CSS Rules. In this article, we’ll look at how to add CSS rules to your WordPress site. Making Permanent Changes to the CSS Once you’ve determined how your CSS needs to change to get what you want, you’ll need […]

        What do I need to do to see the rest of the article?

        Thanks,
        Joy

        1. Part 4 of the article is here: https://xnau.com/simple-css-techniques-for-wordpress-part-4/

          I understand how difficult CSS is to get a handle on at first. I tried to make it accessible in the article, but it is a complex subject. I don’t give people direct advice on CSS because it is so particular to the person’s site, it’s better to give them the ability to make their own changes. If you have a specific question about a problem you’re having with the layout I can try to help.

        2. Hi,

          Looking at the results of a search from the Participants Database or the list function, I think it would really help aesthetically if I could get the column titles to be centered on the field. It would also be great if I could add a few spaces between each field.

          The shortcode for the search page is:
          [pdb_list search=true sort=true display_count=true template=detailed list_limit=10]

          What can I add to the line above to achieve this? Or do I need a totally separate shortcode?

          Thank you for your help!
          Joy Graceffo

        3. Hi Joy,

          Making these kinds of adjustments can be done using CSS rules. For instance for your column headers, you could use something like:

          .pdb-list th { text-align: center; }

          That could be added to the custom CSS setting, you may have to make some changes to it to get the effect you’re looking for.

          I don’t exactly know what you mean by adding spaces between each field, but you can try adding some padding to the table cells.

          I’m sorry the plugin doesn’t have settings for things like this, it relies on you using your own CSS rules to make things look the way you want.

Leave a Reply to Roland Barker Cancel reply

Your email address will not be published. Required fields are marked *

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.