From 2ce01fcd4c1452169134bb00127bedc9b4e6ce26 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Thu, 24 May 2018 16:55:06 +0300 Subject: [PATCH 01/11] - upgrades request manual; --- includes/admin/class-admin.php | 20 +++++++++++++++++++ includes/admin/core/class-admin-menu.php | 15 ++++++++++++++ includes/admin/core/class-admin-notices.php | 8 ++++++++ .../templates/dashboard/upgrade-request.php | 6 ++++++ 4 files changed, 49 insertions(+) create mode 100644 includes/admin/templates/dashboard/upgrade-request.php diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 9eed2865..56267f35 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -35,6 +35,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) ); add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) ); + add_action( 'um_admin_do_action__manual_upgrades_request', array( &$this, 'manual_upgrades_request' ) ); add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) ); add_action( 'um_admin_do_action__um_language_downloader', array( &$this, 'um_language_downloader' ) ); add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) ); @@ -48,6 +49,25 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { } + function manual_upgrades_request() { + if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) { + die(); + } + + $last_request = get_option( 'um_last_manual_upgrades_request', false ); + + if ( empty( $last_request ) || time() > $last_request + DAY_IN_SECONDS ) { + UM()->plugin_updater()->um_checklicenses(); + + update_option( 'um_last_manual_upgrades_request', time() ); + + $url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'got_updates' ), admin_url( 'admin.php' ) ); + } else { + $url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'often_updates' ), admin_url( 'admin.php' ) ); + } + exit( wp_redirect( $url ) ); + } + /** * Clear all users cache diff --git a/includes/admin/core/class-admin-menu.php b/includes/admin/core/class-admin-menu.php index f42ad023..cbb68cfd 100644 --- a/includes/admin/core/class-admin-menu.php +++ b/includes/admin/core/class-admin-menu.php @@ -206,6 +206,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) { add_meta_box( 'um-metaboxes-mainbox-1', __( 'Latest from our blog', 'ultimate-member' ), array( &$this, 'um_news' ), $this->pagehook, 'normal', 'core' ); add_meta_box( 'um-metaboxes-sidebox-1', __( 'Purge Temp Files', 'ultimate-member' ), array( &$this, 'purge_temp' ), $this->pagehook, 'side', 'core' ); + add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' ); if ( $this->language_avaialable_not_installed() ) { @@ -215,6 +216,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) { } else if ( $this->language_not_available() ) { add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' ); } + + //If there are active and licensed extensions - show metabox for upgrade it + $exts = UM()->plugin_updater()->um_get_active_plugins(); + if ( 0 < count( $exts ) ) { + add_meta_box( 'um-metaboxes-sidebox-3', __( 'Upgrade\'s Manual Request', 'ultimate-member' ), array( &$this, 'upgrade_request' ), $this->pagehook, 'side', 'core' ); + } } @@ -269,6 +276,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) { } + /** + * + */ + function upgrade_request() { + include_once UM()->admin()->templates_path . 'dashboard/upgrade-request.php'; + } + + /** * */ diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index a26b409d..70b82f31 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -420,6 +420,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $messages[0]['content'] = __( 'Your user cache is now removed.', 'ultimate-member' ); break; + case 'got_updates': + $messages[0]['content'] = __( 'You got the latest upgrades.', 'ultimate-member' ); + break; + + case 'often_updates': + $messages[0]['err_content'] = __( 'Try again later. You can run this action once daily.', 'ultimate-member' ); + break; + case 'form_duplicated': $messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' ); break; diff --git a/includes/admin/templates/dashboard/upgrade-request.php b/includes/admin/templates/dashboard/upgrade-request.php new file mode 100644 index 00000000..f7c5bfcc --- /dev/null +++ b/includes/admin/templates/dashboard/upgrade-request.php @@ -0,0 +1,6 @@ +

+

+ + + +

