Skip to content

Commit

Permalink
Merge branch 'user-fields-logic-overhaul' of https://github.com/dpark…
Browse files Browse the repository at this point in the history
…er1005/paid-memberships-pro into user-fields-php-ui
  • Loading branch information
dparker1005 committed Nov 7, 2024
2 parents a845f0f + 3c73ae1 commit 144376a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions classes/class-pmpro-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ private function getHTML($value = "")
$r_end .= "</div>";
}

if ( empty( $value ) && pmpro_is_checkout() ) {
if ( '' === $value && pmpro_is_checkout() ) {
/**
* Filter to set the default value for a field. The default value will only load if no value is already found.
*
Expand All @@ -894,7 +894,7 @@ private function getHTML($value = "")

if($this->type == "text")
{
$r = '<input type="text" id="' . esc_attr( $this->id ) . '" name="' . esc_attr( $this->name ) . '" value="' . esc_attr(wp_unslash($value)) . '" ';
$r = '<input type="text" id="' . esc_attr( $this->id ) . '" name="' . esc_attr( $this->name ) . '" value="' . ( is_string( $value ) ? esc_attr(wp_unslash($value) ) : '' ) . '" ';
if(!empty($this->size))
$r .= 'size="' . esc_attr( $this->size ) . '" ';
if(!empty($this->class))
Expand Down Expand Up @@ -1120,7 +1120,7 @@ private function getHTML($value = "")
$r .= 'readonly="readonly" ';
if(!empty($this->html_attributes))
$r .= $this->getHTMLAttributes();
$r .= '>' . esc_textarea(wp_unslash($value)) . '</textarea>';
$r .= '>' . ( ( is_string( $value ) ) ? esc_textarea(wp_unslash($value) ) : '' ) . '</textarea>';
}
elseif($this->type == "hidden")
{
Expand Down
4 changes: 2 additions & 2 deletions includes/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ function pmpro_checkout_user_creation_checks_user_fields( $okay ) {
}

// If the field was filled if needed, skip it.
if ( empty( $field->was_filled_if_needed() ) ) {
if ( $field->was_filled_if_needed() ) {
continue;
}

Expand Down Expand Up @@ -491,7 +491,7 @@ function pmpro_registration_checks_for_user_fields( $okay ) {
}

// If the field was filled if needed, skip it.
if ( empty( $field->was_filled_if_needed() ) ) {
if ( $field->was_filled_if_needed() ) {
continue;
}

Expand Down

0 comments on commit 144376a

Please sign in to comment.