mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed issues with account fields;
This commit is contained in:
@@ -533,7 +533,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
$fields = $this->account_secure_fields( $fields, $id );
|
||||
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
|
||||
|
||||
foreach ( $fields as $key => $data ){
|
||||
foreach ( $fields as $key => $data ) {
|
||||
$output .= UM()->fields()->edit_field( $key, $data );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -838,7 +838,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
if (!isset( UM()->form()->post_form[$key] )) {
|
||||
if ( ! isset( UM()->form()->post_form[ $key ] ) ) {
|
||||
|
||||
$field_value = um_user( $key );
|
||||
|
||||
@@ -851,12 +851,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$field_value = 'um_' . $field_value;
|
||||
}
|
||||
}
|
||||
/*elseif( $this->set_mode == 'register' ){
|
||||
$data['default'] = UM()->options()->get( 'register_role' );
|
||||
}
|
||||
else{
|
||||
$data['default'] = get_option( 'default_role' );
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -881,6 +875,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* ?>
|
||||
*/
|
||||
$field_value = apply_filters( 'um_is_selected_filter_value', $field_value, $key );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -905,27 +900,27 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
*/
|
||||
$data = apply_filters( 'um_is_selected_filter_data', $data, $key, $field_value );
|
||||
|
||||
if ($field_value && $this->editing == true && is_array( $field_value ) && ( in_array( $value, $field_value ) || in_array( html_entity_decode( $value ), $field_value ) )) {
|
||||
if ( $field_value && $this->editing == true && is_array( $field_value ) && ( in_array( $value, $field_value ) || in_array( html_entity_decode( $value ), $field_value ) ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($field_value && $this->editing == true && !is_array( $field_value ) && $field_value == $value) {
|
||||
if ( $field_value && $this->editing == true && ! is_array( $field_value ) && $field_value == $value ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($field_value && $this->editing == true && !is_array( $field_value ) && html_entity_decode( $field_value ) == html_entity_decode( $value )) {
|
||||
if ( $field_value && $this->editing == true && ! is_array( $field_value ) && html_entity_decode( $field_value ) == html_entity_decode( $value )) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strstr( $data['default'], ', ' )) {
|
||||
if ( strstr( $data['default'], ', ' ) ) {
|
||||
$data['default'] = explode( ', ', $data['default'] );
|
||||
}
|
||||
|
||||
if (isset( $data['default'] ) && !is_array( $data['default'] ) && $data['default'] == $value) {
|
||||
if ( isset( $data['default'] ) && ! is_array( $data['default'] ) && $data['default'] === $value ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isset( $data['default'] ) && is_array( $data['default'] ) && in_array( $value, $data['default'] )) {
|
||||
if ( isset( $data['default'] ) && is_array( $data['default'] ) && in_array( $value, $data['default'] )) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2383,7 +2378,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '">';
|
||||
|
||||
|
||||
if (isset( $data['allowclear'] ) && $data['allowclear'] == 0) {
|
||||
$class = 'um-s2';
|
||||
} else {
|
||||
@@ -2631,17 +2625,15 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
$output .= '<option value="' . $option_value . '" ';
|
||||
|
||||
if ($this->is_selected( $form_key, $option_value, $data )) {
|
||||
if ( $this->is_selected( $form_key, $option_value, $data ) ) {
|
||||
$output .= 'selected';
|
||||
$field_value = $option_value;
|
||||
} else if (!isset( $options_pair ) && $this->is_selected( $form_key, $v, $data )) {
|
||||
} elseif ( ! isset( $options_pair ) && $this->is_selected( $form_key, $v, $data ) ) {
|
||||
$output .= 'selected';
|
||||
$field_value = $v;
|
||||
}
|
||||
|
||||
$output .= '>' . __( $um_field_checkbox_item_title, 'ultimate-member' ) . '</option>';
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2181,14 +2181,15 @@ function um_user( $data, $attrs = null ) {
|
||||
case 'profile_photo':
|
||||
$data = um_get_user_avatar_data( um_user( 'ID' ), $attrs );
|
||||
|
||||
return '<img src="' . esc_attr($data['url']) . '"
|
||||
class="' . esc_attr($data['class']) . '"
|
||||
width="' . esc_attr($data['size']) . '"
|
||||
height="' . esc_attr($data['size']) . '"
|
||||
alt="' . esc_attr($data['alt']) . '"
|
||||
data-default="' . esc_attr($data['default']) . '"
|
||||
onerror="if(!this.getAttribute(\'data-load-error\')){this.setAttribute(\'data-load-error\', \'1\');this.setAttribute(\'src\', this.getAttribute(\'data-default\'));}" />'; //don't move attribute before src
|
||||
|
||||
return sprintf( '<img src="%s" class="%s" width="%s" height="%s" alt="%s" data-default="%s" onerror="%s" />',
|
||||
esc_attr( $data['url'] ),
|
||||
esc_attr( $data['class'] ),
|
||||
esc_attr( $data['size'] ),
|
||||
esc_attr( $data['size'] ),
|
||||
esc_attr( $data['alt'] ),
|
||||
esc_attr( $data['default'] ),
|
||||
'if ( ! this.getAttribute(\'data-load-error\') ){ this.setAttribute(\'data-load-error\', \'1\');this.setAttribute(\'src\', this.getAttribute(\'data-default\'));}'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'cover_photo':
|
||||
|
||||
Reference in New Issue
Block a user