\ No newline at end of file From 79ae9a91856993fb13cdda7f91629551b180a67d Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 25 May 2018 10:34:53 +0300 Subject: [PATCH 02/11] - fixed refresh of transient plugin upgrade options --- includes/admin/class-admin.php | 4 ++++ includes/admin/templates/dashboard/upgrade-request.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 56267f35..9ec0de53 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -57,6 +57,10 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { $last_request = get_option( 'um_last_manual_upgrades_request', false ); if ( empty( $last_request ) || time() > $last_request + DAY_IN_SECONDS ) { + + delete_transient( 'update_plugins' ); + delete_site_transient( 'update_plugins' ); + UM()->plugin_updater()->um_checklicenses(); update_option( 'um_last_manual_upgrades_request', time() ); diff --git a/includes/admin/templates/dashboard/upgrade-request.php b/includes/admin/templates/dashboard/upgrade-request.php index f7c5bfcc..b1af5c84 100644 --- a/includes/admin/templates/dashboard/upgrade-request.php +++ b/includes/admin/templates/dashboard/upgrade-request.php @@ -1,6 +1,6 @@

- +

\ No newline at end of file From 4000dca515ae065ef7dd807f1425dea00ad82a9a Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 25 May 2018 15:05:14 +0300 Subject: [PATCH 03/11] - fixed wp_mail text/plain and text/html headers; - fixed profile tabs without icons at mobile devices; --- assets/css/um-profile.css | 2 +- includes/core/class-account.php | 1 - includes/core/class-fields.php | 2 +- includes/core/class-mail.php | 24 ++++++------------------ includes/core/um-actions-register.php | 16 +++++++++++++++- includes/core/um-navmenu.php | 2 +- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/assets/css/um-profile.css b/assets/css/um-profile.css index 00a07b6a..1a316863 100644 --- a/assets/css/um-profile.css +++ b/assets/css/um-profile.css @@ -394,7 +394,7 @@ font-weight: normal; } .um-profile-nav-item.without-icon a {padding-left: 10px} -.um-profile-nav-item.without-icon span.title {padding-left: 0} +.um-profile-nav-item.without-icon span.title {display: inline;padding-left: 0;} .um-profile-nav-item.without-icon i {display: none} .um-profile-nav-item a:hover {background: #555} diff --git a/includes/core/class-account.php b/includes/core/class-account.php index 4b617404..a6fc0c67 100644 --- a/includes/core/class-account.php +++ b/includes/core/class-account.php @@ -751,7 +751,6 @@ if ( ! class_exists( 'um\core\Account' ) ) { * ?> */ do_action( "um_after_account_{$tab_id}", $args ); -// var_dump($args); if ( ! isset( $tab_data['show_button'] ) || false !== $tab_data['show_button'] ) { ?> diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index a146a9b7..40c2cb9e 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -2890,7 +2890,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $um_field_checkbox_item_title = $v; $option_value = $v; - if (!is_numeric( $k ) && in_array( $form_key, array( 'role' ) )) { + if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role', 'role_radio' ) ) ) { $um_field_checkbox_item_title = $v; $option_value = $k; } diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php index 330c8290..e92a208f 100644 --- a/includes/core/class-mail.php +++ b/includes/core/class-mail.php @@ -124,10 +124,14 @@ if ( ! class_exists( 'um\core\Mail' ) ) { $this->message = $this->prepare_template( $template, $args ); - add_filter( 'wp_mail_content_type', array( &$this, 'set_content_type' ) ); + if ( UM()->options()->get( 'email_html' ) ) { + $this->headers .= "Content-Type: text/html\r\n"; + } else { + $this->headers .= "Content-Type: text/plain\r\n"; + } + // Send mail wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments ); - remove_filter( 'wp_mail_content_type', array( &$this, 'set_content_type' ) ); } @@ -481,22 +485,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) { } - /** - * Set email content type - * - * - * @param $content_type - * @return string - */ - function set_content_type( $content_type ) { - if ( UM()->options()->get( 'email_html' ) ) { - return 'text/html'; - } else { - return 'text/plain'; - } - } - - /** * Ajax copy template to the theme * diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index 3abc44ed..e59f6040 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -726,4 +726,18 @@ function um_registration_set_profile_full_name( $user_id, $args ) { */ do_action( 'um_update_profile_full_name', $user_id, $args ); } -add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_full_name', 10, 2 ); \ No newline at end of file +add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_full_name', 10, 2 ); + + +/** + * Redirect from default registration to UM registration page + */ +function um_form_register_redirect() { + $page_id = UM()->options()->get( UM()->options()->get_core_page_id( 'register' ) ); + $register_post = get_post( $page_id ); + if ( ! empty( $register_post ) ) { + wp_safe_redirect( get_permalink( $page_id ) ); + exit(); + } +} +add_action( 'login_form_register', 'um_form_register_redirect', 10 ); \ No newline at end of file diff --git a/includes/core/um-navmenu.php b/includes/core/um-navmenu.php index 214e3258..00b4a8a1 100644 --- a/includes/core/um-navmenu.php +++ b/includes/core/um-navmenu.php @@ -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 ); From 224b869541ed7bff3e452c85b5437399d2001599 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 25 May 2018 18:22:38 +0300 Subject: [PATCH 04/11] - fixed user status setup on registration process; --- includes/core/class-form.php | 3 ++- includes/core/class-user.php | 30 ++++++++++++++++----------- includes/core/um-actions-register.php | 28 +++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/includes/core/class-form.php b/includes/core/class-form.php index 9b5ff609..7c0c1db6 100644 --- a/includes/core/class-form.php +++ b/includes/core/class-form.php @@ -465,8 +465,9 @@ if ( ! class_exists( 'um\core\Form' ) ) { $global_role = get_option( 'default_role' ); // WP Global settings $um_global_role = UM()->options()->get( 'register_role' ); // UM Settings Global settings - if ( ! empty( $um_global_role ) ) + if ( ! empty( $um_global_role ) ) { $global_role = $um_global_role; // Form Global settings + } $mode = $this->form_type( $post_id ); diff --git a/includes/core/class-user.php b/includes/core/class-user.php index a449366c..28cff8f4 100644 --- a/includes/core/class-user.php +++ b/includes/core/class-user.php @@ -1661,23 +1661,29 @@ if ( ! class_exists( 'um\core\User' ) ) { } } + + // update user if ( count( $args ) > 1 ) { - global $wp_roles; - $um_roles = get_option( 'um_roles' ); - if ( ! empty( $um_roles ) ) { - $role_keys = array_map( function( $item ) { - return 'um_' . $item; - }, get_option( 'um_roles' ) ); - } else { - $role_keys = array(); - } + //if isset roles argument validate role to properly for security reasons + if ( isset( $args['role'] ) ) { + global $wp_roles; + $um_roles = get_option( 'um_roles' ); - $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) ); + if ( ! empty( $um_roles ) ) { + $role_keys = array_map( function( $item ) { + return 'um_' . $item; + }, get_option( 'um_roles' ) ); + } else { + $role_keys = array(); + } - if ( isset( $args['role'] ) && in_array( $args['role'], $exclude_roles ) ) { - unset( $args['role'] ); + $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) ); + + if ( in_array( $args['role'], $exclude_roles ) ) { + unset( $args['role'] ); + } } wp_update_user( $args ); diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index e59f6040..addab9b4 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -55,7 +55,7 @@ function um_after_insert_user( $user_id, $args ) { UM()->user()->remove_cached_queue(); um_fetch_user( $user_id ); - UM()->user()->set_status( um_user('status') ); + UM()->user()->set_status( um_user( 'status' ) ); if ( ! empty( $args['submitted'] ) ) { UM()->user()->set_registration_details( $args['submitted'] ); } @@ -369,6 +369,30 @@ function um_submit_form_register( $args ) { $args['submitted'] = array_merge( $args['submitted'], $credentials ); $args = array_merge( $args, $credentials ); + //get user role from global or form's settings + $user_role = UM()->form()->assigned_role( UM()->form()->form_id ); + + //get user role from field Role dropdown or radio + if ( isset( $args['role'] ) ) { + global $wp_roles; + $um_roles = get_option( 'um_roles' ); + + if ( ! empty( $um_roles ) ) { + $role_keys = array_map( function( $item ) { + return 'um_' . $item; + }, get_option( 'um_roles' ) ); + } else { + $role_keys = array(); + } + + $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) ); + + //if role is properly set it + if ( ! in_array( $args['role'], $exclude_roles ) ) { + $user_role = $args['role']; + } + } + /** * UM hook * @@ -391,7 +415,7 @@ function um_submit_form_register( $args ) { * } * ?> */ - $user_role = apply_filters( 'um_registration_user_role', UM()->form()->assigned_role( UM()->form()->form_id ), $args ); + $user_role = apply_filters( 'um_registration_user_role', $user_role, $args ); $userdata = array( 'user_login' => $user_login, From 2864426fbce44d5e0829c715506767d0fa7f4eb1 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 25 May 2018 18:23:22 +0300 Subject: [PATCH 05/11] - changed version; --- ultimate-member.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ultimate-member.php b/ultimate-member.php index 62721747..2197a574 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress -Version: 2.0.16 +Version: 2.0.17-alpha1 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member From c503c05a43b288c160755b17891756da6d3c3970 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Mon, 28 May 2018 14:41:15 +0300 Subject: [PATCH 06/11] - fixed PHP memory limit error after upgrade; --- includes/admin/core/class-admin-upgrade.php | 40 ++++++++++++++++--- .../packages/2.0-beta1/email_templates.php | 4 +- includes/class-init.php | 3 +- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/includes/admin/core/class-admin-upgrade.php b/includes/admin/core/class-admin-upgrade.php index e48cb7c9..406431c8 100644 --- a/includes/admin/core/class-admin-upgrade.php +++ b/includes/admin/core/class-admin-upgrade.php @@ -17,6 +17,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) { class Admin_Upgrade { + /** + * @var null + */ + protected static $instance = null; + + /** * @var */ @@ -31,6 +37,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) { var $packages_dir; + /** + * Main Admin_Upgrade Instance + * + * Ensures only one instance of UM is loaded or can be loaded. + * + * @since 1.0 + * @static + * @see UM() + * @return Admin_Upgrade - Main instance + */ + static public function instance() { + if ( is_null( self::$instance ) ) { + self::$instance = new self(); + } + + return self::$instance; + } + + /** * Admin_Upgrade constructor. */ @@ -39,11 +64,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) { $this->necessary_packages = $this->need_run_upgrades(); if ( ! empty( $this->necessary_packages ) ) { - $this->init_packages_ajax(); add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 ); - add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) ); - add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) ); + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { + $this->init_packages_ajax(); + + add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) ); + add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) ); + } } //add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) ); @@ -143,7 +171,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) { foreach ( $this->necessary_packages as $package ) { $hooks_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'hooks.php'; if ( file_exists( $hooks_file ) ) { - $pack_ajax_hooks = include $hooks_file; + $pack_ajax_hooks = include_once $hooks_file; foreach ( $pack_ajax_hooks as $action => $function ) { add_action( 'wp_ajax_um_' . $action, "um_upgrade_$function" ); @@ -160,7 +188,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) { foreach ( $this->necessary_packages as $package ) { $handlers_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'functions.php'; if ( file_exists( $handlers_file ) ) { - include $handlers_file; + include_once $handlers_file; } } } @@ -290,7 +318,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) { exit(''); } else { ob_start(); - include $this->packages_dir . DIRECTORY_SEPARATOR . $_POST['pack'] . DIRECTORY_SEPARATOR . 'init.php'; + include_once $this->packages_dir . DIRECTORY_SEPARATOR . $_POST['pack'] . DIRECTORY_SEPARATOR . 'init.php'; ob_get_flush(); exit; } diff --git a/includes/admin/core/packages/2.0-beta1/email_templates.php b/includes/admin/core/packages/2.0-beta1/email_templates.php index 264c32dd..d30a3182 100644 --- a/includes/admin/core/packages/2.0-beta1/email_templates.php +++ b/includes/admin/core/packages/2.0-beta1/email_templates.php @@ -25,8 +25,8 @@ foreach ( $emails as $email_key => $value ) { } else { $setting_value = UM()->options()->get( $email_key ); - $fp = fopen( $theme_template_path, "w" ); - $result = fputs( $fp, $setting_value ); + $fp = @fopen( $theme_template_path, "w" ); + $result = @fputs( $fp, $setting_value ); fclose( $fp ); } } else { diff --git a/includes/class-init.php b/includes/class-init.php index 0e9f1fc3..0cc6f25d 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -637,7 +637,8 @@ if ( ! class_exists( 'UM' ) ) { */ function admin_upgrade() { if ( empty( $this->classes['admin_upgrade'] ) ) { - $this->classes['admin_upgrade'] = new um\admin\core\Admin_Upgrade(); + $this->classes['admin_upgrade'] = um\admin\core\Admin_Upgrade::instance(); + //$this->classes['admin_upgrade'] = new um\admin\core\Admin_Upgrade(); } return $this->classes['admin_upgrade']; } From efe91cff2aafe9ffa0ae1142cf4514227c8664a2 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Tue, 29 May 2018 22:24:37 +0300 Subject: [PATCH 07/11] - fixed profile tabs displaying on desktop/mobile; --- assets/css/um-profile.css | 30 +++++++++++++++++++----- includes/core/um-actions-profile.php | 34 ++++++++++++++++------------ 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/assets/css/um-profile.css b/assets/css/um-profile.css index 1a316863..e14b2721 100644 --- a/assets/css/um-profile.css +++ b/assets/css/um-profile.css @@ -393,13 +393,31 @@ font-weight: normal; border-bottom: 0 !important; } -.um-profile-nav-item.without-icon a {padding-left: 10px} -.um-profile-nav-item.without-icon span.title {display: inline;padding-left: 0;} -.um-profile-nav-item.without-icon i {display: none} +.um-profile-nav-item.without-icon a { + padding-left: 10px; +} +.um-profile-nav-item.without-icon span.title { + padding-left: 0; +} +.um-profile-nav-item.without-icon i { + display: none; +} -.um-profile-nav-item a:hover {background: #555} -.um-profile-nav-item i {font-size: 18px;height: 18px;line-height: 18px;position: absolute;display: block;top: 8px;left: 10px} -.um-profile-nav-item span.title {padding-left: 5px} +.um-profile-nav-item a:hover { + background: #555; +} +.um-profile-nav-item i { + font-size: 18px; + height: 18px; + line-height: 18px; + position: absolute; + display: block; + top: 8px; + left: 10px; +} +.um-profile-nav-item span.title { + padding-left: 5px; +} .um-profile-nav-item span.count { font-size: 12px; font-weight: 300; diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 8d064021..4e035551 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -1377,40 +1377,46 @@ function um_profile_menu( $args ) { From 7a032a02d490632351fa4c83743767f9544ae76c Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Tue, 29 May 2018 22:35:57 +0300 Subject: [PATCH 08/11] - fixed issue https://wordpress.org/support/topic/corrections-for-core-um-actions-forms-php-um-v2-0-11/ --- includes/core/um-actions-form.php | 11 ++++++----- includes/core/um-filters-fields.php | 8 ++++---- ultimate-member.php | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index 8050be80..5cf15388 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -314,8 +314,9 @@ function um_submit_form_errors_hook_( $args ) { foreach ( $array['conditions'] as $condition ) { list( $visibility, $parent_key, $op, $parent_value ) = $condition; - if ( ! isset( $args[ $parent_key ] ) ) + if ( ! isset( $args[ $parent_key ] ) ) { continue; + } $cond_value = ( $fields[ $parent_key ]['type'] == 'radio' ) ? $args[ $parent_key ][0] : $args[ $parent_key ]; @@ -337,11 +338,11 @@ function um_submit_form_errors_hook_( $args ) { continue 2; } } elseif ( $op == 'greater than' ) { - if ( $cond_value > $op ) { + if ( $cond_value > $parent_value ) { continue 2; } } elseif ( $op == 'less than' ) { - if ( $cond_value < $op ) { + if ( $cond_value < $parent_value ) { continue 2; } } elseif ( $op == 'contains' ) { @@ -367,11 +368,11 @@ function um_submit_form_errors_hook_( $args ) { continue 2; } } elseif ( $op == 'greater than' ) { - if ( $cond_value <= $op ) { + if ( $cond_value <= $parent_value ) { continue 2; } } elseif ( $op == 'less than' ) { - if ( $cond_value >= $op ) { + if ( $cond_value >= $parent_value ) { continue 2; } } elseif ( $op == 'contains' ) { diff --git a/includes/core/um-filters-fields.php b/includes/core/um-filters-fields.php index 7f55479e..4a2f59bf 100644 --- a/includes/core/um-filters-fields.php +++ b/includes/core/um-filters-fields.php @@ -392,11 +392,11 @@ function um_get_custom_field_array( $array, $fields ) { $array['required'] = 0; } } elseif ( $op == 'greater than' ) { - if ( $cond_value > $op ) { + if ( $cond_value > $parent_value ) { $array['required'] = 0; } } elseif ( $op == 'less than' ) { - if ( $cond_value < $op ) { + if ( $cond_value < $parent_value ) { $array['required'] = 0; } } elseif ( $op == 'contains' ) { @@ -422,11 +422,11 @@ function um_get_custom_field_array( $array, $fields ) { $array['required'] = 0; } } elseif ( $op == 'greater than' ) { - if ( $cond_value <= $op ) { + if ( $cond_value <= $parent_value ) { $array['required'] = 0; } } elseif ( $op == 'less than' ) { - if ( $cond_value >= $op ) { + if ( $cond_value >= $parent_value ) { $array['required'] = 0; } } elseif ( $op == 'contains' ) { diff --git a/ultimate-member.php b/ultimate-member.php index 2197a574..66dd3889 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress -Version: 2.0.17-alpha1 +Version: 2.0.17-alpha2 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member From e855cf6f50b1cc89597153ebdea13200d27da370 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Wed, 30 May 2018 11:24:43 +0300 Subject: [PATCH 09/11] - 2.0.17 release --- README.md | 4 ++-- readme.txt | 14 +++++++++++++- ultimate-member.php | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bd1584de..2084e86e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Ultimate Member is the #1 user profile & membership plugin for WordPress. The pl | Latest Version |Requires at least|Stable Tag| | :------------: |:------------:|:------------:| -| 2.0.16 | WordPress 4.9 or higher| 2.0.16 | +| 2.0.17 | WordPress 4.9 or higher| 2.0.17 | Features of the plugin include: @@ -48,7 +48,7 @@ GNU Version 2 or Any Later Version Releases ==================== -[Official Release Version: 2.0.16](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.16). +[Official Release Version: 2.0.17](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.17). [Official Release Version: 1.3.88](https://github.com/ultimatemember/ultimatemember/releases). diff --git a/readme.txt b/readme.txt index 632d11ff..dd56c229 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ Donate link: Tags: community, member, membership, user-profile, user-registration Requires at least: 4.1 Tested up to: 4.9 -Stable tag: 2.0.15 +Stable tag: 2.0.17 License: GNU Version 2 or Any Later Version License URI: http://www.gnu.org/licenses/gpl-3.0.txt @@ -131,6 +131,18 @@ The plugin works with popular caching plugins by automatically excluding Ultimat = Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin = += 2.0.17: May 30, 2018 = + +* Enhancements: + - Added UM dashboard widget for getting latest extension's upgrades + +* Bugfixes: + - Fixed User Profile restriction when user isn't logged in + - Fixed Profile Tabs dispalying on desktop/mobile + - Fixed set user status after registration on some installs + - Fixed PHP memory limit issue on some installs with small PHP memory limit + - Fixed PHP validation on submit UM Forms with conditional fields logic + = 2.0.16: May 23, 2018 = * Bugfixes: diff --git a/ultimate-member.php b/ultimate-member.php index 66dd3889..eb040a25 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress -Version: 2.0.17-alpha2 +Version: 2.0.17 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member From c31aae6e735c68bd30c008281a2fd8bbe50d4b5b Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Wed, 30 May 2018 12:37:42 +0300 Subject: [PATCH 10/11] + --- readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index dd56c229..9eb1d6fd 100644 --- a/readme.txt +++ b/readme.txt @@ -137,8 +137,8 @@ The plugin works with popular caching plugins by automatically excluding Ultimat - Added UM dashboard widget for getting latest extension's upgrades * Bugfixes: - - Fixed User Profile restriction when user isn't logged in - - Fixed Profile Tabs dispalying on desktop/mobile + - Fixed User Profile restriction when the user isn't logged in + - Fixed Profile Tabs displaying on desktop/mobile - Fixed set user status after registration on some installs - Fixed PHP memory limit issue on some installs with small PHP memory limit - Fixed PHP validation on submit UM Forms with conditional fields logic From d4188290d3d0b4dcab98ee3a606b6499a81fff5a Mon Sep 17 00:00:00 2001 From: yura_nalivaiko Date: Wed, 30 May 2018 12:50:38 +0300 Subject: [PATCH 11/11] fixed user_query --- includes/core/um-filters-members.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/um-filters-members.php b/includes/core/um-filters-members.php index 3f780466..e4ea86df 100644 --- a/includes/core/um-filters-members.php +++ b/includes/core/um-filters-members.php @@ -211,7 +211,7 @@ function um_add_search_to_query( $query_args, $args ){ */ $query_args = apply_filters( 'um_query_args_filter', $query_args ); - if ( count( $query_args['meta_query'] ) == 1 ) + if ( isset( $query_args['meta_query'] ) && count( $query_args['meta_query'] ) == 1 ) unset( $query_args['meta_query'] ); return $query_args;