From 0ee8878f90e754c8fd85e6444f152046b5073600 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Wed, 9 Dec 2020 11:13:25 +0200 Subject: [PATCH 01/12] - rename version; --- ultimate-member.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ultimate-member.php b/ultimate-member.php index 488c3515..d948a57d 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.1.13 +Version: 2.1.14-alpha1 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member From 1adc51aa021f2f13ba1beea70fd5382bea453de2 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Mon, 14 Dec 2020 14:39:47 +0200 Subject: [PATCH 02/12] - fixed displaying by the hook issues with fields without metakeys; --- includes/core/class-fields.php | 41 +++++++++++++++++++++++++++------ includes/core/class-profile.php | 5 +++- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 33ed449a..adde5f0e 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -568,7 +568,13 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $label = apply_filters( 'um_edit_label_all_fields', $label, $data ); } - $output .= ''; + $fields_without_metakey = UM()->builtin()->get_fields_without_metakey(); + $for_attr = ''; + if ( ! in_array( $data['type'], $fields_without_metakey ) ) { + $for_attr = ' for="' . esc_attr( $key . UM()->form()->form_suffix ) . '"'; + } + + $output .= '' . __( $label, 'ultimate-member' ) . ''; if ( ! empty( $data['help'] ) && $this->viewing == false && ! strstr( $key, 'confirm_user_pass' ) ) { @@ -1443,7 +1449,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $array['conditional'] = null; } - $array['classes'] .= ' um-field-' . esc_attr( $key ); + $fields_without_metakey = UM()->builtin()->get_fields_without_metakey(); + + if ( ! in_array( $array['type'], $fields_without_metakey ) ) { + $array['classes'] .= ' um-field-' . esc_attr( $key ); + } $array['classes'] .= ' um-field-' . esc_attr( $array['type'] ); $array['classes'] .= ' um-field-type_' . esc_attr( $array['type'] ); @@ -4059,9 +4069,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $_field_value = $this->field_value( $key, $default, $data ); - if ( ! isset( $_field_value ) || $_field_value == '' ) { + if ( ! in_array( $type, $fields_without_metakey ) && ( ! isset( $_field_value ) || $_field_value == '' ) ) { $output = ''; } else { + $output .= '
get_atts( $key, $classes, $conditional, $data ) . '>'; if ( isset( $data['label'] ) || ! empty( $data['icon'] ) ) { @@ -4126,11 +4137,20 @@ if ( ! class_exists( 'um\core\Fields' ) ) { */ $res = apply_filters( "um_view_field_value_{$type}", $res, $data ); - $output .= '
'; - $output .= '
' . $res . '
'; - $output .= '
'; + $id_attr = ''; + if ( ! in_array( $type, $fields_without_metakey ) ) { + $id_attr = ' id="' . esc_attr( $key . UM()->form()->form_suffix ) . '"'; + } - $output .= '
'; + if ( empty( $res ) ) { + $output = ''; + } else { + $output .= '
'; + $output .= '
' . $res . '
'; + $output .= '
'; + + $output .= ''; + } } break; @@ -4665,6 +4685,13 @@ if ( ! class_exists( 'um\core\Fields' ) ) { ) ); + $fields_without_metakey = UM()->builtin()->get_fields_without_metakey(); + + if ( in_array( $data['type'], $fields_without_metakey ) ) { + unset( $field_atts['id'] ); + unset( $field_atts['data-key'] ); + } + if ( ! empty( $field_style ) && is_array( $field_style ) ) { $arr_inline_style = ''; diff --git a/includes/core/class-profile.php b/includes/core/class-profile.php index 84d6e205..1cffe05c 100644 --- a/includes/core/class-profile.php +++ b/includes/core/class-profile.php @@ -385,6 +385,8 @@ if ( ! class_exists( 'um\core\Profile' ) ) { function show_meta( $array ) { $output = ''; + $fields_without_metakey = UM()->builtin()->get_fields_without_metakey(); + if ( ! empty( $array ) ) { foreach ( $array as $key ) { if ( $key ) { @@ -396,8 +398,9 @@ if ( ! class_exists( 'um\core\Profile' ) ) { $data['in_profile_meta'] = true; $value = um_filtered_value( $key, $data ); - if ( ! $value ) + if ( ! $value && ! in_array( $data['type'], $fields_without_metakey ) ) { continue; + } if ( ! UM()->options()->get( 'profile_show_metaicon' ) ) { $icon = ''; From 03f2baf61ae290aaac2bfddc6e331e6168454bad Mon Sep 17 00:00:00 2001 From: andrewshuba Date: Tue, 15 Dec 2020 14:16:26 +0200 Subject: [PATCH 03/12] - add administrator user role to a restriction setting --- includes/admin/core/class-admin-metabox.php | 2 +- includes/admin/templates/access/restrict_content.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index 8773ee3b..02fa0f10 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -558,7 +558,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { 'label' => __( 'Select which roles can access this content', 'ultimate-member' ), 'description' => __( 'Activate content restriction for this post', 'ultimate-member' ), 'value' => $_um_access_roles_value, - 'options' => UM()->roles()->get_roles( false, array( 'administrator' ) ), + 'options' => UM()->roles()->get_roles( false ), 'columns' => 3, 'conditional' => array( '_um_accessible', '=', '2' ) ), diff --git a/includes/admin/templates/access/restrict_content.php b/includes/admin/templates/access/restrict_content.php index 170e8eb9..ce0d62c1 100644 --- a/includes/admin/templates/access/restrict_content.php +++ b/includes/admin/templates/access/restrict_content.php @@ -73,7 +73,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; 'label' => __( 'Select which roles can access this content', 'ultimate-member' ), 'tooltip' => __( 'Activate content restriction for this post', 'ultimate-member' ), 'value' => $_um_access_roles_value, - 'options' => UM()->roles()->get_roles( false, array( 'administrator' ) ), + 'options' => UM()->roles()->get_roles( false ), 'columns' => 3, 'conditional' => array( '_um_accessible', '=', '2' ) ), From 43a8e7e3d53628c632970e04f035d8d692a69f24 Mon Sep 17 00:00:00 2001 From: Champ Camba Date: Wed, 16 Dec 2020 11:52:07 +0800 Subject: [PATCH 04/12] Add third parameter $args to the action hook for Profile Tab redirections There was an issue with attaching the Profile tab redirection to `um_after_user_updated` because the file couldn't upload in a custom tab because it doesn't reach the `UM()->uploader()->move_temporary_files` after saving the profile with uploaded files and images. Attaching it to `um_user_after_updating_profile` resolves the issue. --- includes/core/um-actions-profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 67826f1b..b81ef5a6 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -536,7 +536,7 @@ function um_user_edit_profile( $args ) { * } * ?> */ - do_action( 'um_user_after_updating_profile', $to_update, $user_id ); + do_action( 'um_user_after_updating_profile', $to_update, $user_id, $args ); /** * UM hook From 41350e139111463702dbcbcf1c63e24a2d1f1d13 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Wed, 16 Dec 2020 13:37:13 +0200 Subject: [PATCH 05/12] - fixed PHP notices when there aren't UM custom roles and we get bool variable from get_option( 'um_roles' ); --- includes/admin/core/class-admin-enqueue.php | 2 +- .../core/list-tables/roles-list-table.php | 4 ++-- includes/admin/templates/role/role-edit.php | 2 +- includes/core/class-builtin.php | 2 +- includes/core/class-fields.php | 4 ++-- includes/core/class-roles-capabilities.php | 20 +++++++++++-------- includes/core/class-user.php | 6 +++--- includes/core/um-actions-profile.php | 6 +++--- includes/core/um-actions-register.php | 4 ++-- uninstall.php | 2 +- 10 files changed, 28 insertions(+), 24 deletions(-) diff --git a/includes/admin/core/class-admin-enqueue.php b/includes/admin/core/class-admin-enqueue.php index efb1cc0b..4d1ce960 100644 --- a/includes/admin/core/class-admin-enqueue.php +++ b/includes/admin/core/class-admin-enqueue.php @@ -173,7 +173,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { */ function load_role_wrapper() { wp_register_script( 'um_admin_role_wrapper', $this->js_url . 'um-admin-role-wrapper.js', array( 'jquery' ), ultimatemember_version, true ); - $localize_roles_data = get_option( 'um_roles' ); + $localize_roles_data = get_option( 'um_roles', array() ); wp_localize_script( 'um_admin_role_wrapper', 'um_roles', (array) $localize_roles_data ); wp_enqueue_script( 'um_admin_role_wrapper' ); } diff --git a/includes/admin/core/list-tables/roles-list-table.php b/includes/admin/core/list-tables/roles-list-table.php index 00b25ff2..31e94f5e 100644 --- a/includes/admin/core/list-tables/roles-list-table.php +++ b/includes/admin/core/list-tables/roles-list-table.php @@ -27,7 +27,7 @@ if ( isset( $_GET['action'] ) ) { um_js_redirect( $redirect ); } - $um_roles = get_option( 'um_roles' ); + $um_roles = get_option( 'um_roles', array() ); $um_custom_roles = array(); foreach ( $role_keys as $k => $role_key ) { @@ -426,7 +426,7 @@ $ListTable->set_sortable_columns( array( $users_count = count_users(); $roles = array(); -$role_keys = get_option( 'um_roles' ); +$role_keys = get_option( 'um_roles', array() ); if ( $role_keys ) { foreach ( $role_keys as $role_key ) { diff --git a/includes/admin/templates/role/role-edit.php b/includes/admin/templates/role/role-edit.php index ced3cbd0..497b2bd8 100644 --- a/includes/admin/templates/role/role-edit.php +++ b/includes/admin/templates/role/role-edit.php @@ -117,7 +117,7 @@ if ( ! empty( $_POST['role'] ) ) { if ( '' == $error ) { if ( 'add' == sanitize_key( $_GET['tab'] ) ) { - $roles = get_option( 'um_roles' ); + $roles = get_option( 'um_roles', array() ); $roles[] = $id; update_option( 'um_roles', $roles ); diff --git a/includes/core/class-builtin.php b/includes/core/class-builtin.php index ed11148d..7f279366 100644 --- a/includes/core/class-builtin.php +++ b/includes/core/class-builtin.php @@ -633,7 +633,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { function set_predefined_fields() { global $wp_roles; - $role_keys = get_option( 'um_roles' ); + $role_keys = get_option( 'um_roles', array() ); if ( ! empty( $role_keys ) && is_array( $role_keys ) ) { $role_keys = array_map( function( $item ) { return 'um_' . $item; diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 33ed449a..749df4a8 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -978,7 +978,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { if ( strstr( $key, 'role_' ) || $key == 'role' ) { $field_value = strtolower( UM()->roles()->get_editable_priority_user_role( um_user( 'ID' ) ) ); - $role_keys = get_option( 'um_roles' ); + $role_keys = get_option( 'um_roles', array() ); if ( ! empty( $role_keys ) ) { if ( in_array( $field_value, $role_keys ) ) { @@ -1125,7 +1125,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { if ( strstr( $key, 'role_' ) || $key == 'role' ) { $um_user_value = strtolower( UM()->roles()->get_editable_priority_user_role( um_user( 'ID' ) ) ); - $role_keys = get_option( 'um_roles' ); + $role_keys = get_option( 'um_roles', array() ); if ( ! empty( $role_keys ) ) { if ( in_array( $um_user_value, $role_keys ) ) { diff --git a/includes/core/class-roles-capabilities.php b/includes/core/class-roles-capabilities.php index 60102c26..45264c6a 100644 --- a/includes/core/class-roles-capabilities.php +++ b/includes/core/class-roles-capabilities.php @@ -126,10 +126,11 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) { */ function is_role_custom( $role ) { // User has roles so look for a UM Role one - $role_keys = get_option( 'um_roles' ); + $role_keys = get_option( 'um_roles', array() ); - if ( empty( $role_keys ) ) + if ( empty( $role_keys ) ) { return false; + } $role_keys = array_map( function( $item ) { return 'um_' . $item; @@ -385,7 +386,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) { return false; // User has roles so look for a UM Role one - $um_roles_keys = get_option( 'um_roles' ); + $um_roles_keys = get_option( 'um_roles', array() ); if ( ! empty( $um_roles_keys ) ) { $um_roles_keys = array_map( function( $item ) { @@ -453,7 +454,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) { return false; // User has roles so look for a UM Role one - $um_roles_keys = get_option( 'um_roles' ); + $um_roles_keys = get_option( 'um_roles', array() ); if ( ! empty( $um_roles_keys ) ) { $um_roles_keys = array_map( function( $item ) { @@ -495,15 +496,17 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) { */ function get_um_user_role( $user_id ) { // User has roles so look for a UM Role one - $um_roles_keys = get_option( 'um_roles' ); + $um_roles_keys = get_option( 'um_roles', array() ); - if ( empty( $um_roles_keys ) ) + if ( empty( $um_roles_keys ) ) { return false; + } $user = get_userdata( $user_id ); - if ( empty( $user->roles ) ) + if ( empty( $user->roles ) ) { return false; + } $um_roles_keys = array_map( function( $item ) { return 'um_' . $item; @@ -511,8 +514,9 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) { $user_um_roles_array = array_intersect( $um_roles_keys, array_values( $user->roles ) ); - if ( empty( $user_um_roles_array ) ) + if ( empty( $user_um_roles_array ) ) { return false; + } return array_shift( $user_um_roles_array ); } diff --git a/includes/core/class-user.php b/includes/core/class-user.php index 08b31861..dc35f97d 100644 --- a/includes/core/class-user.php +++ b/includes/core/class-user.php @@ -729,7 +729,7 @@ if ( ! class_exists( 'um\core\User' ) ) { public function secondary_role_field( $content, $userdata ) { $roles = array(); - $role_keys = get_option( 'um_roles' ); + $role_keys = get_option( 'um_roles', array() ); if ( $role_keys ) { foreach ( $role_keys as $role_key ) { $role_meta = get_option( "um_role_{$role_key}_meta" ); @@ -1858,12 +1858,12 @@ if ( ! class_exists( 'um\core\User' ) ) { //if isset roles argument validate role to properly for security reasons if ( isset( $args['role'] ) ) { global $wp_roles; - $um_roles = get_option( 'um_roles' ); + $um_roles = get_option( 'um_roles', array() ); if ( ! empty( $um_roles ) ) { $role_keys = array_map( function( $item ) { return 'um_' . $item; - }, get_option( 'um_roles' ) ); + }, $um_roles ); } else { $role_keys = array(); } diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 67826f1b..61aa7572 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -380,7 +380,7 @@ function um_user_edit_profile( $args ) { global $wp_roles; $role_keys = array_map( function( $item ) { return 'um_' . $item; - }, get_option( 'um_roles' ) ); + }, get_option( 'um_roles', array() ) ); $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) ); if ( ! in_array( $args['submitted']['role'], $exclude_roles ) ) { @@ -400,7 +400,7 @@ function um_user_edit_profile( $args ) { global $wp_roles; $role_keys = array_map( function( $item ) { return 'um_' . $item; - }, get_option( 'um_roles' ) ); + }, get_option( 'um_roles', array() ) ); $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) ); if ( ! in_array( $args['submitted']['role'], $exclude_roles ) ) { @@ -598,7 +598,7 @@ function um_restore_default_roles( $user_id, $args, $to_update ) { $role_keys = array_map( function( $item ) { return 'um_' . $item; - }, get_option( 'um_roles' ) ); + }, get_option( 'um_roles', array() ) ); $leave_roles = array_diff( $args['roles_before_upgrade'], array_merge( $role_keys, array( 'subscriber' ) ) ); diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index 7ef63bd5..7277d24c 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -400,12 +400,12 @@ function um_submit_form_register( $args ) { //get user role from field Role dropdown or radio if ( isset( $args['role'] ) ) { global $wp_roles; - $um_roles = get_option( 'um_roles' ); + $um_roles = get_option( 'um_roles', array() ); if ( ! empty( $um_roles ) ) { $role_keys = array_map( function( $item ) { return 'um_' . $item; - }, get_option( 'um_roles' ) ); + }, $um_roles ); } else { $role_keys = array(); } diff --git a/uninstall.php b/uninstall.php index 0a48b647..b87c6086 100644 --- a/uninstall.php +++ b/uninstall.php @@ -69,7 +69,7 @@ if ( ! empty( $delete_options ) ) { } //remove user role meta - $role_keys = get_option( 'um_roles' ); + $role_keys = get_option( 'um_roles', array() ); if ( $role_keys ) { foreach ( $role_keys as $role_key ) { delete_option( 'um_role_' . $role_key . '_meta' ); From a0d9ad97463aa53cff0480b2149f500f472a5bbe Mon Sep 17 00:00:00 2001 From: andrewshuba Date: Wed, 16 Dec 2020 13:41:31 +0200 Subject: [PATCH 06/12] - added a tooltip with meta key name for fields in a form settings --- includes/admin/core/class-admin-builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/core/class-admin-builder.php b/includes/admin/core/class-admin-builder.php index 313972fd..2831816f 100644 --- a/includes/admin/core/class-admin-builder.php +++ b/includes/admin/core/class-admin-builder.php @@ -898,7 +898,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) { continue; } ?> - data-silent_action="um_admin_add_field_from_list" data-arg1="" data-arg2=""> () + data-silent_action="um_admin_add_field_from_list" data-arg1="" data-arg2="" title=""> () Date: Wed, 16 Dec 2020 14:46:38 +0200 Subject: [PATCH 07/12] - fixed PHP notices/warnings; --- includes/admin/core/class-admin-metabox.php | 3 ++- includes/core/class-roles-capabilities.php | 2 +- includes/core/um-actions-form.php | 12 ++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index 8773ee3b..e600797b 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -40,6 +40,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { function __construct() { $this->in_edit = false; $this->edit_mode_value = null; + $this->edit_array = []; add_action( 'admin_head', array( &$this, 'admin_head' ), 9); add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9); @@ -1233,7 +1234,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { if ( $this->in_edit == true ) { // we're editing a field $real_attr = substr( $attribute, 1 ); - $this->edit_mode_value = (isset( $this->edit_array[ $real_attr ] ) ) ? $this->edit_array[ $real_attr ] : null; + $this->edit_mode_value = isset( $this->edit_array[ $real_attr ] ) ? $this->edit_array[ $real_attr ] : null; } switch ( $attribute ) { diff --git a/includes/core/class-roles-capabilities.php b/includes/core/class-roles-capabilities.php index 45264c6a..233e7cec 100644 --- a/includes/core/class-roles-capabilities.php +++ b/includes/core/class-roles-capabilities.php @@ -32,7 +32,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) { function um_on_roles_update( $option, $old_value, $value ) { global $wp_roles; - if ( isset( $wp_roles->role_key ) && $option == $wp_roles->role_key ) { + if ( is_object( $wp_roles ) && isset( $wp_roles->role_key ) && $option == $wp_roles->role_key ) { foreach ( $value as $role_key => $role_data ) { $role_keys = get_option( 'um_roles', array() ); $role_keys = array_map( function( $item ) { diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index 54e9354b..ef85d941 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -536,13 +536,21 @@ function um_submit_form_errors_hook_( $args ) { if ( isset( $array['min_chars'] ) && $array['min_chars'] > 0 ) { if ( $args[ $key ] && strlen( utf8_decode( $args[ $key ] ) ) < $array['min_chars'] ) { - UM()->form()->add_error( $key, sprintf( __( 'Your %s must contain at least %s characters', 'ultimate-member' ), $array['label'], $array['min_chars'] ) ); + if ( empty( $array['label'] ) ) { + UM()->form()->add_error( $key, sprintf( __( 'This field must contain at least %s characters', 'ultimate-member' ), $array['min_chars'] ) ); + } else { + UM()->form()->add_error( $key, sprintf( __( 'Your %s must contain at least %s characters', 'ultimate-member' ), $array['label'], $array['min_chars'] ) ); + } } } if ( isset( $array['max_chars'] ) && $array['max_chars'] > 0 ) { if ( $args[ $key ] && strlen( utf8_decode( $args[ $key ] ) ) > $array['max_chars'] ) { - UM()->form()->add_error( $key, sprintf( __( 'Your %s must contain less than %s characters', 'ultimate-member' ), $array['label'], $array['max_chars'] ) ); + if ( empty( $array['label'] ) ) { + UM()->form()->add_error( $key, sprintf( __( 'This field must contain less than %s characters', 'ultimate-member' ), $array['max_chars'] ) ); + } else { + UM()->form()->add_error( $key, sprintf( __( 'Your %s must contain less than %s characters', 'ultimate-member' ), $array['label'], $array['max_chars'] ) ); + } } } From 0b8ca8e3e7716c26eca41cbda1e5a82fc5888cd4 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Thu, 17 Dec 2020 14:12:56 +0200 Subject: [PATCH 08/12] - added argument to a hook to avoid the fatal error in Profile Tabs --- includes/core/um-actions-profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 61aa7572..b5efa328 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -536,7 +536,7 @@ function um_user_edit_profile( $args ) { * } * ?> */ - do_action( 'um_user_after_updating_profile', $to_update, $user_id ); + do_action( 'um_user_after_updating_profile', $to_update, $user_id, $args ); /** * UM hook From c7487a702bdb96250b2253cb34f4871b6baac147 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Fri, 18 Dec 2020 13:46:01 +0200 Subject: [PATCH 09/12] - code formatting; --- assets/js/um-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/um-scripts.js b/assets/js/um-scripts.js index 6761cd6a..4a24e4ae 100644 --- a/assets/js/um-scripts.js +++ b/assets/js/um-scripts.js @@ -79,7 +79,7 @@ function um_init_datetimepicker() { function init_tipsy() { - if( typeof(jQuery.fn.tipsy) === "function" ){ + if ( typeof( jQuery.fn.tipsy ) === "function" ) { jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3 }); jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3 }); jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3 }); From aadf1d710412eb6947da15592b2ec86a779a1c5c Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Mon, 21 Dec 2020 03:29:57 +0200 Subject: [PATCH 10/12] - 2.1.4-rc.1; --- includes/admin/core/class-admin-enqueue.php | 2 +- includes/admin/core/class-admin-metabox.php | 2 +- readme.txt | 4 ++++ ultimate-member.php | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/admin/core/class-admin-enqueue.php b/includes/admin/core/class-admin-enqueue.php index 4d1ce960..92dda165 100644 --- a/includes/admin/core/class-admin-enqueue.php +++ b/includes/admin/core/class-admin-enqueue.php @@ -441,7 +441,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { wp_set_script_translations( 'um_block_js', 'ultimate-member' ); $restrict_options = array(); - $roles = UM()->roles()->get_roles( false, array( 'administrator' ) ); + $roles = UM()->roles()->get_roles( false ); if ( ! empty( $roles ) ) { foreach ( $roles as $role_key => $title ) { $restrict_options[] = array( diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index e60cdec2..037f0ed3 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -405,7 +405,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { 'type' => 'multi_checkbox', 'label' => __( 'Select which roles can access this content', 'ultimate-member' ), 'description' => __( 'Activate content restriction for this post', 'ultimate-member' ), - 'options' => UM()->roles()->get_roles( false, array( 'administrator' ) ), + 'options' => UM()->roles()->get_roles( false ), 'columns' => 3, 'conditional' => array( '_um_accessible', '=', '2' ) ), diff --git a/readme.txt b/readme.txt index bf3c7ace..ebb92c76 100644 --- a/readme.txt +++ b/readme.txt @@ -155,6 +155,10 @@ The plugin works with popular caching plugins by automatically excluding Ultimat * To learn more about version 2.1 please see this [docs](https://docs.ultimatemember.com/article/1512-upgrade-2-1-0) * UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin += 2.1.14: December 21, 2020 = + + + = 2.1.13: December 8, 2020 = * Enhancements: diff --git a/ultimate-member.php b/ultimate-member.php index d948a57d..1919ede0 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.1.14-alpha1 +Version: 2.1.14-rc.1 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member From 8a67754df1d4832d303a641625db8b4ecd35c13b Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Mon, 21 Dec 2020 14:52:02 +0200 Subject: [PATCH 11/12] - version changelog; --- readme.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/readme.txt b/readme.txt index ebb92c76..bd90e9ab 100644 --- a/readme.txt +++ b/readme.txt @@ -157,7 +157,14 @@ The plugin works with popular caching plugins by automatically excluding Ultimat = 2.1.14: December 21, 2020 = +* Enhancements: + - Added a tooltip with meta key name for fields in a form settings + - Added `Administrator` user role to a restriction setting (to make the content visible only for `Administrator` role) +* Bugfixes: + - Added third parameter $args to the action hook for Profile Tab redirections `um_user_after_updating_profile` + - Fixed issues with fields without metakeys when trying to display them by the hook + - Fixed PHP notices/warnings = 2.1.13: December 8, 2020 = From 8234fee3cf39f06a55cbbdc9a205423363fef48a Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Tue, 22 Dec 2020 17:04:18 +0200 Subject: [PATCH 12/12] - added a fix for getting status (fetch user again if not exists); --- includes/core/um-actions-register.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index 7277d24c..930e4aef 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -64,8 +64,14 @@ function um_after_insert_user( $user_id, $args ) { UM()->user()->set_registration_details( $args['submitted'], $args ); } + $status = um_user( 'status' ); + if ( empty( $status ) ) { + um_fetch_user( $user_id ); + $status = um_user( 'status' ); + } + /* save user status */ - UM()->user()->set_status( um_user( 'status' ) ); + UM()->user()->set_status( $status ); /* create user uploads directory */ UM()->uploader()->get_upload_user_base_dir( $user_id, true );