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[]=al

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.

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 Roland, could you please let me know what I have done wrong? The list doesn’t seem to accept my parameters and always display all results. Thank you!

    https://looklookseesee.com/search-result/?search_field=country&value=Egypt

    1. The URL looks good, there are several things you can check to understand the results you’re getting. Check to make sure you don’t have page caching active on that page.

      I added a section to the article that offers some help with this: Troubleshooting

      1. Thank you for the tips! I think I’ve figured out the issue but don’t know how to fix it.

        It seems like the PDb_search in the header always makes another query after the URL query causing the PDb_list to display everything. The URL query works when I disable PDb_search in the header.

        Is there any way to keep both working on the same page? Thanks!

        (wanted to post log but it got blocked)

        1. Are you using two shortcodes? You should only use the [pdb_list] shortcode.

        2. yeah, I’m trying to create a site-wide header that has [pdb_search] so users can quickly do a search anywhere. And then on the [pdb_list] page, I’d like to show more detailed search options in the body.

          Is that use case not possible?

          Thanks!

        3. You either have to prevent the search shortcode in the header on the page that shows the results, or not use the search result URL. The search result URL won’t work if you have a separate search shortcode on the same page as you are showing the results, as you have seen.

        4. Thank you for the confirmation. We have made the adjustment accordingly.

  2. Hi Roland. Thank you for your amazing work on this plugin.
    I also have the pagination problem, it is not taking into account the ?search_field.
    You can check for example : https://www.thibault-barrat.com/florain-recette/ou-les-depenser/?search_field=sous_categorie&value=Producteurs

    Thanks

    1. This problem indicates that the plugin is unable to use php sessions on your server. You’ll notice that pagination doesn’t work correctly with a list search either.

      First, you must use the latest version of Participants Database. If you needed to update and updating doesn’t solve the problem, try checking the “Use Alternate Session Method” setting. This is in the Participants Database settings under the Advanced tab.

      1. Thank you for your answer but I still have the problem.
        Curently, the plugin is up to date and the Alternate Method is enabled.
        Do you have any other idea to try ?

        1. I took a look at your page, and I don’t know if this is causing the problem, but you have font tags inside of your option values and this is not allowed. For example, I’m seeing:

          <option value="titre"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Title</font></font></option>

          This is not valid HTML, it should look like this:

          <option value="titre">Title</option>

          If you need to apply a CSS style to the value, you need to do that with a CSS rule, for example:

          .search-term option { vertical-align: inherit; }

        2. However, I do see the problem: you do not have the “sous_categorie” field in your field selector, so when clicking to the next page, it is using the default field “titre” instead. If you want to use a link to filter by the “sous_categorie” field, you need to add it to the field selector using the “search_fields” attribute…for example:

          [pdb_list search=true search_fields="titre,addresse,description_courte,description_longue,sous_categorie"]

        3. Hi Roland,

          Where did you find these font tags ? I didn’t see where it is on my page. Anyway, I dont’t think that this cause the problem.

          I added. the sous_categorie field in the search_fields of my shortcode.
          Now, you can see that if you use the search field on the page with for example “Producteurs” for the field sous_categorie, it works fine. But, if you use the direct link with “?search_field=sous_categorie&value=Producteurs”, the pagination is still not working.

          So I think it is not due to php sessions, right ? I tried to enabled and disabled the alternate method but still the same.

        4. I might be sessions, it might be caching. What I am seeing is that the pagination submits the correct data to the server (now that the search form has the matching field in it) but the server is still returning the wrong response.

          We should see the debugging log to know more about what is happening. It should be cleared, then try the pagination and check the debugging log to see what query is generated.

        5. I am currently investigating this problem, there may be a bug to fix here.

        6. Here is the debug log :

          [06/29/21 7:50am UTC]
          PDb_List::_setup_iteration list query: SELECT p.id, p.image, p.titre, p.sous_categorie, p.description_courte, p.description_longue, p.adresse, p.code_postal, p.ville, p.telephone, p.site_web, p.message_comptoir FROM fr_participants_database p WHERE p.inactif “true” AND (p.sous_categorie LIKE “%Producteurs%”) ORDER BY p.sous_categorie DESC
          [06/29/21 7:50am UTC]
          PDb_List::_setup_iteration list query: SELECT p.id, p.image, p.titre, p.sous_categorie, p.description_courte, p.description_longue, p.adresse, p.code_postal, p.ville, p.telephone, p.site_web, p.message_comptoir FROM fr_participants_database p WHERE p.inactif “true” ORDER BY p.sous_categorie DESC

          It seems that when I click on the pagination there is not “AND (p.sous_categorie LIKE “%Producteurs%”) ” in the query

        7. I released an update to Participants Database that should fix your issue.

        8. Hi Roland,

          The problem is solved with your last update.
          Thank you for your work !!

        9. Thanks for letting me know, happy to hear it.

  3. Hi Roland. I just installed and set-up Participant Database. It looks very promising for my application. I found your tip page on sorting which showed this:

    https://xnau.com/work/wordpress-plugins/participants-database/list-participants/

    When I created a short code to sort my list, it is functional but the appearance of the sort controls are significantly different. My results can be viewed here:

    http://crhrc.org/test-page/

    I’m using WordPress 5.7.1 with the 2021 theme. I’m assuming my theme is causing the difference. Any tips for me on how to improve the presentation of the controls?

    1. Hi Bill,

      You will need to use some CSS rules to get this looking the way you want. The plugin provides a space for you to add your rules in the settings under the “Custom CSS” tab.

      It’s not really in the scope of free support for me to go in and make a detailed analysis of the situation with specific advice, but I’d suggest you start by limiting the width of the input, which you can do by simply setting its width, or perhaps even setting the “display” attribute to something like “inline-block.” After that you can address the layout of the radio buttons, which look like they are set to “display:block” and probably should be set to “display:inline.”

      Ultimately, you will have limited success without a working knowledge of CSS and how to apply it. I have provided an article that will give you some tools to use and some techniques that can get you started:

      Simple CSS Techniques for WordPress

      1. Thank you for the prompt reply and pointing me to the CSS. I understand CSS is out of the scope support for your plug-in and really appreciate you providing a reference for getting me started.

        Thanks for your professional attitude. Don’t forget to check the tip jar :)

  4. I have the exact same issue! I tried turning off AJAX thingy, tried turning on alternative session method, use pagination scroll anchors, nothing works. The pagination links at the bottom simply don’t contain the passed search_field and value parameters. In the upper-right menu are the links to filtered pages.

    1. Can you provide a link to see the problem on your site?

      1. I did and am trying but every time your site tells me my comment looks like spam? (Nice feature btw)
        kamp.byethost10.com

        1. I’m sorry about the spam blocker, I need to dial that back. I suggest you turn the AJAX back on. If that is not working, you may have a problem with an accelerator plugin that is not adding the javascript properly. Also make sure you do not have page caching on. I’ll check it again after you have the AJAX back on.

  5. Hi Roland,

    Is it possible to construct a search-link searching for two or three values within one field?

    Example (using your demo link) searching for both “Huntsville” and “Amsterdam” within the field “city”

    ?search_field[]=city&value[]=Huntsville , Amsterdam&search_field[]=state&value[]=al
    (I use the , comma between the two values, this does not work)

    Thanks!

    Regards,
    Michel Cornelis

    1. Yes, this is possible. This is explained in the article under “Using Filter Links with Multi-Search” you add multiple variables with the same name that includes the brackets, each one of those variables is added to the array. You must also add one field_name[] variable for each value[] variable. Check out the example in the article.

      1. Thanks Roland,
        Obviously I’m doing something wrong, but I do not know what I’m doing wrong

        ?search_field[]=gedichten&value[]=gedichten%20schrijven&search_field[]=gedichten&value[]=beeldgedichten&sortBy=stad_of_gemeente&ascdesc=asc gives met only the values for gedichten>gedichten%20schrijven. The second search in field “gedichten” (gedichten>beeldgedichten) does not give any results.

        When I turn the two values for field “gedichten” around :
        ?search_field[]=gedichten&value[]=beeldgedichten &search_field[]=gedichten&value[]=gedichten%20schrijven&sortBy=stad_of_gemeente&ascdesc=asc

        it shows only the results for gedichten>beeldgedichten, the results for gedichten>gedichten%20schrijven. is not shown. The searchlink only looks to the first field>value combination. What am I doing wrong?

        Thanks,
        Regards,
        Michel Cornelis

        1. To interpret the results, I suggest you turn plugin debugging on (plugin settings under the advanced tab) then clear the debugging log (plugin admin menu) then try your search. The query that was used will be in the debugging log, and that will explain the results.

      2. As you suggested I turned debugging on and it looks like there might be a bug in the plugin. See the results here:
        Searchlink structure: ?search_field[]=field1&value[]=value1&search_field[]=field2&value[]=value2

        1)
        Field1 = gedichten, Value1 = limerick
        Field2 = verhalen, Value2 = kinderverhalen
        Result from debugging:
        [03/15/21 7:33pm UTC]PDb_List::_setup_iteration list query: SELECT p.id, p.voornaam, p.achternaam, p.stad_of_gemeente, p.beroep, p.activiteit_1, p.activiteit_2, p.persoonlijke_foto, p.meer_informatie FROM fzj_participants_database p WHERE (p.gedichten LIKE ‘%”limerick”%’ OR p.verhalen LIKE ‘%”kinderverhalen”%’) ORDER BY p.date_updated DESC
        2 different fields, works fine, no problem.

        <>

        1. Roland,

          I just checked, I am using version 1.4.1 of the directory tools.

        2. OK, I will release another update right away, looks like this change didn’t make it in.

      3. Continuation from previous comment

        2)
        Field1 = gedichten, Value1 = limerick
        Field2 = gedichten, Value2 = beeldgedichten
        Result from debugging:
        [03/15/21 7:39pm UTC]PDb_List::_setup_iteration list query: SELECT p.id, p.voornaam, p.achternaam, p.stad_of_gemeente, p.beroep, p.activiteit_1, p.activiteit_2, p.persoonlijke_foto, p.meer_informatie FROM fzj_participants_database p WHERE (p.gedichten LIKE ‘%”beeldgedichten”%’) ORDER BY p.date_updated DESC
        Twice the same field, first field-value combination is not present.

        3)
        Field1 = gedichten, Value1 = beeldgedichten
        Field2 = gedichten, Value2 = limerick
        This is the same as in 2) but the two values are turned around
        Result from debugging:
        [03/15/21 7:46pm UTC]PDb_List::_setup_iteration list query: SELECT p.id, p.voornaam, p.achternaam, p.stad_of_gemeente, p.beroep, p.activiteit_1, p.activiteit_2, p.persoonlijke_foto, p.meer_informatie FROM fzj_participants_database p WHERE (p.gedichten LIKE ‘%”limerick”%’) ORDER BY p.date_updated DESC
        Twice the same field, first field-value combination is not present again. This missing combination was present in example 2) being the last of the two.

        Please advise how to proceed, Thanks

        1. Yes, you cannot use this technique to add two terms to the same field, it does have its limits.

        2. I do plan to make it possible to add multiple terms to the same field in the next update.

        3. Hi Roland,

          Thanks again.. you said you make it possible to add multiple terms to the same field in the next update.. I assume you mean an update of the multiple search add on.
          The latest update of this add on does not give us that possibility. Is it still in your plans? Or do I need to start the development of a workaround?
          The latter means quite a lot of work since I have to duplicate or even triplicate a number of records in the database and to keep those in sync all the time.

        4. The update that adds this feature has not been released yet, it is a major update to Participants Database (not Combo Multisearch) and it’s in beta now, I plan to release it in about a week.

        5. Many many thanks Roland, you make me a happy guy.

        6. Hi Roland,

          Thanks for the major update to version 1.9.7. I’m sorry to have to tell you that I’m getting a fatal error after the update:

          Warning: require_once(/home/customer/www/ikwilschrijven.nl/public_html/wp-content/plugins/participants-database//vendor/wp-background-process/wp-async-request.php): failed to open stream: No such file or directory in /home/customer/www/ikwilschrijven.nl/public_html/wp-content/plugins/pdb-directory-tools/pdbdt/Plugin.php on line 250

          Fatal error: require_once(): Failed opening required ‘/home/customer/www/ikwilschrijven.nl/public_html/wp-content/plugins/participants-database//vendor/wp-background-process/wp-async-request.php’ (include_path=’.:/usr/local/php73/pear’) in /home/customer/www/ikwilschrijven.nl/public_html/wp-content/plugins/pdb-directory-tools/pdbdt/Plugin.php on line 250

          A temporarily de-activation of the directory plugin did not solve this.

          Please advise how to proceed.

          Thanks & regards,

          Michel Cornelis

        7. I’m sorry about that, Michael, not sure why this hasn’t shown up in my tests, but I will have to release an update to the Directory Tools plugin that is compatible with Participants Database 1.9.7. I’ll attempt to get that out tomorrow.

        8. Michael,

          As I look closer at this, I wonder if you’re using the latest version of Directory tools, version 1.4.1 should be compatible with Participants Database 1.9.7

          You should upgrade if you’re not using the latest version.

        9. Roland,

          the update problem is solved now. version 1.9.7. works fine.

          The search-link problem with multiple values within one field is also solved. I tried a searchlink with three values within one field and it works perfectly.

          THANKS!!!

          Regards,

          Michel Cornelis

  6. Hi Roland, the paging (1, 2, 3 …) on the search results somehow doesn’t carry over the ?search_field and other variables and only have the ?listpage and instance so all the subsequent pages would show the whole list. I must have missed something.

    Thanks for your help.

    1. This normally works, so maybe your sessions are not working. Do you have a link so I can see it?

Leave a Reply to Roland Barker Cancel reply
You have to agree to the comment policy.

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 Roland, could you please let me know what I have done wrong? The list doesn’t seem to accept my parameters and always display all results. Thank you!

    https://looklookseesee.com/search-result/?search_field=country&value=Egypt

    1. The URL looks good, there are several things you can check to understand the results you’re getting. Check to make sure you don’t have page caching active on that page.

      I added a section to the article that offers some help with this: Troubleshooting

      1. Thank you for the tips! I think I’ve figured out the issue but don’t know how to fix it.

        It seems like the PDb_search in the header always makes another query after the URL query causing the PDb_list to display everything. The URL query works when I disable PDb_search in the header.

        Is there any way to keep both working on the same page? Thanks!

        (wanted to post log but it got blocked)

        1. Are you using two shortcodes? You should only use the [pdb_list] shortcode.

        2. yeah, I’m trying to create a site-wide header that has [pdb_search] so users can quickly do a search anywhere. And then on the [pdb_list] page, I’d like to show more detailed search options in the body.

          Is that use case not possible?

          Thanks!

        3. You either have to prevent the search shortcode in the header on the page that shows the results, or not use the search result URL. The search result URL won’t work if you have a separate search shortcode on the same page as you are showing the results, as you have seen.

        4. Thank you for the confirmation. We have made the adjustment accordingly.

  2. Hi Roland. Thank you for your amazing work on this plugin.
    I also have the pagination problem, it is not taking into account the ?search_field.
    You can check for example : https://www.thibault-barrat.com/florain-recette/ou-les-depenser/?search_field=sous_categorie&value=Producteurs

    Thanks

    1. This problem indicates that the plugin is unable to use php sessions on your server. You’ll notice that pagination doesn’t work correctly with a list search either.

      First, you must use the latest version of Participants Database. If you needed to update and updating doesn’t solve the problem, try checking the “Use Alternate Session Method” setting. This is in the Participants Database settings under the Advanced tab.

      1. Thank you for your answer but I still have the problem.
        Curently, the plugin is up to date and the Alternate Method is enabled.
        Do you have any other idea to try ?

        1. I took a look at your page, and I don’t know if this is causing the problem, but you have font tags inside of your option values and this is not allowed. For example, I’m seeing:

          <option value="titre"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Title</font></font></option>

          This is not valid HTML, it should look like this:

          <option value="titre">Title</option>

          If you need to apply a CSS style to the value, you need to do that with a CSS rule, for example:

          .search-term option { vertical-align: inherit; }

        2. However, I do see the problem: you do not have the “sous_categorie” field in your field selector, so when clicking to the next page, it is using the default field “titre” instead. If you want to use a link to filter by the “sous_categorie” field, you need to add it to the field selector using the “search_fields” attribute…for example:

          [pdb_list search=true search_fields="titre,addresse,description_courte,description_longue,sous_categorie"]

        3. Hi Roland,

          Where did you find these font tags ? I didn’t see where it is on my page. Anyway, I dont’t think that this cause the problem.

          I added. the sous_categorie field in the search_fields of my shortcode.
          Now, you can see that if you use the search field on the page with for example “Producteurs” for the field sous_categorie, it works fine. But, if you use the direct link with “?search_field=sous_categorie&value=Producteurs”, the pagination is still not working.

          So I think it is not due to php sessions, right ? I tried to enabled and disabled the alternate method but still the same.

        4. I might be sessions, it might be caching. What I am seeing is that the pagination submits the correct data to the server (now that the search form has the matching field in it) but the server is still returning the wrong response.

          We should see the debugging log to know more about what is happening. It should be cleared, then try the pagination and check the debugging log to see what query is generated.

        5. I am currently investigating this problem, there may be a bug to fix here.

        6. Here is the debug log :

          [06/29/21 7:50am UTC]
          PDb_List::_setup_iteration list query: SELECT p.id, p.image, p.titre, p.sous_categorie, p.description_courte, p.description_longue, p.adresse, p.code_postal, p.ville, p.telephone, p.site_web, p.message_comptoir FROM fr_participants_database p WHERE p.inactif “true” AND (p.sous_categorie LIKE “%Producteurs%”) ORDER BY p.sous_categorie DESC
          [06/29/21 7:50am UTC]
          PDb_List::_setup_iteration list query: SELECT p.id, p.image, p.titre, p.sous_categorie, p.description_courte, p.description_longue, p.adresse, p.code_postal, p.ville, p.telephone, p.site_web, p.message_comptoir FROM fr_participants_database p WHERE p.inactif “true” ORDER BY p.sous_categorie DESC

          It seems that when I click on the pagination there is not “AND (p.sous_categorie LIKE “%Producteurs%”) ” in the query

        7. I released an update to Participants Database that should fix your issue.

        8. Hi Roland,

          The problem is solved with your last update.
          Thank you for your work !!

        9. Thanks for letting me know, happy to hear it.

  3. Hi Roland. I just installed and set-up Participant Database. It looks very promising for my application. I found your tip page on sorting which showed this:

    https://xnau.com/work/wordpress-plugins/participants-database/list-participants/

    When I created a short code to sort my list, it is functional but the appearance of the sort controls are significantly different. My results can be viewed here:

    http://crhrc.org/test-page/

    I’m using WordPress 5.7.1 with the 2021 theme. I’m assuming my theme is causing the difference. Any tips for me on how to improve the presentation of the controls?

    1. Hi Bill,

      You will need to use some CSS rules to get this looking the way you want. The plugin provides a space for you to add your rules in the settings under the “Custom CSS” tab.

      It’s not really in the scope of free support for me to go in and make a detailed analysis of the situation with specific advice, but I’d suggest you start by limiting the width of the input, which you can do by simply setting its width, or perhaps even setting the “display” attribute to something like “inline-block.” After that you can address the layout of the radio buttons, which look like they are set to “display:block” and probably should be set to “display:inline.”

      Ultimately, you will have limited success without a working knowledge of CSS and how to apply it. I have provided an article that will give you some tools to use and some techniques that can get you started:

      Simple CSS Techniques for WordPress

      1. Thank you for the prompt reply and pointing me to the CSS. I understand CSS is out of the scope support for your plug-in and really appreciate you providing a reference for getting me started.

        Thanks for your professional attitude. Don’t forget to check the tip jar :)

  4. I have the exact same issue! I tried turning off AJAX thingy, tried turning on alternative session method, use pagination scroll anchors, nothing works. The pagination links at the bottom simply don’t contain the passed search_field and value parameters. In the upper-right menu are the links to filtered pages.

    1. Can you provide a link to see the problem on your site?

      1. I did and am trying but every time your site tells me my comment looks like spam? (Nice feature btw)
        kamp.byethost10.com

        1. I’m sorry about the spam blocker, I need to dial that back. I suggest you turn the AJAX back on. If that is not working, you may have a problem with an accelerator plugin that is not adding the javascript properly. Also make sure you do not have page caching on. I’ll check it again after you have the AJAX back on.

  5. Hi Roland,

    Is it possible to construct a search-link searching for two or three values within one field?

    Example (using your demo link) searching for both “Huntsville” and “Amsterdam” within the field “city”

    ?search_field[]=city&value[]=Huntsville , Amsterdam&search_field[]=state&value[]=al
    (I use the , comma between the two values, this does not work)

    Thanks!

    Regards,
    Michel Cornelis

    1. Yes, this is possible. This is explained in the article under “Using Filter Links with Multi-Search” you add multiple variables with the same name that includes the brackets, each one of those variables is added to the array. You must also add one field_name[] variable for each value[] variable. Check out the example in the article.

      1. Thanks Roland,
        Obviously I’m doing something wrong, but I do not know what I’m doing wrong

        ?search_field[]=gedichten&value[]=gedichten%20schrijven&search_field[]=gedichten&value[]=beeldgedichten&sortBy=stad_of_gemeente&ascdesc=asc gives met only the values for gedichten>gedichten%20schrijven. The second search in field “gedichten” (gedichten>beeldgedichten) does not give any results.

        When I turn the two values for field “gedichten” around :
        ?search_field[]=gedichten&value[]=beeldgedichten &search_field[]=gedichten&value[]=gedichten%20schrijven&sortBy=stad_of_gemeente&ascdesc=asc

        it shows only the results for gedichten>beeldgedichten, the results for gedichten>gedichten%20schrijven. is not shown. The searchlink only looks to the first field>value combination. What am I doing wrong?

        Thanks,
        Regards,
        Michel Cornelis

        1. To interpret the results, I suggest you turn plugin debugging on (plugin settings under the advanced tab) then clear the debugging log (plugin admin menu) then try your search. The query that was used will be in the debugging log, and that will explain the results.

      2. As you suggested I turned debugging on and it looks like there might be a bug in the plugin. See the results here:
        Searchlink structure: ?search_field[]=field1&value[]=value1&search_field[]=field2&value[]=value2

        1)
        Field1 = gedichten, Value1 = limerick
        Field2 = verhalen, Value2 = kinderverhalen
        Result from debugging:
        [03/15/21 7:33pm UTC]PDb_List::_setup_iteration list query: SELECT p.id, p.voornaam, p.achternaam, p.stad_of_gemeente, p.beroep, p.activiteit_1, p.activiteit_2, p.persoonlijke_foto, p.meer_informatie FROM fzj_participants_database p WHERE (p.gedichten LIKE ‘%”limerick”%’ OR p.verhalen LIKE ‘%”kinderverhalen”%’) ORDER BY p.date_updated DESC
        2 different fields, works fine, no problem.

        <>

        1. Roland,

          I just checked, I am using version 1.4.1 of the directory tools.

        2. OK, I will release another update right away, looks like this change didn’t make it in.

      3. Continuation from previous comment

        2)
        Field1 = gedichten, Value1 = limerick
        Field2 = gedichten, Value2 = beeldgedichten
        Result from debugging:
        [03/15/21 7:39pm UTC]PDb_List::_setup_iteration list query: SELECT p.id, p.voornaam, p.achternaam, p.stad_of_gemeente, p.beroep, p.activiteit_1, p.activiteit_2, p.persoonlijke_foto, p.meer_informatie FROM fzj_participants_database p WHERE (p.gedichten LIKE ‘%”beeldgedichten”%’) ORDER BY p.date_updated DESC
        Twice the same field, first field-value combination is not present.

        3)
        Field1 = gedichten, Value1 = beeldgedichten
        Field2 = gedichten, Value2 = limerick
        This is the same as in 2) but the two values are turned around
        Result from debugging:
        [03/15/21 7:46pm UTC]PDb_List::_setup_iteration list query: SELECT p.id, p.voornaam, p.achternaam, p.stad_of_gemeente, p.beroep, p.activiteit_1, p.activiteit_2, p.persoonlijke_foto, p.meer_informatie FROM fzj_participants_database p WHERE (p.gedichten LIKE ‘%”limerick”%’) ORDER BY p.date_updated DESC
        Twice the same field, first field-value combination is not present again. This missing combination was present in example 2) being the last of the two.

        Please advise how to proceed, Thanks

        1. Yes, you cannot use this technique to add two terms to the same field, it does have its limits.

        2. I do plan to make it possible to add multiple terms to the same field in the next update.

        3. Hi Roland,

          Thanks again.. you said you make it possible to add multiple terms to the same field in the next update.. I assume you mean an update of the multiple search add on.
          The latest update of this add on does not give us that possibility. Is it still in your plans? Or do I need to start the development of a workaround?
          The latter means quite a lot of work since I have to duplicate or even triplicate a number of records in the database and to keep those in sync all the time.

        4. The update that adds this feature has not been released yet, it is a major update to Participants Database (not Combo Multisearch) and it’s in beta now, I plan to release it in about a week.

        5. Many many thanks Roland, you make me a happy guy.

        6. Hi Roland,

          Thanks for the major update to version 1.9.7. I’m sorry to have to tell you that I’m getting a fatal error after the update:

          Warning: require_once(/home/customer/www/ikwilschrijven.nl/public_html/wp-content/plugins/participants-database//vendor/wp-background-process/wp-async-request.php): failed to open stream: No such file or directory in /home/customer/www/ikwilschrijven.nl/public_html/wp-content/plugins/pdb-directory-tools/pdbdt/Plugin.php on line 250

          Fatal error: require_once(): Failed opening required ‘/home/customer/www/ikwilschrijven.nl/public_html/wp-content/plugins/participants-database//vendor/wp-background-process/wp-async-request.php’ (include_path=’.:/usr/local/php73/pear’) in /home/customer/www/ikwilschrijven.nl/public_html/wp-content/plugins/pdb-directory-tools/pdbdt/Plugin.php on line 250

          A temporarily de-activation of the directory plugin did not solve this.

          Please advise how to proceed.

          Thanks & regards,

          Michel Cornelis

        7. I’m sorry about that, Michael, not sure why this hasn’t shown up in my tests, but I will have to release an update to the Directory Tools plugin that is compatible with Participants Database 1.9.7. I’ll attempt to get that out tomorrow.

        8. Michael,

          As I look closer at this, I wonder if you’re using the latest version of Directory tools, version 1.4.1 should be compatible with Participants Database 1.9.7

          You should upgrade if you’re not using the latest version.

        9. Roland,

          the update problem is solved now. version 1.9.7. works fine.

          The search-link problem with multiple values within one field is also solved. I tried a searchlink with three values within one field and it works perfectly.

          THANKS!!!

          Regards,

          Michel Cornelis

  6. Hi Roland, the paging (1, 2, 3 …) on the search results somehow doesn’t carry over the ?search_field and other variables and only have the ?listpage and instance so all the subsequent pages would show the whole list. I must have missed something.

    Thanks for your help.

    1. This normally works, so maybe your sessions are not working. Do you have a link so I can see it?

Leave a Reply to Roland Barker Cancel reply
You have to agree to the comment policy.

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