Merge branch 'master' into fixes

This commit is contained in:
yura_nalivaiko
2018-05-11 15:08:37 +03:00
8 changed files with 103 additions and 58 deletions
+25 -2
View File
@@ -38,7 +38,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$this->localize_note();
$this->show_update_messages();
$this->check_wrong_install_folder();
$this->admin_notice_tracking();
//$this->admin_notice_tracking();
$this->need_upgrade();
$this->check_wrong_licenses();
@@ -225,9 +225,32 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
function old_extensions_notice() {
$show = false;
$old_extensions = array(
'bbpress',
'followers',
'friends',
'instagram',
'mailchimp',
'messaging',
'mycred',
'notices',
'notifications',
'online',
'private-content',
'profile-completeness',
'recaptcha',
'reviews',
'social-activity',
'social-login',
'terms-conditions',
'user-tags',
'verified-users',
'woocommerce',
);
$slugs = array_map( function( $item ) {
return 'um-' . $item . '/um-' . $item . '.php';
}, array_keys( UM()->dependencies()->ext_required_version ) );
}, $old_extensions );
$active_plugins = UM()->dependencies()->get_active_plugins();
foreach ( $slugs as $slug ) {
+1
View File
@@ -57,6 +57,7 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
'woocommerce' => '2.0.1',
'restrict-content' => '2.0',
'beaver-builder' => '2.0',
'gdpr' => '1.0.0',
);
+2 -42
View File
@@ -30,6 +30,7 @@ if ( ! class_exists( 'UM' ) ) {
* @method UM_Terms_Conditions_API Terms_Conditions_API()
* @method UM_Private_Content_API Private_Content_API()
* @method UM_User_Location_API User_Location_API()
* @method UM_GDPR_API GDPR_API()
*
*/
final class UM extends UM_Functions {
@@ -385,47 +386,6 @@ if ( ! class_exists( 'UM' ) ) {
}
/**
* Show notice for customers with old extension's versions
*/
/*function old_extensions_notice() {
if ( ! is_admin() ) {
return;
}
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
return;
}
$show = false;
$slugs = array_map( function( $item ) {
return 'um-' . $item . '/um-' . $item . '.php';
}, array_keys( $this->dependencies()->ext_required_version ) );
$active_plugins = $this->dependencies()->get_active_plugins();
foreach ( $slugs as $slug ) {
if ( in_array( $slug, $active_plugins ) ) {
$plugin_data = get_plugin_data( um_path . '..' . DIRECTORY_SEPARATOR . $slug );
if ( version_compare( '2.0', $plugin_data['Version'], '>' ) ) {
$show = true;
break;
}
}
}
if ( ! $show ) {
return;
}
/*global $um_woocommerce;
remove_action( 'init', array( $um_woocommerce, 'plugin_check' ), 1 );
$um_woocommerce->plugin_inactive = true;*
echo '<div class="error"><p>' . sprintf( __( '<strong>%s %s</strong> requires 2.0 extensions. You have pre 2.0 extensions installed on your site. <br /> Please update %s extensions to latest versions. For more info see this <a href="%s" target="_blank">doc</a>.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_version, ultimatemember_plugin_name, 'http://docs.ultimatemember.com/article/266-updating-to-2-0-versions-of-extensions' ) . '</p></div>';
}*/
/**
* Autoload UM classes handler
*
@@ -562,7 +522,7 @@ if ( ! class_exists( 'UM' ) ) {
$this->permalinks();
$this->modal();
$this->cron();
$this->tracking();
//$this->tracking();
$this->mobile();
$this->external_integrations();
}
+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' )
) {
+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;
+3 -2
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 );
/**
+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;
}
}