This commit is contained in:
yura_nalivaiko
2018-04-24 16:58:45 +03:00
15 changed files with 213 additions and 18 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 );
}
}
+4 -2
View File
@@ -524,8 +524,9 @@ if ( ! class_exists( 'um\core\Access' ) ) {
*/
function get_post_privacy_settings( $post ) {
//if logged in administrator all pages are visible
if ( current_user_can( 'administrator' ) )
if ( current_user_can( 'administrator' ) ) {
return false;
}
//exlude from privacy UM default pages (except Members list and User(Profile) page)
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
@@ -541,7 +542,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
$restriction = get_post_meta( $post->ID, 'um_content_restriction', true );
if ( ! empty( $restriction['_um_custom_access_settings'] ) ) {
if ( ! isset( $restriction['_um_accessible'] ) || '0' == $restriction['_um_accessible'] )
if ( ! isset( $restriction['_um_accessible'] ) )
return false;
else
return $restriction;
@@ -624,6 +625,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
//post is private
if ( '0' == $restriction['_um_accessible'] ) {
$this->singular_page = true;
$filtered_posts[] = $post;
continue;
} elseif ( '1' == $restriction['_um_accessible'] ) {
+11 -4
View File
@@ -506,13 +506,20 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
* @return mixed|void
*/
function role_data( $roleID ) {
if ( strpos( $roleID, 'um_' ) === 0 )
$roleID = substr( $roleID, 3 );
if ( strpos( $roleID, 'um_' ) === 0 ) {
$role_data = get_option( "um_role_{$roleID}_meta" );
$role_data = get_option( "um_role_{$roleID}_meta" );
if ( ! $role_data ) {
$roleID = substr( $roleID, 3 );
$role_data = get_option( "um_role_{$roleID}_meta" );
}
} else {
$role_data = get_option( "um_role_{$roleID}_meta" );
}
if ( ! $role_data )
if ( ! $role_data ) {
return array();
}
$temp = array();
foreach ( $role_data as $key=>$value ) {
+5 -2
View File
@@ -510,8 +510,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
extract($args, EXTR_SKIP);
if ( 'register' == $mode && is_user_logged_in() ) {
return __( 'You are already registered', 'ultimate-member' );
//not display on admin preview
if ( empty( $_POST['act_id'] ) || $_POST['act_id'] != 'um_admin_preview_form' ) {
if ( 'register' == $mode && is_user_logged_in() ) {
return __( 'You are already registered', 'ultimate-member' );
}
}
// for profiles only
+1 -1
View File
@@ -376,7 +376,7 @@ add_action( 'um_account_page_hidden_fields', 'um_account_page_hidden_fields' );
* Before delete account tab content
*/
function um_before_account_delete() {
echo wpautop( UM()->options()->get( 'delete_account_text' ) );
echo wpautop( htmlspecialchars( UM()->options()->get( 'delete_account_text' ) ) );
}
add_action( 'um_before_account_delete', 'um_before_account_delete' );
+1 -1
View File
@@ -601,7 +601,7 @@ function um_profile_header_cover_area( $args ) {
echo $overlay; ?>
<div class="um-cover-e">
<div class="um-cover-e" data-ratio="<?php echo $args['cover_ratio']; ?>">
<?php if (um_profile( 'cover_photo' )) { ?>