WordPress.org

Ready to get started?Download WordPress

Forums

Participants Database
[resolved] Search column (7 posts)

  1. Harmenvantwillert
    Member
    Posted 1 year ago #

    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.

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

  2. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. Harmenvantwillert
    Member
    Posted 1 year ago #

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

  4. Harmenvantwillert
    Member
    Posted 1 year ago #

    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();
  5. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    Read the section titled "Form Templates" on this page: http://wordpress.org/extend/plugins/participants-database/other_notes/

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

  6. Harmenvantwillert
    Member
    Posted 1 year ago #

    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()
  7. bw3em
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.