public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/builder/recordsform.php
/**
		 * If we have primary key and table details, load details from the database to load the defaults. This method
		 * will also load the meta values if we have any.
		 *
		 * @return Return the details that were loaded from the database.
		 */
If we have primary key and table details, load details from the database to load the defaults. This method
will also load the meta values if we have any.

@return Return the details that were loaded from the database.
If we have primary key and table details load details from the database to load the defaults . This method will also load the meta values if we have any . @return Return the details that were loaded from the database .
protected function loadDefaultsFromDB() {
			if ( ! $this->primaryKey || ! $this->tableName ) {
				$this->messages = $this->showMessage( 'loadDefaultsFromDB(): Nothing could be loaded, as the table name and primary key details are invalid.', true );
				return false;
			}
			$this->recordDetails = getRecordDetails( $this->tableName, $this->primaryKey, $this->primaryKeyValue, ARRAY_A );
			if ( empty( $this->recordDetails ) ) {
				return false;
			}
			if ( ! empty( $this->meta_element_list ) ) {
				if ( ! $this->metaTableName ) {
					$this->messages = $this->showMessage( 'loadDefaultsFromDB(): The specified meta table is not valid, so meta values could not be loaded.', true );
					return $this->recordDetails;
				}
				global $wpdb;
				$wpdb->show_errors();
				foreach ( $this->meta_element_list as $fieldName ) {
					$SQL = $wpdb->prepare( "
						SELECT meta_value 
						FROM $this->metaTableName
						WHERE $this->metaForeignKey = %s
						AND meta_key = %s
						LIMIT 1",
						$this->primaryKeyValue,
						$fieldName
					);
					$this->recordDetails[ $fieldName ] = $wpdb->get_var( $SQL );
				} 
			} 
			parent::loadDefaults( $this->recordDetails );
			$this->alreadyInDB = true;
			return $this->recordDetails;
		}
protected function loadDefaultsFromDB ( ) { if ( ! $ this -> primaryKey || ! $ this -> tableName ) { $ this -> messages = $ this -> showMessage ( 'loadDefaultsFromDB(): Nothing could be loaded, as the table name and primary key details are invalid.' , true ) ; return false ; } $ this -> recordDetails = getRecordDetails ( $ this -> tableName , $ this -> primaryKey , $ this -> primaryKeyValue , ARRAY_A ) ; if ( empty ( $ this -> recordDetails ) ) { return false ; } if ( ! empty ( $ this -> meta_element_list ) ) { if ( ! $ this -> metaTableName ) { $ this -> messages = $ this -> showMessage ( 'loadDefaultsFromDB(): The specified meta table is not valid, so meta values could not be loaded.' , true ) ; return $ this -> recordDetails ; } global $ wpdb ; $ wpdb -> show_errors ( ) ; foreach ( $ this -> meta_element_list as $ fieldName ) { $ SQL = $ wpdb -> prepare ( " 
						SELECT meta_value 
						FROM  $ this -> metaTableName 
						WHERE  $ this -> metaForeignKey  = %s
						AND meta_key = %s
						LIMIT 1 " , $ this -> primaryKeyValue , $ fieldName ) ; $ this -> recordDetails [ $ fieldName ] = $ wpdb -> get_var ( $ SQL ) ; } } parent :: loadDefaults ( $ this -> recordDetails ) ; $ this -> alreadyInDB = true ; return $ this -> recordDetails ; }
If we have primary key and table details, load details from the database to load the defaults.
If we have primary key and table details load details from the database to load the defaults .
// Fetch any existing details for the main record. // Try to fetch the meta values if we have any // Add details, even if blank // end of foreach // end of if // Load the details into the defaults. // Exists checks