• Resolved Harmenvantwillert

    (@harmenvantwillert)


    Hi, I would like to edit a little in the search function.

    Now when I try to find a last name I have to select Last name from the dropdown menu which is Show All as default. When I search for last name I get the error “Please select a column.

    I would like to have Last name as default selection instead of show all.

    Some info:
    I have 4 columns; First Name, Last Name, Phone and Location.
    Everything works fine, for privacy reasons I can’t give the url.

    https://www.ads-software.com/extend/plugins/participants-database/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author xnau webdesign

    (@xnau)

    To preset the default search field, you need to use a custom template for your [pdb_list] shortcode. In that template, put something like this before the line that has $this->show_search_sort_form();

    $this->filter['search_field'] = 'last_name';

    That will set the search field selector to that field.

    Thread Starter Harmenvantwillert

    (@harmenvantwillert)

    I don’t have a custom template, so this didn’t work for me.

    Thread Starter Harmenvantwillert

    (@harmenvantwillert)

    Can’t this be done with the standard template? I have the following shortcode:
    [pdb_list fields=”first_name, last_name, phone, locatie” search=”true”]

    I use the pdb/classes/PDb_List.class.php look for the line you suggested but can only find:

    /**
       * prints the whole search/sort form as a shortcut function
       *
       */
      public function show_search_sort_form() {
    
        $output = array();

    Plugin Author xnau webdesign

    (@xnau)

    Read the section titled “Form Templates” on this page: https://www.ads-software.com/extend/plugins/participants-database/other_notes/

    It explains how to use a custom template on your site.

    Thread Starter Harmenvantwillert

    (@harmenvantwillert)

    Don’t need to setup a custom template, I found the line in: templates/pdb-list-default.php

    Added the line and now it works, thanx for point out the direction.

    It now looks like:

    /*
       * SEARCH/SORT FORM
       *
       * the search/sort form is only presented when enabled in the shortcode.
       *
       */
      $this->filter['search_field'] = 'last_name';
      $this->show_search_sort_form()

    If you don’t use a custom template, you may lose any edits to the default template on updates to the plugin!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Search column’ is closed to new replies.