• Hi there,
    When I updated my plugin to the latest version of Participants Database, my custom template stops working. I don’t really understand why becasue I still see the template in my theme/templates directory and the same shortcode is being used to call is on the site.

    Anything else I need to do after upgrading to get this to work again?

    Thanks,
    Kristen

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

    (@xnau)

    There isn’t any reason in the latest update why your template would stop working. What is the shortcode you are using?

    Thread Starter fraugefahr

    (@fraugefahr)

    The shortcode I am using is:

    [pdb_list template=”custom” sort=true orderby=”author_last”]

    And the template is located in THEME_FOLDER/templates/pdb-list-custom.php

    I checked and it is still there.

    This is what is in pdb-list-custom.php (it hasn’t changed at all):

    <?php
    /*
    *
    * template for participants list shortcode output
    *
    * this is the default template which formats the list of records as a table
    * using shortcut functions to display the componenets
    *
    * If you need more control over the display, look at the detailed template
    * (pdb-list-detailed.php) for an example of how this can be done
    *
    * Please note that if you have more than one list on a page, searching, sorting
    * and pagination will not work correctly.
    *
    */
    ?>
    <div class=”wrap <?php echo $this->wrap_class ?>” id=”<?php echo $this->list_anchor ?>”>
    <?php
    /*
    * SEARCH/SORT FORM
    *
    * the search/sort form is only presented when enabled in the shortcode.
    *
    */
    $this->show_search_sort_form();

    /* LIST DISPLAY */
    /*
    * NOTE: the container for the list itself (excluding search and pagination
    * controls) must have a class of “list-container” for AJAX search/sort to
    * function
    */
    ?>
    <table class=”wp-list-table widefat fixed pages list-container” >

    <?php
    // print the count if enabled in the shortcode
    $this->print_list_count($wrap_tag = false);
    ?>
    <?php if ( $record_count > 0 ) : // print only if there are records to show ?>

    <thead>
    <tr>
    <?php /*
    * this function prints headers for all the fields
    * replacement codes:
    * %2$s is the form element type identifier
    * %1$s is the title of the field
    */

    if (strcasecmp(“%1$s1”, “Lexile Level”) == 0) {
    $this->print_header_row( ‘<th class=”%2$s” scope=”col”>%1$s</th>’ );
    } elseif (strcasecmp(“%1$s1”, “ATOS”) == 0) {
    $this->print_header_row( ‘<th class=”%2$s” scope=”col”>%1$s</th>’ );
    } else {
    $this->print_header_row( ‘<th class=”%2$s” scope=”col”>%1$s</th>’ );
    }
    ?>
    </tr>
    </thead>

    <tbody>
    <?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?>
    <tr>
    <?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?>

    <td class=”<?php echo $this->field->name ?>-field”>
    <?php $this->field->print_value() ?>
    </td>

    <?php endwhile; // each field ?>
    </tr>
    <?php endwhile; // each record ?>
    </tbody>

    <?php else : // if there are no records ?>

    <tbody>
    <tr>
    <td><?php if ($this->is_search_result) echo Participants_Db::$plugin_options[‘no_records_message’] ?></td>
    </tr>
    </tbody>

    <?php endif; // $record_count > 0 ?>

    </table>
    <?php
    /*
    * this shortcut function presents a pagination control with default layout
    */
    $this->show_pagination_control();
    ?>
    </div>

    -Kristen

    Plugin Author xnau webdesign

    (@xnau)

    OK, thanks for that. So what is happening? Is it using the default template? Why do you say it doesn’t work?

    Thread Starter fraugefahr

    (@fraugefahr)

    Okay, I got a chance to look at this more. The custom template is fine. The customizations I lost were on the form to sort the list. I had everything next to each other, the sort field drop down, the ascending/descending radio buttons, and the submit button, just to make it neat and orderly. I lost all of that.

    I went back to look at what I did to customize it and I edited the function sort_form in PDb_List.class.php.

    Is there a better way to customize the search/sort form so I won’t lose my changes when I update?

    Thanks so much,
    Kristen

    Plugin Author xnau webdesign

    (@xnau)

    You can put your customized search form into the template. Instead of using the template function or functions that show the form, put the function code directly into the template. Then you can modify it and updates won’t touch it.

    Thread Starter fraugefahr

    (@fraugefahr)

    Okay, so I changed my shortcode and took out the “sort=true” part. Then I edited pdb-list-custom.php and added the html that the shortcode was outputting when it had “sort=true” in it. I can see the drop down, radio buttons, and submit button, but the form stops working when it is coming from the code I put in the template as opposed to the shortcode.

    Here is the code when it comes from the shortcode:

    <div>
    <div class=”wrap pdb-list pdb-instance-1 participants-database” id=”participants-list-1″>
    <div class=”pdb-searchform”>
    <div class=”pdb-error pdb-search-error” style=”display:none”>
    <p class=”search_field_error”>Please select a column to search in.</p>
    <p class=”value_error”>Please type in something to search for.</p>
    </div>
    <form method=”post” class=”sort_filter_form” action=”https://ets.sbceo.org/resources/class-sets/#participants-list-1&#8243; data-ref=”update” >
    <input name=”action” type=”hidden” value=”pdb_list_filter” /></p>
    <p><input name=”target_instance” type=”hidden” value=”1″ /></p>
    <p><input name=”instance_index” type=”hidden” value=”1″ /></p>
    <p><input name=”pagelink” type=”hidden” value=”/resources/class-sets/?listpage=%1$s” /></p>
    <p><input name=”sortstring” type=”hidden” value=”” /></p>
    <p><input name=”orderstring” type=”hidden” value=”” /></p>
    <p><input name=”filterNonce” type=”hidden” value=”449d7a4847″ /></p>
    <fieldset class=”widefat inline-controls”>
    <legend>Sort by:</legend>
    <p><select name=”sortBy” id=”pdb-sortBy” class=”search-item” ><option value=”author_last” selected=”selected” >Author’s Last Name</option><option value=”title” >Title</option><option value=”lexile_level” >Lexile Level</option><option value=”atos” >ATOS</option></select></p>
    <div class=”radio-group” ><label class=”checkbox inline search-item” for=”pdb-ascdesc-asc”><input name=”ascdesc” checked=”checked” id=”pdb-ascdesc-asc” type=”radio” class=”checkbox inline search-item” value=”ASC” />Ascending</label><label class=”checkbox inline search-item” for=”pdb-ascdesc-desc”><input name=”ascdesc” id=”pdb-ascdesc-desc” type=”radio” class=”checkbox inline search-item” value=”DESC” />Descending</label></div>
    <p><input name=”submit_button” data-submit=”sort” type=”submit” value=”Sort” /><br />
    </fieldset>
    </form>
    </div>

    Here is the code I put into pdb-list.custom.php that doesn’t work:
    <div>
    <div class=”wrap pdb-list pdb-instance-1 participants-database” id=”participants-list-1″>
    <div class=”pdb-searchform”>
    <div class=”pdb-error pdb-search-error” style=”display:none”>
    <p class=”search_field_error”>Please select a column to search in.</p>
    <p class=”value_error”>Please type in something to search for.</p>
    </div>
    <form method=”post” class=”sort_filter_form” action=”https://ets.sbceo.org/resources/class-sets/#participants-list-1&#8243; data-ref=”update” >
    <input name=”action” type=”hidden” value=”pdb_list_filter” /></p>
    <p><input name=”target_instance” type=”hidden” value=”1″ /></p><p><input name=”instance_index” type=”hidden” value=”1″ /></p>
    <p><input name=”pagelink” type=”hidden” value=”/resources/class-sets/?listpage=%1$s” /></p>
    <p><input name=”sortstring” type=”hidden” value=”” /></p>
    <p><input name=”orderstring” type=”hidden” value=”” /></p>
    <p><input name=”filterNonce” type=”hidden” value=”eec3ce0a1b” /></p>
    <fieldset class=”widefat inline-controls”>
    <legend>Sort by:</legend>
    <p><select name=”sortBy” id=”pdb-sortBy” class=”search-item” ><option value=”author_last” selected=”selected” >Author’s Last Name</option><option value=”title” >Title</option><option value=”lexile_level” >Lexile Level</option><option value=”atos” >ATOS</option></select></p>
    <div class=”radio-group” ><label class=”checkbox inline search-item” for=”pdb-ascdesc-asc”><input name=”ascdesc” checked=”checked” id=”pdb-ascdesc-asc” type=”radio” class=”checkbox inline search-item” value=”ASC” />Ascending</label><label class=”checkbox inline search-item” for=”pdb-ascdesc-desc”><input name=”ascdesc” id=”pdb-ascdesc-desc” type=”radio” class=”checkbox inline search-item” value=”DESC” />Descending</label></div>
    <p><input name=”submit_button” data-submit=”sort” type=”submit” value=”Sort” /><br />
    </fieldset>
    </form>
    </div>

    I don’t know what I am missing here. I am putting in the same code the shortcode generates, but when it’s coming from the custom template, the form no longer works.

    Can you see what’s going on that would make the sort form no longer work?
    Thanks so much,
    Kristen

    Plugin Author xnau webdesign

    (@xnau)

    Are you using the latest version of Participants Database? The “filterNonce” value won’t work like that in older versions of the plugin.

    Thread Starter fraugefahr

    (@fraugefahr)

    I am using Version 1.7.5.3.

    Thanks,
    Kristen

    Plugin Author xnau webdesign

    (@xnau)

    Try it with the latest version of the plugin.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom Template Stops Working After I Upgrade Plugin’ is closed to new replies.