- Fixed Profile Form field privacy

- Fixed conditional menu logic for 2 different nav menu hooks
- Fixed registration form preview on wp-admin screen
- Restored old CSS settings to "um_old_settings.css"
- Clean user's cache
This commit is contained in:
nikitozzzzzzz
2018-04-18 17:40:54 +03:00
parent 1ea4d85636
commit 5393411f2b
9 changed files with 188 additions and 7 deletions
+1 -1
View File
@@ -540,7 +540,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
ob_start(); ?>
<p>
<?php printf( __( '<strong>%s version %s</strong> needs to be updated for correct working.<br />It is necessary to update the structure of the database and options that are associated with <strong>%s %s</strong>.<br />Please visit <a href="%s">"Upgrade"</a> page and run the upgrade process.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_version, ultimatemember_plugin_name, ultimatemember_version, $url ); ?>
<?php printf( __( '<strong>%s version %s</strong> needs to be updated to work correctly.<br />It is necessary to update the structure of the database and options that are associated with <strong>%s %s</strong>.<br />Please visit <a href="%s">"Upgrade"</a> page and run the upgrade process.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_version, ultimatemember_plugin_name, ultimatemember_version, $url ); ?>
</p>
<p>
+18
View File
@@ -0,0 +1,18 @@
<?php
function um_upgrade_styles2010() {
um_maybe_unset_time_limit();
include 'styles.php';
wp_send_json_success( array( 'message' => __( 'Styles was upgraded successfully', 'ultimate-member' ) ) );
}
function um_upgrade_cache2010() {
um_maybe_unset_time_limit();
UM()->user()->remove_cache_all_users();
update_option( 'um_last_version_upgrade', '2.0.10' );
wp_send_json_success( array( 'message' => __( 'Users cache was cleared successfully', 'ultimate-member' ) ) );
}
+6
View File
@@ -0,0 +1,6 @@
<?php
return array(
'styles2010' => 'styles2010',
'cache2010' => 'cache2010',
);
+54
View File
@@ -0,0 +1,54 @@
<?php ?>
<script type="text/javascript">
jQuery( document ).ready( function() {
//upgrade styles
um_add_upgrade_log( '<?php echo esc_js( __( 'Upgrade Styles...', 'ultimate-member' ) ) ?>' );
jQuery.ajax({
url: '<?php echo admin_url( 'admin-ajax.php' ) ?>',
type: 'POST',
dataType: 'json',
data: {
action: 'um_styles2010'
},
success: function( response ) {
if ( typeof response.data != 'undefined' ) {
um_add_upgrade_log( response.data.message );
um_clear_cache2010();
} else {
um_wrong_ajax();
}
},
error: function() {
um_something_wrong();
}
});
//clear users cache
function um_clear_cache2010() {
um_add_upgrade_log( '<?php echo esc_js( __( 'Clear Users Cache...', 'ultimate-member' ) ) ?>' );
jQuery.ajax({
url: '<?php echo admin_url( 'admin-ajax.php' ) ?>',
type: 'POST',
dataType: 'json',
data: {
action: 'um_cache2010'
},
success: function( response ) {
if ( typeof response.data != 'undefined' ) {
um_add_upgrade_log( response.data.message );
//switch to the next package
um_run_upgrade();
} else {
um_wrong_ajax();
}
},
error: function() {
um_something_wrong();
}
});
}
});
</script>
+89
View File
@@ -0,0 +1,89 @@
<?php
$css = '';
$custom_css = UM()->options()->get( 'custom_css' );
$enable_css = UM()->options()->get( 'enable_custom_css' );
if ( ! empty( $enable_css ) && ! empty( $custom_css ) ) {
$css .= $custom_css;
}
$forms_query = new WP_Query;
$registration_forms = $forms_query->query( array(
'post_type' => 'um_form',
'meta_query' => array(
array(
'key' => '_um_mode',
'value' => 'register'
),
),
'posts_per_page' => -1,
'fields' => 'ids'
) );
$forms_query = new WP_Query;
$login_forms = $forms_query->query( array(
'post_type' => 'um_form',
'meta_query' => array(
array(
'key' => '_um_mode',
'value' => 'login'
)
),
'posts_per_page' => -1,
'fields' => 'ids'
) );
$forms_query = new WP_Query;
$profile_forms = $forms_query->query( array(
'post_type' => 'um_form',
'meta_query' => array(
array(
'key' => '_um_mode',
'value' => 'profile'
)
),
'posts_per_page' => -1,
'fields' => 'ids'
) );
foreach ( $registration_forms as $form_id ) {
$register_custom_css = get_post_meta( $form_id, '_um_register_custom_css', true );
if ( ! empty( $register_custom_css ) ) {
$css .= '
/* registration form ID=' . $form_id . ' */
' . $register_custom_css;
}
}
foreach ( $login_forms as $form_id ) {
$login_custom_css = get_post_meta( $form_id, '_um_login_custom_css', true );
if ( ! empty( $login_custom_css ) ) {
$css .= '
/* login form ID=' . $form_id . ' */
' . $login_custom_css;
}
}
foreach ( $profile_forms as $form_id ) {
$profile_custom_css = get_post_meta( $form_id, '_um_profile_custom_css', true );
if ( ! empty( $profile_custom_css ) ) {
$css .= '
/* profile form ID=' . $form_id . ' */
' . $profile_custom_css;
}
}
if ( ! empty( $css ) ) {
$uploads = wp_upload_dir();
$upload_dir = $uploads['basedir'] . DIRECTORY_SEPARATOR . 'ultimatemember' . DIRECTORY_SEPARATOR;
if ( file_exists( $upload_dir. 'um_old_settings.css' ) ) {
$css_doc_file = fopen( $upload_dir. 'um_old_settings.css', 'a' );
fwrite( $css_doc_file, "\r\n" . $css );
fclose( $css_doc_file );
}
}