Merge pull request #977 from ultimatemember/development/2.3.1

Development/2.3.1
This commit is contained in:
Nikita Sinelnikov
2022-02-07 15:17:19 +02:00
committed by GitHub
18 changed files with 241 additions and 142 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ GNU Version 2 or Any Later Version
## Releases
[Official Release Version: 2.3.0](https://github.com/ultimatemember/ultimatemember/releases/tag/2.3.0).
[Official Release Version: 2.3.1](https://github.com/ultimatemember/ultimatemember/releases/tag/2.3.1).
## Changelog
+54 -16
View File
@@ -20,10 +20,13 @@
if ( !self.$menu.length ) {
self.$menu = $('div.um-new-dropdown[data-element="' + self.data.element + '"]').first();
}
self.$dropdown = self.$menu.clone();
self.$dropdown.on('click', 'li a', self.itemHandler); /* add the handler for menu items */
self.$dropdown.on('click', 'li a', self.itemHandler).attr('data-cloned', '1'); /* add the handler for menu items */
$(window).on('resize', self.updatePosition); /* update the position on window resize */
$(document.body).append(self.$dropdown);
var parent = '' !== self.data.parent ? self.data.parent : document.body;
$(parent).append(self.$dropdown);
/* trigger event */
self.$element.trigger('um_new_dropdown_render', {
@@ -51,27 +54,45 @@
},
hideAll: function () {
self.hide();
$('body > div.um-new-dropdown').remove();
if ( self.$element.data('um-new-dropdown-show') ) {
self.hide();
}
$( 'div.um-new-dropdown[data-cloned="1"]' ).remove();
$('.um-new-dropdown-shown').removeClass('um-new-dropdown-shown').data('um-new-dropdown-show', false);
return self;
},
calculatePosition: function () {
var offset = self.$element.offset(),
rect = self.$element.get(0).getBoundingClientRect(),
var rect = self.$element.get(0).getBoundingClientRect(),
height = self.$dropdown.innerHeight() || 150,
width = self.data.width || 150,
place = '';
var offset;
if ( '' !== self.data.parent ) {
var parentPos = $( self.data.parent ).offset();
var childPos = self.$element.offset();
offset = {
top: childPos.top - parentPos.top,
left: childPos.left - parentPos.left
};
} else {
offset = self.$element.offset();
}
var base_width = '' !== self.data.parent ? $( self.data.parent )[0].offsetWidth : window.innerWidth;
var base_height = '' !== self.data.parent ? $( self.data.parent )[0].offsetHeight : window.innerHeight;
var css = {
position: 'absolute',
width: width + 'px'
};
/* vertical position */
if ( window.innerHeight - rect.bottom > height ) {
if ( base_height - rect.bottom > height ) {
css.top = offset.top + rect.height + 'px';
place += 'bottom';
} else {
@@ -80,7 +101,7 @@
}
/* horisontal position */
if ( offset.left > width || offset.left > window.innerWidth / 2 ) {
if ( offset.left > width || offset.left > base_width / 2 ) {
css.left = offset.left + rect.width - width + 'px';
place += '-left';
} else {
@@ -123,10 +144,12 @@
self.$menu.find('li a[class="' + attrClass + '"]').trigger('click');
/* hide dropdown */
self.hide();
if ( self.$element.data('um-new-dropdown-show') ) {
self.hide();
}
},
triggerHandler: function (e) {
triggerHandler: function(e) {
e.stopPropagation();
self.$element = $(e.currentTarget);
@@ -139,26 +162,41 @@
}
};
// hidden dropdown menu block generated via PHP. Is used for cloning when 'action' on the 'link'
self.$menu = $(element);
// 'link' data
self.data = self.$menu.data();
// base 'link' which we use for 'action' and show a clone of the hidden dropdown
self.$element = self.$menu.closest(self.data.element);
if ( !self.$element.length ) {
self.$element = $(self.data.element).first();
if ( ! self.$element.length ) {
self.$element = $( self.data.element ).first();
}
self.$dropdown = $(document.body).children('div[data-element="' + self.data.element + '"]');
if ( typeof self.data.initted === 'undefined' ) {
// single init based on 'initted' data and add 'action' handler for the 'link'
self.$menu.data('initted', true);
$(document.body).on(self.data.trigger, self.data.element, self.triggerHandler);
self.data = self.$menu.data();
// screenTriggers is used to not duplicate the triggers for more than 1 element on the page
if ( typeof um_dropdownMenu.screenTriggers === 'undefined' ) {
um_dropdownMenu.screenTriggers = {};
}
if ( um_dropdownMenu.screenTriggers[ self.data.element ] !== self.data.trigger ) {
um_dropdownMenu.screenTriggers[ self.data.element ] = self.data.trigger;
$(document.body).on( self.data.trigger, self.data.element, self.triggerHandler );
}
}
if ( typeof um_dropdownMenu.globalHandlersInitted === 'undefined' ) {
um_dropdownMenu.globalHandlersInitted = true;
$(document.body).on('click', function (e) {
if ( !$(e.target).closest('.um-new-dropdown').length ) {
//var globalParent = '' !== self.data.parent ? self.data.parent : document.body;
$( document.body ).on('click', function(e) {
if ( ! $( e.target ).closest('.um-new-dropdown').length ) {
self.hideAll();
}
});
@@ -191,4 +229,4 @@ function um_init_new_dropdown() {
/* Init all dropdown menus on page load */
jQuery( document ).ready( function($) {
um_init_new_dropdown();
});
});
+1 -1
View File
@@ -1 +1 @@
function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(t){function d(e){var i={get:function(){return i},show:function(){return i.hideAll(),i.$menu=i.$element.find(".um-new-dropdown"),i.$menu.length||(i.$menu=t('div.um-new-dropdown[data-element="'+i.data.element+'"]').first()),i.$dropdown=i.$menu.clone(),i.$dropdown.on("click","li a",i.itemHandler),t(window).on("resize",i.updatePosition),t(document.body).append(i.$dropdown),i.$element.trigger("um_new_dropdown_render",{dropdown_layout:i.$dropdown,trigger:i.data.trigger,element:i.data.elemen,obj:i.$element}),i.$dropdown.css(i.calculatePosition()).show(),i.$element.addClass("um-new-dropdown-shown").data("um-new-dropdown-show",!0),i},hide:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&(t(window).off("resize",i.updatePosition),i.$dropdown.remove(),i.$element.removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1)),i},hideAll:function(){return i.hide(),t("body > div.um-new-dropdown").remove(),t(".um-new-dropdown-shown").removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1),i},calculatePosition:function(){var e=i.$element.offset(),n=i.$element.get(0).getBoundingClientRect(),t=i.$dropdown.innerHeight()||150,o=i.data.width||150,d="",r={position:"absolute",width:o+"px"};switch(window.innerHeight-n.bottom>t?(r.top=e.top+n.height+"px",d+="bottom"):(d+="top",r.top=e.top-t+"px"),e.left>o||e.left>window.innerWidth/2?(r.left=e.left+n.width-o+"px",d+="-left"):(r.left=e.left+"px",d+="-right"),d){case"bottom-right":r.borderRadius="0px 5px 5px 5px";break;case"bottom-left":r.borderRadius="5px 0px 5px 5px";break;case"top-right":r.borderRadius="5px 5px 5px 0px";break;case"top-left":r.borderRadius="5px 5px 0px 5px"}return r},updatePosition:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&i.$dropdown.css(i.calculatePosition()),i},itemHandler:function(e){e.stopPropagation();var n=t(e.currentTarget).attr("class");i.$menu.find('li a[class="'+n+'"]').trigger("click"),i.hide()},triggerHandler:function(e){e.stopPropagation(),i.$element=t(e.currentTarget),i.$element.data("um-new-dropdown-show")?i.hide():i.show()}};return i.$menu=t(e),i.data=i.$menu.data(),i.$element=i.$menu.closest(i.data.element),i.$element.length||(i.$element=t(i.data.element).first()),i.$dropdown=t(document.body).children('div[data-element="'+i.data.element+'"]'),void 0===i.data.initted&&(i.$menu.data("initted",!0),t(document.body).on(i.data.trigger,i.data.element,i.triggerHandler)),void 0===d.globalHandlersInitted&&(d.globalHandlersInitted=!0,t(document.body).on("click",function(e){t(e.target).closest(".um-new-dropdown").length||i.hideAll()})),i}t.fn.um_dropdownMenu=function(o){return"string"==typeof o&&o?this.map(function(e,n){var t=d(n);return"function"==typeof t[o]?t[o]():t[o]}).toArray():this.each(function(e,n){d(n)})}}(jQuery),jQuery(document).ready(function(e){um_init_new_dropdown()});
function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(u){function d(e){var l={get:function(){return l},show:function(){l.hideAll(),l.$menu=l.$element.find(".um-new-dropdown"),l.$menu.length||(l.$menu=u('div.um-new-dropdown[data-element="'+l.data.element+'"]').first()),l.$dropdown=l.$menu.clone(),l.$dropdown.on("click","li a",l.itemHandler).attr("data-cloned","1"),u(window).on("resize",l.updatePosition);var e=""!==l.data.parent?l.data.parent:document.body;return u(e).append(l.$dropdown),l.$element.trigger("um_new_dropdown_render",{dropdown_layout:l.$dropdown,trigger:l.data.trigger,element:l.data.elemen,obj:l.$element}),l.$dropdown.css(l.calculatePosition()).show(),l.$element.addClass("um-new-dropdown-shown").data("um-new-dropdown-show",!0),l},hide:function(){return l.$dropdown&&l.$dropdown.is(":visible")&&(u(window).off("resize",l.updatePosition),l.$dropdown.remove(),l.$element.removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1)),l},hideAll:function(){return l.$element.data("um-new-dropdown-show")&&l.hide(),u('div.um-new-dropdown[data-cloned="1"]').remove(),u(".um-new-dropdown-shown").removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1),l},calculatePosition:function(){var e,t=l.$element.get(0).getBoundingClientRect(),n=l.$dropdown.innerHeight()||150,o=l.data.width||150,d="";if(""!==l.data.parent){var r=u(l.data.parent).offset(),a=l.$element.offset();e={top:a.top-r.top,left:a.left-r.left}}else e=l.$element.offset();var i=""!==l.data.parent?u(l.data.parent)[0].offsetWidth:window.innerWidth,p={position:"absolute",width:o+"px"};switch((""!==l.data.parent?u(l.data.parent)[0].offsetHeight:window.innerHeight)-t.bottom>n?(p.top=e.top+t.height+"px",d+="bottom"):(d+="top",p.top=e.top-n+"px"),e.left>o||e.left>i/2?(p.left=e.left+t.width-o+"px",d+="-left"):(p.left=e.left+"px",d+="-right"),d){case"bottom-right":p.borderRadius="0px 5px 5px 5px";break;case"bottom-left":p.borderRadius="5px 0px 5px 5px";break;case"top-right":p.borderRadius="5px 5px 5px 0px";break;case"top-left":p.borderRadius="5px 5px 0px 5px"}return p},updatePosition:function(){return l.$dropdown&&l.$dropdown.is(":visible")&&l.$dropdown.css(l.calculatePosition()),l},itemHandler:function(e){e.stopPropagation();var t=u(e.currentTarget).attr("class");l.$menu.find('li a[class="'+t+'"]').trigger("click"),l.$element.data("um-new-dropdown-show")&&l.hide()},triggerHandler:function(e){e.stopPropagation(),l.$element=u(e.currentTarget),l.$element.data("um-new-dropdown-show")?l.hide():l.show()}};return l.$menu=u(e),l.data=l.$menu.data(),l.$element=l.$menu.closest(l.data.element),l.$element.length||(l.$element=u(l.data.element).first()),l.$dropdown=u(document.body).children('div[data-element="'+l.data.element+'"]'),void 0===l.data.initted&&(l.$menu.data("initted",!0),l.data=l.$menu.data(),void 0===d.screenTriggers&&(d.screenTriggers={}),d.screenTriggers[l.data.element]!==l.data.trigger&&(d.screenTriggers[l.data.element]=l.data.trigger,u(document.body).on(l.data.trigger,l.data.element,l.triggerHandler))),void 0===d.globalHandlersInitted&&(d.globalHandlersInitted=!0,u(document.body).on("click",function(e){u(e.target).closest(".um-new-dropdown").length||l.hideAll()})),l}u.fn.um_dropdownMenu=function(o){return"string"==typeof o&&o?this.map(function(e,t){var n=d(t);return"function"==typeof n[o]?n[o]():n[o]}).toArray():this.each(function(e,t){d(t)})}}(jQuery),jQuery(document).ready(function(e){um_init_new_dropdown()});
+16 -2
View File
@@ -1,10 +1,24 @@
jQuery( document ).ready( function() {
/**
* Licenses
*/
jQuery( document.body ).on( 'click', '.um_license_deactivate', function() {
jQuery(this).siblings('.um-option-field').val('');
jQuery(this).parents('form.um-settings-form').trigger('submit');
if ( jQuery(this).siblings('#submit').length ) {
// clear = true for passing the empty field value to the license form submission
jQuery(this).siblings('#submit').trigger('click',[ true ]);
} else {
jQuery(this).parents('form.um-settings-form').trigger('submit');
}
});
jQuery( document.body ).on( 'click', '.um-settings-form #submit', function( e, clear ) {
if ( ! clear && '' === jQuery(this).siblings('.um-option-field').val() ) {
return false;
}
});
@@ -32,4 +46,4 @@ jQuery( document ).ready( function() {
window.onbeforeunload = '';
});
}
});
});
+1 -4
View File
@@ -106,8 +106,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
$this->um_cpt_form_screen = true;
add_action( 'admin_footer', array( $this, 'admin_footer_scripts' ), 20 );
}
$this->post_page = true;
}
@@ -646,14 +644,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
}
global $wp_version, $current_screen;
if ( version_compare( $wp_version, '5.0', '>=' ) && ! empty( $this->post_page ) ) {
if ( version_compare( $wp_version, '5.0', '>=' ) ) {
if ( $current_screen->is_block_editor() ) {
$this->load_gutenberg_js();
$this->load_gutenberg_shortcode_blocks();
}
}
}
+1 -1
View File
@@ -2364,7 +2364,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
<div class="um-admin-tri">
<p><label for="_editable"><?php _e( 'Can user edit this field?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This option allows you to set whether or not the user can edit the information in this field.', 'ultimate-member' ) ); ?></label>
<p><label for="_editable"><?php _e( 'Can user edit this field?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This option allows you to set whether or not the user can edit the information in this field. The site admin can edit all fields regardless of the option set here.', 'ultimate-member' ) ); ?></label>
<input type="hidden" name="_editable" id="_editable_hidden" value="0" />
<input type="checkbox" name="_editable" id="_editable" value="1" <?php checked( null === $this->edit_mode_value || $this->edit_mode_value ) ?> />
</p>
+5 -1
View File
@@ -426,6 +426,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' );
break;
case 'settings_updated':
$messages[0]['content'] = __( 'Settings have been saved successfully.', 'ultimate-member' );
break;
case 'user_updated':
$messages[0]['content'] = __( 'User has been updated.', 'ultimate-member' );
break;
@@ -532,7 +536,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
</p>
<p>
<a href="<?php echo esc_url( $url ) ?>" class="button button-primary"><?php _e( 'Upgrade Now', 'ultimate-member' ) ?></a>
<a href="<?php echo esc_url( $url ) ?>" class="button button-primary"><?php _e( 'Visit Upgrade Page', 'ultimate-member' ) ?></a>
&nbsp;
</p>
+24 -29
View File
@@ -1280,13 +1280,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
array(
'id' => 'blocked_emails',
'type' => 'textarea',
'label' => __( 'Blocked Email Addresses', 'ultimate-member' ),
'label' => __( 'Blocked Email Addresses (Enter one email per line)', 'ultimate-member' ),
'tooltip' => __( 'This will block the specified e-mail addresses from being able to sign up or sign in to your site. To block an entire domain, use something like *@domain.com', 'ultimate-member' ),
),
array(
'id' => 'blocked_words',
'type' => 'textarea',
'label' => __( 'Blacklist Words', 'ultimate-member' ),
'label' => __( 'Blacklist Words (Enter one word per line)', 'ultimate-member' ),
'tooltip' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username', 'ultimate-member' ),
),
),
@@ -1810,39 +1810,32 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
*/
public function sorting_licenses_options( $settings ) {
//sorting licenses
if ( empty( $settings['licenses']['fields'] ) ) {
return $settings;
if ( ! empty( $settings['licenses']['fields'] ) ) {
$licenses = $settings['licenses']['fields'];
@uasort( $licenses, function( $a, $b ) {
return strnatcasecmp( $a['label'], $b['label'] );
} );
$settings['licenses']['fields'] = $licenses;
}
$licenses = $settings['licenses']['fields'];
@uasort( $licenses, function( $a, $b ) {
return strnatcasecmp( $a['label'], $b['label'] );
} );
$settings['licenses']['fields'] = $licenses;
//sorting extensions by the title
if ( ! empty( $settings['extensions']['sections'] ) ) {
$extensions = $settings['extensions']['sections'];
//sorting extensions
if ( empty( $settings['extensions']['sections'] ) ) {
return $settings;
}
$extensions = $settings['extensions']['sections'];
@uasort( $extensions, function( $a, $b ) {
return strnatcasecmp( $a['title'], $b['title'] );
} );
$keys = array_keys( $extensions );
if ( $keys[0] !== '' ) {
$new_key = strtolower( str_replace( ' ', '_', $extensions['']['title'] ) );
$temp = $extensions[''];
$extensions[ $new_key ] = $temp;
$extensions[''] = $extensions[ $keys[0] ];
unset( $extensions[ $keys[0] ] );
@uasort( $extensions, function( $a, $b ) {
return strnatcasecmp( $a['title'], $b['title'] );
} );
}
$settings['extensions']['sections'] = $extensions;
$keys = array_keys( $extensions );
$temp = array(
'' => $extensions[ $keys[0] ],
);
unset( $extensions[ $keys[0] ] );
$extensions = $temp + $extensions;
$settings['extensions']['sections'] = $extensions;
}
return $settings;
}
@@ -2227,7 +2220,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
//redirect after save settings
$arg = array(
'page' => 'um_options',
'page' => 'um_options',
'update' => 'settings_updated',
);
if ( ! empty( $_GET['tab'] ) ) {
@@ -2949,6 +2943,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Activate', 'ultimate-member' ) ?>" />
<?php } else { ?>
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Re-Activate', 'ultimate-member' ) ?>" />
<input type="button" class="button um_license_deactivate" id="<?php echo esc_attr( $field_data['id'] ) ?>_deactivate" value="<?php esc_attr_e( 'Clear License', 'ultimate-member' ) ?>"/>
<?php }
if ( ! empty( $messages ) ) {
+12
View File
@@ -213,6 +213,8 @@ if ( ! class_exists( 'UM' ) ) {
//run activation
register_activation_hook( um_plugin, array( &$this, 'activation' ) );
register_deactivation_hook( um_plugin, array( &$this, 'deactivation' ) );
if ( is_multisite() && ! defined( 'DOING_AJAX' ) ) {
add_action( 'wp_loaded', array( $this, 'maybe_network_activation' ) );
}
@@ -454,6 +456,16 @@ if ( ! class_exists( 'UM' ) ) {
}
/**
* Plugin Deactivation
*
* @since 2.3
*/
function deactivation() {
$this->cron()->unschedule_events();
}
/**
* Maybe need multisite activation process
*
+8 -1
View File
@@ -116,5 +116,12 @@ if ( ! class_exists( 'um\core\Cron' ) ) {
}
}
public function unschedule_events() {
wp_clear_scheduled_hook( 'um_weekly_scheduled_events' );
wp_clear_scheduled_hook( 'um_daily_scheduled_events' );
wp_clear_scheduled_hook( 'um_twicedaily_scheduled_events' );
wp_clear_scheduled_hook( 'um_hourly_scheduled_events' );
}
}
}
}
+68 -45
View File
@@ -2730,39 +2730,54 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
} else {
$img = '';
}
$output .= '<div class="um-single-image-preview show ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">
<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>' . $img . '
</div><a href="javascript:void(0);" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . __( 'Change photo', 'ultimate-member' ) . '</a>';
$output .= '<div class="um-single-image-preview show ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">';
if ( empty( $disabled ) ) {
$output .= '<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>';
}
$output .= $img;
$output .= '</div>';
if ( empty( $disabled ) ) {
$output .= '<a href="javascript:void(0);" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . __( 'Change photo', 'ultimate-member' ) . '</a>';
}
} else {
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">
<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>
<img src="" alt="" />
<div class="um-clear"></div></div><a href="javascript:void(0);" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . $button_text . '</a>';
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">';
if ( empty( $disabled ) ) {
$output .= '<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>';
}
$output .= '<img src="" alt="" /><div class="um-clear"></div></div>';
if ( empty( $disabled ) ) {
$output .= '<a href="javascript:void(0);" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . $button_text . '</a>';
}
}
$output .= '</div>';
/* modal hidden */
$output .= '<div class="um-modal-hidden-content">';
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
$output .= '<div class="um-modal-body">';
if (isset( $this->set_id )) {
$set_id = $this->set_id;
$set_mode = $this->set_mode;
} else {
$set_id = 0;
$set_mode = '';
}
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-ratio="' . $ratio . '" data-min_width="' . $min_width . '" data-min_height="' . $min_height . '" data-coord=""><a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a><img src="" alt="" /><div class="um-clear"></div></div><div class="um-clear"></div>';
$output .= '<div class="um-single-image-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-nonce="' . $nonce . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
$output .= '<div class="um-modal-footer">
if ( empty( $disabled ) ) {
$output .= '<div class="um-modal-hidden-content">';
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
$output .= '<div class="um-modal-body">';
if ( isset( $this->set_id ) ) {
$set_id = $this->set_id;
$set_mode = $this->set_mode;
} else {
$set_id = 0;
$set_mode = '';
}
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-ratio="' . $ratio . '" data-min_width="' . $min_width . '" data-min_height="' . $min_height . '" data-coord=""><a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a><img src="" alt="" /><div class="um-clear"></div></div><div class="um-clear"></div>';
$output .= '<div class="um-single-image-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-nonce="' . $nonce . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
$output .= '<div class="um-modal-footer">
<div class="um-modal-right">
<a href="javascript:void(0);" class="um-modal-btn um-finish-upload image disabled" data-key="' . $key . '" data-change="' . __( 'Change photo', 'ultimate-member' ) . '" data-processing="' . __( 'Processing...', 'ultimate-member' ) . '"> ' . __( 'Apply', 'ultimate-member' ) . '</a>
<a href="javascript:void(0);" class="um-modal-btn alt" data-action="um_remove_modal"> ' . __( 'Cancel', 'ultimate-member' ) . '</a>
</div>
<div class="um-clear"></div>
</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
/* end */
if ( $this->is_error( $key ) ) {
$output .= $this->field_error( $this->show_error( $key ) );
@@ -2813,9 +2828,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
if ( file_exists( $file_dir ) ) {
$output .= "<div class=\"um-single-file-preview show\" data-key=\"{$key}\">
<a href=\"#\" class=\"cancel\"><i class=\"um-icon-close\"></i></a>
<div class=\"um-single-fileinfo\">
$output .= "<div class=\"um-single-file-preview show\" data-key=\"{$key}\">";
if ( empty( $disabled ) ) {
$output .= "<a href=\"#\" class=\"cancel\"><i class=\"um-icon-close\"></i></a>";
}
$output .= "<div class=\"um-single-fileinfo\">
<a href=\"{$file_url}\" target=\"_blank\">
<span class=\"icon\" style=\"background:" . UM()->files()->get_fonticon_bg_by_ext( $file_type['ext'] ) . "\"><i class=\"" . UM()->files()->get_fonticon_by_ext( $file_type['ext'] ) . "\"></i></span>
<span class=\"filename\">{$file_field_name}</span>
@@ -2825,24 +2842,29 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$output .= "<div class=\"um-single-file-preview show\" data-key=\"{$key}\">" . __('This file has been removed.','ultimate-member') . "</div>";
}
$output .= "<a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">" . __( 'Change file', 'ultimate-member' ) . "</a>";
if ( empty( $disabled ) ) {
$output .= "<a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">" . __( 'Change file', 'ultimate-member' ) . "</a>";
}
} else {
$output .= "<div class=\"um-single-file-preview\" data-key=\"{$key}\">
</div><a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">{$button_text}</a>";
$output .= "<div class=\"um-single-file-preview\" data-key=\"{$key}\"></div>";
if ( empty( $disabled ) ) {
$output .= "<a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">{$button_text}</a>";
}
}
$output .= '</div>';
/* modal hidden */
$output .= '<div class="um-modal-hidden-content">';
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
$output .= '<div class="um-modal-body">';
if ( isset( $this->set_id ) ) {
$set_id = $this->set_id;
$set_mode = $this->set_mode;
} else {
$set_id = 0;
$set_mode = '';
}
$output .= '<div class="um-single-file-preview">
if ( empty( $disabled ) ) {
$output .= '<div class="um-modal-hidden-content">';
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
$output .= '<div class="um-modal-body">';
if ( isset( $this->set_id ) ) {
$set_id = $this->set_id;
$set_mode = $this->set_mode;
} else {
$set_id = 0;
$set_mode = '';
}
$output .= '<div class="um-single-file-preview">
<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>
<div class="um-single-fileinfo">
<a href="" target="_blank">
@@ -2851,17 +2873,18 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
</a>
</div>
</div>';
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
$output .= '<div class="um-single-file-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-nonce="' . $nonce . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
$output .= '<div class="um-modal-footer">
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
$output .= '<div class="um-single-file-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-nonce="' . $nonce . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
$output .= '<div class="um-modal-footer">
<div class="um-modal-right">
<a href="javascript:void(0);" class="um-modal-btn um-finish-upload file disabled" data-key="' . esc_attr( $key ) . '" data-change="' . esc_attr__( 'Change file' ) . '" data-processing="' . esc_attr__( 'Processing...', 'ultimate-member' ) . '"> ' . __( 'Save', 'ultimate-member' ) . '</a>
<a href="javascript:void(0);" class="um-modal-btn alt" data-action="um_remove_modal"> ' . __( 'Cancel', 'ultimate-member' ) . '</a>
</div>
<div class="um-clear"></div>
</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
/* end */
if ( $this->is_error( $key ) ) {
$output .= $this->field_error( $this->show_error( $key ) );
+6 -4
View File
@@ -2586,12 +2586,13 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
* @param string $element
* @param string $trigger
* @param array $items
* @param string $parent
*/
function dropdown_menu( $element, $trigger, $items = array() ) {
function dropdown_menu( $element, $trigger, $items = array(), $parent = '' ) {
// !!!!Important: all links in the dropdown items must have "class" attribute
?>
<div class="um-new-dropdown" data-element="<?php echo $element; ?>" data-trigger="<?php echo $trigger; ?>">
<div class="um-new-dropdown" data-element="<?php echo $element; ?>" data-trigger="<?php echo $trigger; ?>" data-parent="<?php echo $parent; ?>">
<ul>
<?php foreach ( $items as $k => $v ) { ?>
<li><?php echo $v; ?></li>
@@ -2610,11 +2611,12 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
* @param string $trigger
* @param string $item
* @param string $additional_attributes
* @param string $parent
*/
function dropdown_menu_js( $element, $trigger, $item, $additional_attributes = '' ) {
function dropdown_menu_js( $element, $trigger, $item, $additional_attributes = '', $parent = '' ) {
?>
<div class="um-new-dropdown" data-element="<?php echo $element; ?>" data-trigger="<?php echo $trigger; ?>">
<div class="um-new-dropdown" data-element="<?php echo $element; ?>" data-trigger="<?php echo $trigger; ?>" data-parent="<?php echo $parent; ?>">
<ul>
<# _.each( <?php echo $item; ?>.dropdown_actions, function( action, key, list ) { #>
<li><a href="<# if ( typeof action.url != 'undefined' ) { #>{{{action.url}}}<# } else { #>javascript:void(0);<# }#>" class="{{{key}}}"<?php echo $additional_attributes ? " $additional_attributes" : '' ?>>{{{action.title}}}</a></li>
+2 -17
View File
@@ -19,15 +19,8 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
* Plugin_Updater constructor.
*/
function __construct() {
//create cron event
if ( ! wp_next_scheduled( 'um_check_extensions_licenses' ) ) {
wp_schedule_event( time() + ( 24*60*60 ), 'daily', 'um_check_extensions_licenses' );
}
register_deactivation_hook( um_plugin, array( &$this, 'um_plugin_updater_deactivation_hook' ) );
//cron request to UM()->store_url;
add_action( 'um_check_extensions_licenses', array( &$this, 'um_checklicenses' ) );
add_action( 'um_daily_scheduled_events', array( &$this, 'um_checklicenses' ) );
// clean update plugin cache
add_action( 'upgrader_process_complete', array( &$this, 'clean_update_plugins_cache' ), 20, 2 );
@@ -248,14 +241,6 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
}
/**
* Remove CRON events on deactivation hook
*/
function um_plugin_updater_deactivation_hook() {
wp_clear_scheduled_hook( 'um_check_extensions_licenses' );
}
/**
* Check license function
*/
@@ -665,4 +650,4 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
}
}
}
}
+1 -1
View File
@@ -222,7 +222,7 @@ if ( ! class_exists( 'um\core\Query' ) ) {
* @return int
*/
function count_users_by_status( $status ) {
$args = array( 'fields' => 'ID', 'number' => 0 );
$args = array( 'fields' => 'ID', 'number' => 0, 'um_custom_user_query' => true );
if ( $status == 'unassigned' ) {
$args['meta_query'][] = array(array('key' => 'account_status','compare' => 'NOT EXISTS'));
$users = new \WP_User_Query( $args );
+5 -2
View File
@@ -1352,8 +1352,11 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
$_array = $new_files;
if ( ! empty( UM()->builtin()->custom_fields ) ) {
foreach ( UM()->builtin()->custom_fields as $_field ) {
if ( in_array( $_field['type'], array( 'file', 'image' ) ) && isset( $user_meta_keys[$_field['metakey']] ) && empty( $_array[$_field['metakey']] ) ) {
$_array[$_field['metakey']] = $user_meta_keys[$_field['metakey']];
if ( ! array_key_exists( 'type', $_field ) ) {
continue;
}
if ( in_array( $_field['type'], array( 'file', 'image' ), true ) && isset( $user_meta_keys[ $_field['metakey'] ] ) && empty( $_array[ $_field['metakey'] ] ) ) {
$_array[ $_field['metakey'] ] = $user_meta_keys[ $_field['metakey'] ];
}
}
}
+13 -15
View File
@@ -12,36 +12,33 @@ function um_submit_form_errors_hook__blockedemails( $args ) {
return;
}
$emails = strtolower( $emails );
$emails = array_map( 'rtrim', explode( "\n", $emails ) );
if ( isset( $args['user_email'] ) && is_email( $args['user_email'] ) ) {
$domain = explode( '@', $args['user_email'] );
$check_domain = str_replace( $domain[0], '*', $args['user_email'] );
if ( in_array( $args['user_email'], $emails ) ) {
if ( in_array( strtolower( $args['user_email'] ), $emails ) ) {
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_email' ) ) ) );
}
if ( in_array( $check_domain, $emails ) ) {
$domain = explode( '@', $args['user_email'] );
$check_domain = str_replace( $domain[0], '*', $args['user_email'] );
if ( in_array( strtolower( $check_domain ), $emails ) ) {
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_domain' ) ) ) );
}
}
if ( isset( $args['username'] ) && is_email( $args['username'] ) ) {
$domain = explode( '@', $args['username'] );
$check_domain = str_replace( $domain[0], '*', $args['username'] );
if ( in_array( $args['username'], $emails ) ) {
if ( in_array( strtolower( $args['username'] ), $emails ) ) {
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_email' ) ) ) );
}
if ( in_array( $check_domain, $emails ) ) {
$domain = explode( '@', $args['username'] );
$check_domain = str_replace( $domain[0], '*', $args['username'] );
if ( in_array( strtolower( $check_domain ), $emails ) ) {
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_domain' ) ) ) );
}
}
}
add_action( 'um_submit_form_errors_hook__blockedemails', 'um_submit_form_errors_hook__blockedemails', 10 );
@@ -86,11 +83,12 @@ function um_submit_form_errors_hook__blockedwords( $args ) {
$mode = $args['mode'];
$fields = unserialize( $args['custom_fields'] );
$words = strtolower( $words );
$words = array_map( 'rtrim', explode( "\n", $words ) );
if ( ! empty( $fields ) && is_array( $fields ) ) {
foreach ( $fields as $key => $array ) {
if ( isset( $array['validate'] ) && in_array( $array['validate'], array( 'unique_username', 'unique_email', 'unique_username_or_email' ) ) ) {
if ( ! UM()->form()->has_error( $key ) && isset( $args[ $key ] ) && in_array( $args[ $key ], $words ) ) {
if ( ! UM()->form()->has_error( $key ) && isset( $args[ $key ] ) && in_array( strtolower( $args[ $key ] ), $words ) ) {
UM()->form()->add_error( $key, __( 'You are not allowed to use this word as your username.', 'ultimate-member' ) );
}
}
+22 -1
View File
@@ -6,7 +6,7 @@ Donate link:
Tags: community, member, membership, user-profile, user-registration
Requires PHP: 5.6
Requires at least: 5.0
Tested up to: 5.8
Tested up to: 5.9
Stable tag: 2.3.0
License: GNU Version 2 or Any Later Version
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@@ -155,6 +155,27 @@ 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.3.1: February 9, 2022 =
* Enhancements:
- Added: wp-admin notice on the Settings page when settings have been changed (#963)
- Added: WP Blocks restriction settings for the blocks (templates/nav-menu) on the FSE pages
- Added: UM-specific query_var for UM additional Users_Query on users.php screen in wp-admin. `um_custom_user_query` = true
- Added: Ability for dropdown.js to use it inside parent wrapper (not only document.body)
- Changed: Using WP Cron schedules. Un-schedule events after plugin deactivation
- Removed: `um_check_extensions_licenses` and replaced it to `um_daily_scheduled_events` event
* Bugfixes:
- Fixed: "Can user edit this field?" fields' option for the file/image upload field-types (#958)
- Fixed: Using uppercase symbols in the "Blocked Email Addresses" and "Blacklist Words" blacklists settings (#962)
- Fixed: PHP warning related to the Ultimate Member custom fields without type
- Fixed: Some typos in the labels (#975)
- Fixed: UX issue with wrong text on the admin notice about upgrade
- Fixed: UX issue with Blacklist Words and Blocked Email settings labels. Added a small description about per line separation (#962)
- Fixed: Sorting the Extensions settings sections
= 2.3.0: December 20, 2021 =
* Enhancements:
+1 -1
View File
@@ -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.3.0
Version: 2.3.1
Author: Ultimate Member
Author URI: http://ultimatemember.com/
Text Domain: ultimate-member