From f06e9cce0d6e58811f0d0780c0f4d2502758e280 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 13 Apr 2018 15:08:00 +0300 Subject: [PATCH] - fixed registration and profile form roles (some sites empty profile + wrong registration roles); --- includes/core/class-shortcodes.php | 9 ++++++--- includes/core/um-actions-register.php | 2 +- readme.txt | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php index c19853cb..28ef2e5b 100644 --- a/includes/core/class-shortcodes.php +++ b/includes/core/class-shortcodes.php @@ -516,9 +516,12 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { // for profiles only if ( $mode == 'profile' && um_profile_id() ) { - $current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() ); - if ( ! empty( $args['role'] ) && ! in_array( $args['role'], $current_user_roles ) ) { - return ''; + $use_custom = get_post_meta( $this->form_id, "_um_{$mode}_use_custom_settings", true ); + if ( $use_custom ) { // Custom Form settings + $current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() ); + if ( ! empty( $args['role'] ) && ! in_array( $args['role'], $current_user_roles ) ) { + return ''; + } } } diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index aeb5a53a..eadb0383 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -440,7 +440,7 @@ function um_add_user_role( $args ) { $role = apply_filters( 'um_registration_user_role', UM()->form()->assigned_role( UM()->form()->form_id ), $args ); - if ( empty( $role ) ) return; + if ( empty( $use_custom_settings ) || empty( $role ) ) return; /** * UM hook diff --git a/readme.txt b/readme.txt index 2fb2539c..98352a6f 100644 --- a/readme.txt +++ b/readme.txt @@ -129,10 +129,11 @@ The plugin works with popular caching plugins by automatically excluding Ultimat == Changelog == -= 2.0.7: xxxx, 2018 = += 2.0.7: April 13, 2018 = * Bugfixes: - Fixed add rewrite rules for UM pages + - Fixed Profile Form, Registration Form use custom settings and role = 2.0.6: April 12, 2018 =