Merge branch 'master' of https://github.com/ultimatemember/ultimatemember into fix_privacy_tab_content

This commit is contained in:
Denis Baranov
2018-05-14 11:30:37 +03:00
11 changed files with 160 additions and 86 deletions
+1 -1
View File
@@ -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;
}
+6 -1
View File
@@ -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' )
) {
+14
View File
@@ -890,6 +890,20 @@ if ( ! class_exists( 'um\core\User' ) ) {
unset( $submitted['confirm_user_password'] );
}
//remove all password field values from submitted details
$password_fields = array();
foreach ( $submitted as $k => $v ) {
if ( UM()->fields()->get_field_type( $k ) == 'password' ) {
$password_fields[] = $k;
$password_fields[] = 'confirm_' . $k;
}
}
foreach ( $password_fields as $pw_field ) {
unset( $submitted[ $pw_field ] );
}
/**
* UM hook
*
+3
View File
@@ -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;
+5 -4
View File
@@ -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 );
/**
@@ -118,7 +119,7 @@ function um_send_registration_notification( $user_id, $args ) {
$emails = um_multi_admin_email();
if ( ! empty( $emails ) ) {
foreach ( $emails as $email ) {
if ( um_user( 'status' ) != 'pending' ) {
if ( um_user( 'account_status' ) != 'pending' ) {
UM()->mail()->send( $email, 'notification_new_user', array( 'admin' => true ) );
} else {
UM()->mail()->send( $email, 'notification_review', array( 'admin' => true ) );
@@ -136,7 +137,7 @@ add_action( 'um_registration_complete', 'um_send_registration_notification', 10,
* @param $args
*/
function um_check_user_status( $user_id, $args ) {
$status = um_user( 'status' );
$status = um_user( 'account_status' );
/**
* UM hook
+62 -10
View File
@@ -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;
}
}
+4 -3
View File
@@ -47,7 +47,7 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
if ( empty( $_POST['menu-item-db-id'] ) || ! in_array( $menu_item_db_id, $_POST['menu-item-db-id'] ) ) {
return;
}
//var_dump($_POST['menu-item-um_nav_roles']); exit;
foreach ( self::$fields as $_key => $label ) {
$key = sprintf( 'menu-item-%s', $_key );
@@ -55,7 +55,8 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
// Sanitize
if ( ! empty( $_POST[ $key ][ $menu_item_db_id ] ) ) {
// Do some checks here...
$value = $_POST[ $key ][ $menu_item_db_id ];
$value = is_array( $_POST[ $key ][ $menu_item_db_id ] ) ?
array_keys( $_POST[ $key ][ $menu_item_db_id ] ) : $_POST[ $key ][ $menu_item_db_id ];
} else {
$value = null;
}
@@ -165,7 +166,7 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
$id_attr = ' id="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
$for_attr = ' for="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
$html .= "<label $for_attr>
<input type='checkbox' {$id_attr} name='menu-item-um_nav_roles[{{data.menuItemID}}][]' value='{$k}' <# if( _.contains( data.restriction_data.um_nav_roles,'{$k}' ) ){ #>checked='checked'<# } #> />
<input type='checkbox' {$id_attr} name='menu-item-um_nav_roles[{{data.menuItemID}}][{$k}]' value='1' <# if( _.contains( data.restriction_data.um_nav_roles,'{$k}' ) ){ #>checked='checked'<# } #> />
<span>{$title}</span>
</label>";
}