diff --git a/bu-liaison-inquiry.php b/bu-liaison-inquiry.php index ba42c09..4e9e66a 100644 --- a/bu-liaison-inquiry.php +++ b/bu-liaison-inquiry.php @@ -170,8 +170,15 @@ function process_form_definition( $inquiry_form, $field_ids ) { if ( 0 < count( $field_ids ) ) { foreach ( $inquiry_form->sections as $section ) { foreach ( $section->fields as $field_key => $field ) { + // Field by field processing. if ( ! in_array( $field->id, $field_ids ) ) { - unset( $section->fields[ $field_key ] ); + // If a field isn't listed and isn't required, just remove it. + if ( '1' != $field->required ) { + unset( $section->fields[ $field_key ] ); + } else { + $field->hidden = true; + $field->hidden_value = self::MINI_DUMMY_VALUE; + } } } } @@ -194,6 +201,9 @@ function handle_liaison_inquiry() { return; } + // Clear the verified nonce from $_POST so that it doesn't get passed on to Liaison. + unset( $_POST['liaison_inquiry_nonce'] ); + // Necessary to get the API key from the options, can't expose the key by passing it through the form. $options = get_option( 'bu_liaison_inquiry_options' ); // Check for a valid API key value. diff --git a/templates/form-template.php b/templates/form-template.php index cc0604e..acdef43 100644 --- a/templates/form-template.php +++ b/templates/form-template.php @@ -32,8 +32,15 @@ $label = ''; } //end setup + ?> + + hidden ) && $field->hidden ) : ?> + + htmlElement == 'input-text' ) : + elseif ( $field->htmlElement == 'input-text' ) : //begin input text $class = '';