Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter jacksun

    (@jacksun)

    Hi Flezen, my list views are fine, single-views are the issue. I don’t think you can do 2 installs without huge changes to the code as it names the database, does all the hooks based on certain names, and a bunch of other stuff that would need to be changed.

    Wayne

    Thread Starter jacksun

    (@jacksun)

    Worked like a charm. I can pull 250 records into the list participants admin interface without an issue. I use the shortcode to limit web facing searches and pages. The speed is much quicker overall, even front end website stuff. And I mean quicker.

    Cheers,
    Wayne

    Try adding this to your php.ini file

    memory_limit = 64M

    You can up this limit for testing (72, 80, 88, 96, 104, 112, 120, 128 etc). My main search display will not work unless I have this set at 768M.
    I have ~108,000 records.

    Wayne

    Thread Starter jacksun

    (@jacksun)

    Hi, so I rebuilt my entire installation. Deactivated the plugin, deleted it and all data. Made sure the uploads folder was empty and deleted it as well. Cleaned the database out of all PDB data. Reinstalled.

    Everything worked fine until about the time I had 40000 records in the DB and then the list participants page failed. It failed with another error about Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes).
    So increasing the php.ini memory size has not corrected this issue, but the issue is related to the fact the list participants page wants to have a list of all items in the database available to it.
    Basically I think it does the same query as the initial display page, without the benefit of restricting the data it grabs using a shortcode.

    So is there a way to restrict the data this query grabs? On the list participants page I would normally search for the record I want to see or edit, I wouldn’t page through the data. Because of that I think it should just grab the first 10 records (as adjusted in settings) to display, anything else I can search for.
    How do I go about altering this query for the page?

    Thanks,
    Wayne

    Thread Starter jacksun

    (@jacksun)

    Can records 0-1324 exist? Or does record 1325 have to be the first record?

    Wayne

    Thread Starter jacksun

    (@jacksun)

    Hi, the errors were in wp_db.php,

    Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in /home/xxxxxxxx/public_html/wp-includes/wp-db.php on line 1383.

    I’ll look for the div tag and see what is going on.

    I have that record in place. I checked it yesterday after going through previous support issues on this site and yours. Still no luck with it showing.

    Wayne

    Hi, here’s what I did. File /templates/pdb-single-default.php.

    This is the code that handles the display of the single record. Lines 55 – 72 of the file.

    <dl>
    
          <?php // this prints out all the fields in the group
    			foreach( $group->fields as $field ) : 
    
              $value = Participants_Db::prep_field_for_display( $field->value, $field->form_element );
    
    					$empty_class = empty( $value ) ? 'blank-field' : '';
    
          ?>
    
          <dt class="<?php echo $field->name.' '.$empty_class?>"><?php echo $field->title ?></dt>
    
          <dd class="<?php echo $field->name.' '.$empty_class?>"><?php echo $value ?></dd>
    
        	<?php endforeach; // end of the fields loop ?>
    
        </dl>

    I changed it to:

    <div>
    
          <?php // this prints out all the fields in the group
    			foreach( $group->fields as $field ) :
    
              $value = Participants_Db::prep_field_for_display( $field->value, $field->form_element );
    
    					$empty_class = empty( $value ) ? 'blank-field' : '';
    
          ?>
    
          <p class="<?php echo $field->name.' '.$empty_class?>"><B><?php echo $field->title ?>:</B> <?php echo $value ?></p>
    
        	<?php endforeach; // end of the fields loop ?>
    
        </div>

    Now records display like this, ignore the spacing, it looks better on a web page:

    Last Name: AARON
    First Name: J
    Soldier Number:4457224
    Regt / Unit: The Durham Light Infantry

    Anyway, the area of the code above is what you need to edit to alter the display of the single record page. You can use classes and the like in the <div> tags to take advantage of your current CSS.

    Wayne

    This worked for me, file participants-database.php. On lines 1010 to 1025 you will find this code. Change each instance of “email” to be the column name you want to use to identify duplicates. In my case the column name was soldier_number. Where you now see soldier_number is where you have to make changes, remember column name, NOT column title must be used. If I haven’t changed something such as “unique_email” or “$email” then don’t change it.

    $options = get_option( self::$participants_db_options );
    
    		// check for an existing record with same email so we can at least avoid
    		// inserting a duplicate email address into the database
    		if ( $options['unique_email'] && isset( $post['soldier_number'] ) && ! empty( $post['soldier_number'] ) && self::email_exists( $post['soldier_number'] ) ) {
    
          // record with same email exists...get the id and update the existing record
          $participant_id = self::_get_participant_id_by_term( 'soldier_number', $post['soldier_number'] );
    
    			// if there is more than one record with a particular email, return the first one
    			if ( is_array( $participant_id ) ) $participant_id = current( $participant_id );
    
    			//unset( $post['private_id'] );
          $action = 'update';
    
        }

    Then on lines 1257 to 1267 you will find this code:

    /**
       * tests for the presence of an email address in the records
       *
       * @param string $email the email address to search for
       * @return boolean true if email is found
       */
      public function email_exists( $email ) {
    
        return self::_id_exists( $email, 'soldier_number' );
    
      }

    Change the “email” to be your column name here as well.

    Then do some testing. Hope this works for you.

    Wayne

    Forum: Fixing WordPress
    In reply to: Edit post issue
    Thread Starter jacksun

    (@jacksun)

    I found the resolution here:

    https://www.24fightingchickens.com/2006/08/03/turn-off-the-preview-in-wordpress-20/

    Now I just have to do a manual preview after adding or editing a post. Works for me.

    Thanks,
    Wayne

Viewing 10 replies - 1 through 10 (of 10 total)