mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Merge branch 'fix/default_value_for_forms'
This commit is contained in:
@@ -578,16 +578,16 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* @return mixed
|
||||
*/
|
||||
function field_value( $key, $default = false, $data = null ) {
|
||||
if (isset( $_SESSION ) && isset( $_SESSION['um_social_profile'][$key] ) && isset( $this->set_mode ) && $this->set_mode == 'register')
|
||||
return $_SESSION['um_social_profile'][$key];
|
||||
if ( isset( $_SESSION ) && isset( $_SESSION['um_social_profile'][ $key ] ) && isset( $this->set_mode ) && $this->set_mode == 'register' )
|
||||
return $_SESSION['um_social_profile'][ $key ];
|
||||
|
||||
$type = ( isset( $data['type'] ) ) ? $data['type'] : '';
|
||||
|
||||
// preview in backend
|
||||
if (isset( UM()->user()->preview ) && UM()->user()->preview) {
|
||||
if ( isset( UM()->user()->preview ) && UM()->user()->preview ) {
|
||||
$submitted = um_user( 'submitted' );
|
||||
if (isset( $submitted[$key] ) && !empty( $submitted[$key] )) {
|
||||
return $submitted[$key];
|
||||
if ( isset( $submitted[ $key ] ) && !empty( $submitted[ $key ] ) ) {
|
||||
return $submitted[ $key ];
|
||||
} else {
|
||||
return 'Undefined';
|
||||
}
|
||||
@@ -595,12 +595,12 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
// normal state
|
||||
if ( isset( UM()->form()->post_form[ $key ] ) ) {
|
||||
|
||||
//show empty value for password fields
|
||||
if ( strstr( $key, 'user_pass' ) && $this->set_mode != 'password' ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return stripslashes_deep( UM()->form()->post_form[$key] );
|
||||
return stripslashes_deep( UM()->form()->post_form[ $key ] );
|
||||
|
||||
} elseif ( um_user( $key ) && $this->editing == true ) {
|
||||
|
||||
@@ -655,8 +655,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
*/
|
||||
$value = apply_filters( "um_edit_{$type}_field_value", $value, $key );
|
||||
|
||||
return $value;
|
||||
|
||||
} elseif ( ( um_user( $key ) || isset( $data['show_anyway'] ) ) && $this->viewing == true ) {
|
||||
|
||||
return um_filtered_value( $key, $data );
|
||||
@@ -686,7 +684,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters( "um_edit_{$key}_field_value", $value, $key );
|
||||
return $value;
|
||||
|
||||
} elseif ( $default ) {
|
||||
|
||||
@@ -757,9 +754,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* ?>
|
||||
*/
|
||||
$default = apply_filters( "um_field_{$type}_default_value", $default, $data );
|
||||
return $default;
|
||||
|
||||
} elseif ( $this->editing == true ) {
|
||||
}
|
||||
|
||||
// Default Value for Registration Form and Profile Form editing
|
||||
if ( ! isset( $value ) && ( $this->set_mode == 'register' || $this->editing == true ) ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
@@ -782,11 +781,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( "um_edit_{$key}_field_value", '', $key );
|
||||
$value = apply_filters( "um_edit_{$key}_field_value", $default, $key );
|
||||
|
||||
}
|
||||
|
||||
return '';
|
||||
return isset( $value ) ? $value : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user