• oxxyfx

    (@oxxyfx)


    I have created the following template over 1.5 years ago, and I am calling it from a page with the following shortcode:

    [pdb_list template=mcard orderby=”first_name” order=”asc” filter=”mtype=Member&paid_year=2022″ fields=”first_name, last_name, paid_year, maac, status”]

    The content of the pdb-list-mcard.php located in the /public_html/wp/wp-content/themes/colormag-child/templates folder is:

    <?php
    /*
     *
     * template for participants list shortcode output including a CSV download form
     *
    */
    ?>
    <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
               */
              $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->show_pagination_control(); ?>
      <?php
      /**
       * prints the CSV download form
       *
       * @see full instructions on https://xnau.com/adding-a-csv-download-button/
       * 
       * @param array $config
       *          'title' => string the title for the export control
       *          'helptext' => string helptext to show with the control
       *          'button_text' => text shown on the download button
       *          'filename'  => string initial name of the file
       *          'allow_user_filename' => bool  if false, user cannot set filename
       *          'export_fields' => array of field names to include in the export
       */
      $config = array(
    		'title' => '',
    		'helptext' => 'Click the "Download" button above to get the current membership list form membership cards',
    		'button_text' => 'Download',
    		'filename' => 'XXXXX-membership-card-list',
    		'allow_user_filename' => 'True',
    		'export_fields' => array( 'first_name', 'last_name', 'paid_year', 'maac', 'status', 'id' )
    
    		); // this shows the form with all default values
      $this->csv_export_form( $config );
      ?>
    </div>
    

    Until recently I got the export as expected, but for the past few weeks – assuming since one of the latest updates – it is exporting the list with different fields:

    first_name, last_name, city, state, zip, maac, year_born, type, status, year_joined,
    paid_year, executive_position, comments, id

    it is a bit of inconvenience since our members starting to renew now, and we will need this export functionality to work almost on daily basis now.

    Please let me know how can I fix this.

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

    (@xnau)

    I’m testing this here and it’s working as expected to set the list of export fields in the export form configuration the way you’re doing it.

    Your code looks fine, so this suggests the problem is in the use of php sessions. Sessions are used to securely remember the settings so that they are not exposed to the user. If the session cannot recall the settings, however, it will revert to the global CSV export configuration.

    The odd thing is this part of the plugin has not changed for well over a year, so I can’t pinpoint the updated code that might be responsible for the problem.

    One thing to check is the “Use Alternate Session Method” setting in the plugin settings under the advanced tab. Normally, this should be unchecked, but you may want to try changing this setting to see if it helps.

    A quick fix might be to set the global CSV configuration to match your needs for that page.

    Roland,

    I’m having the same problem with my template file. It’s no longer being recognized and displaying the customized settings.

    David

    Plugin Author xnau webdesign

    (@xnau)

    Hi David,

    Please repost your question in a new topic with a detailed description of the problem. Probably it is not the same problem, so best to start fresh with your question.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘pdb-list template export not working correctly since last update’ is closed to new replies.