mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-17 13:43:38 +09:00
Merge branch 'master' into fixes
This commit is contained in:
@@ -532,7 +532,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
|
||||
if ( um_is_core_post( $post, 'login' ) || um_is_core_post( $post, 'register' ) ||
|
||||
um_is_core_post( $post, 'account' ) || um_is_core_post( $post, 'logout' ) ||
|
||||
um_is_core_post( $post, 'password-reset' ) )
|
||||
um_is_core_post( $post, 'password-reset' ) || um_is_core_post( $post, 'user' ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -798,6 +798,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$stripslashed = array_map( 'stripslashes', UM()->form()->post_form[ $key ] );
|
||||
if ( in_array( $value, $stripslashed ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( in_array( html_entity_decode( $value ), UM()->form()->post_form[ $key ] ) ) {
|
||||
return true;
|
||||
}
|
||||
@@ -1578,7 +1583,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
if ($visibility == 'view' && $this->set_mode != 'register') return;
|
||||
|
||||
if (( $visibility == 'view' && $this->set_mode == 'register' ) ||
|
||||
if ( ( $visibility == 'view' && $this->set_mode == 'register' ) ||
|
||||
( isset( $data['editable'] ) && $data['editable'] == 0 && $this->set_mode == 'profile' )
|
||||
) {
|
||||
|
||||
|
||||
@@ -220,6 +220,9 @@ function um_user_edit_profile( $args ) {
|
||||
if ( ! empty( $fields ) ) {
|
||||
foreach ( $fields as $key => $array ) {
|
||||
|
||||
/*if ( ! um_can_edit_field( $fields[ $key ] ) )
|
||||
continue;*/
|
||||
|
||||
if ( ! um_can_edit_field( $fields[ $key ] ) && isset( $fields[ $key ]['editable'] ) && ! $fields[ $key ]['editable'] )
|
||||
continue;
|
||||
|
||||
|
||||
@@ -54,8 +54,9 @@ function um_after_insert_user( $user_id, $args ) {
|
||||
//clear Users cached queue
|
||||
UM()->user()->remove_cached_queue();
|
||||
|
||||
um_fetch_user( $user_id );
|
||||
UM()->user()->set_status( um_user('status') );
|
||||
if ( ! empty( $args['submitted'] ) ) {
|
||||
um_fetch_user( $user_id );
|
||||
UM()->user()->set_registration_details( $args['submitted'] );
|
||||
}
|
||||
|
||||
@@ -103,7 +104,7 @@ function um_after_insert_user( $user_id, $args ) {
|
||||
*/
|
||||
do_action( 'um_registration_complete', $user_id, $args );
|
||||
}
|
||||
add_action( 'um_user_register', 'um_after_insert_user', 10, 2 );
|
||||
add_action( 'um_user_register', 'um_after_insert_user', 1, 2 );
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -367,18 +367,70 @@ add_filter( 'um_get_form_fields', 'um_get_form_fields', 99 );
|
||||
*/
|
||||
function um_get_custom_field_array( $array, $fields ) {
|
||||
|
||||
if ( isset( $array['conditions'] ) ) {
|
||||
for ( $a = 0; $a < count( $array['conditions'] ); $a++ ) {
|
||||
if ( isset( $array['conditional_value'] ) || isset( $array['conditional_value' . $a] ) ) {
|
||||
foreach ( $array['conditions'] as $key => $value ) {
|
||||
$condition_metakey = $fields[ $value[1] ]['metakey'];
|
||||
if ( ! empty( $array['conditions'] ) ) {
|
||||
foreach ( $array['conditions'] as $key => $value ) {
|
||||
$condition_metakey = $fields[ $value[1] ]['metakey'];
|
||||
if ( isset( $_POST[ $condition_metakey ] ) ) {
|
||||
$cond_value = ( $fields[ $value[1] ]['type'] == 'radio' ) ? $_POST[ $condition_metakey ][0] : $_POST[ $condition_metakey ];
|
||||
list( $visibility, $parent_key, $op, $parent_value ) = $value;
|
||||
|
||||
if ( isset( $_POST[ $condition_metakey ] ) ) {
|
||||
$cond_value = ( $fields[ $value[1] ]['type'] == 'radio' ) ? $_POST[ $condition_metakey ][0] : $_POST[ $condition_metakey ];
|
||||
|
||||
if ( isset( $array['conditional_value'] ) && $cond_value !== $array['conditional_value'] ) {
|
||||
if ( $visibility == 'hide' ) {
|
||||
if ( $op == 'empty' ) {
|
||||
if ( empty( $cond_value ) ) {
|
||||
$array['required'] = 0;
|
||||
} elseif ( isset( $array['conditional_value'.$a] ) && $cond_value !== $array['conditional_value'.$a] ) {
|
||||
}
|
||||
} elseif ( $op == 'not empty' ) {
|
||||
if ( ! empty( $cond_value ) ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'equals to' ) {
|
||||
if ( $cond_value == $parent_value ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'not equals' ) {
|
||||
if ( $cond_value != $parent_value ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'greater than' ) {
|
||||
if ( $cond_value > $op ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'less than' ) {
|
||||
if ( $cond_value < $op ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'contains' ) {
|
||||
if ( strstr( $cond_value, $parent_value ) ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
}
|
||||
} elseif ( $visibility == 'show' ) {
|
||||
if ( $op == 'empty' ) {
|
||||
if ( ! empty( $cond_value ) ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'not empty' ) {
|
||||
if ( empty( $cond_value ) ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'equals to' ) {
|
||||
if ( $cond_value != $parent_value ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'not equals' ) {
|
||||
if ( $cond_value == $parent_value ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'greater than' ) {
|
||||
if ( $cond_value <= $op ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'less than' ) {
|
||||
if ( $cond_value >= $op ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
} elseif ( $op == 'contains' ) {
|
||||
if ( ! strstr( $cond_value, $parent_value ) ) {
|
||||
$array['required'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user