WordPress.org

Ready to get started?Download WordPress

Forums

Participants Database
User search with logic operators (4 posts)

  1. graccurris
    Member
    Posted 1 year ago #

    Hi,

    Thank you for this great plugin. For showing the list in the Front End, I am using the following shortcode:

    [pdb_list search=true sort=true display_count=true template=detailed list_limit=10]

    When the user searches "blue", all occurrencies of blue will be filtered. However, how could I make that the user searches "blue" AND; OR; AND/OR "seven" for "colour" and "number" fields? This type of searching is in the Back End, but not in the Front End.

    Thanks.

    http://wordpress.org/extend/plugins/participants-database/

  2. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    The frontend search I provide is pretty bare-bones. If you want something more complex, you have to code your own search function. I can supply you with some details of you're ready to do that.

  3. graccurris
    Member
    Posted 1 year ago #

    Thanks for the answer. I would be happy to do it myself if you could help me.

    Thanks!

  4. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    OK, well the basic idea is that you can put the shortcode into a template using the "do_shortcode" function. That will allow you to build your filter statement using supplied variables. First, create a form that uses your search logic. This form will submit to the page where the shortcode is. When the shortcode is displayed, it uses the submitted values to build the filter statement....for instance if you wanted to look for a name in either of two states:

    <?php echo do_shortcode('[pdb_list filter="last_name=' . $_POST['last_name'] . '&state=' . $_POST['state1'] . '|state=' . $_POST['state2'] . '"]') ?>

    There's other ways of doing it, but that should get you started on the simplest method.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic