mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Merge branch 'master' of github.com:ultimatemember/ultimatemember
# Conflicts: # assets/js/dropdown.min.js # assets/js/simplebar.min.js # assets/js/um-conditional.min.js # assets/js/um-crop.min.js # assets/js/um-fileupload.min.js # assets/js/um-functions.min.js # assets/js/um-jquery-form.min.js # assets/js/um-members.min.js # assets/js/um-scripts.min.js
This commit is contained in:
@@ -41,7 +41,7 @@ GNU Version 2 or Any Later Version
|
||||
|
||||
## Releases
|
||||
|
||||
[Official Release Version: 2.1.20](https://github.com/ultimatemember/ultimatemember/releases/tag/2.1.20).
|
||||
[Official Release Version: 2.1.21](https://github.com/ultimatemember/ultimatemember/releases/tag/2.1.21).
|
||||
|
||||
## Changelog
|
||||
|
||||
|
||||
+173
-64
@@ -1,85 +1,194 @@
|
||||
var um_dropdown_triggers = {};
|
||||
(function ($) {
|
||||
|
||||
function um_init_new_dropdown() {
|
||||
jQuery('.um-new-dropdown').each( function() {
|
||||
var menu = jQuery(this);
|
||||
/**
|
||||
* The constructor of the dropdown object
|
||||
* @param {object} element The menu element.
|
||||
* @returns {object} The dropdown menu object.
|
||||
*/
|
||||
function um_dropdownMenu(element) {
|
||||
|
||||
var is_inited = menu.data( 'um-dropdown-inited' );
|
||||
if ( is_inited ) {
|
||||
return;
|
||||
}
|
||||
var self = {
|
||||
get: function(){
|
||||
return self;
|
||||
},
|
||||
|
||||
var element = menu.data('element');
|
||||
var trigger = menu.data('trigger');
|
||||
show: function () {
|
||||
self.hideAll();
|
||||
|
||||
menu.data( 'um-dropdown-inited', true );
|
||||
/* add dropdown into the <body> */
|
||||
self.$menu = self.$element.find('.um-new-dropdown');
|
||||
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 */
|
||||
$(window).on('resize', self.updatePosition); /* update the position on window resize */
|
||||
$(document.body).append(self.$dropdown);
|
||||
|
||||
if ( -1 === jQuery.inArray( element, um_dropdown_triggers[ trigger ] ) ) {
|
||||
jQuery( document.body ).on( trigger, element, function(e) {
|
||||
var obj = jQuery(this);
|
||||
/* trigger event */
|
||||
self.$element.trigger('um_new_dropdown_render', {
|
||||
dropdown_layout: self.$dropdown,
|
||||
trigger: self.data.trigger,
|
||||
element: self.data.elemen,
|
||||
obj: self.$element
|
||||
});
|
||||
|
||||
if ( obj.data( 'um-new-dropdown-show' ) === true ) {
|
||||
obj.data( 'um-new-dropdown-show', false );
|
||||
obj.find( '.um-new-dropdown' ).hide();
|
||||
} else {
|
||||
jQuery('.um-new-dropdown').hide();
|
||||
jQuery('.um-new-dropdown').parent().data( 'um-new-dropdown-show', false );
|
||||
/* set styles and show */
|
||||
self.$dropdown.css(self.calculatePosition()).show();
|
||||
self.$element.addClass('um-new-dropdown-shown').data('um-new-dropdown-show', true);
|
||||
|
||||
if ( ! obj.find( '.um-new-dropdown' ).length ) {
|
||||
var dropdown_layout = menu.clone();
|
||||
return self;
|
||||
},
|
||||
|
||||
// dropdown_layout.css({
|
||||
// top : '20px',
|
||||
// width: '150px',
|
||||
// right: 0
|
||||
// });
|
||||
|
||||
obj.append( dropdown_layout );
|
||||
|
||||
obj.trigger( 'fmwp_dropdown_render', { dropdown_layout:dropdown_layout, trigger:trigger, element:element, obj:obj} );
|
||||
|
||||
dropdown_layout.show();
|
||||
} else {
|
||||
obj.find( '.um-new-dropdown' )./*css({
|
||||
top : '20px',
|
||||
width: '150px',
|
||||
right: 0
|
||||
}).*/show();
|
||||
hide: function () {
|
||||
if ( self.$dropdown && self.$dropdown.is(':visible') ) {
|
||||
$(window).off('resize', self.updatePosition);
|
||||
self.$dropdown.remove();
|
||||
self.$element.removeClass('um-new-dropdown-shown').data('um-new-dropdown-show', false);
|
||||
}
|
||||
|
||||
obj.data( 'um-new-dropdown-show', true );
|
||||
return self;
|
||||
},
|
||||
|
||||
jQuery( document.body ).bind( 'click', function( event ) {
|
||||
|
||||
if ( jQuery('.um-new-dropdown').find( '.' + jQuery( event.target ).attr('class').trim().replace( ' ', '.' ) ).length === 0 &&
|
||||
|
||||
hideAll: function () {
|
||||
self.hide();
|
||||
$('body > div.um-new-dropdown').remove();
|
||||
$('.um-new-dropdown-shown').removeClass('um-new-dropdown-shown').data('um-new-dropdown-show', false);
|
||||
|
||||
jQuery( '.' + jQuery(event.target).attr('class').trim() ) !== element ) {
|
||||
//event = ev;
|
||||
jQuery('.um-new-dropdown').hide();
|
||||
jQuery('.um-new-dropdown').parent().data( 'um-new-dropdown-show', false );
|
||||
jQuery( document.body ).unbind( event );
|
||||
return self;
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
calculatePosition: function () {
|
||||
var offset = self.$element.offset(),
|
||||
rect = self.$element.get(0).getBoundingClientRect(),
|
||||
height = self.$dropdown.innerHeight() || 150,
|
||||
width = self.data.width || 150,
|
||||
place = '';
|
||||
|
||||
var css = {
|
||||
position: 'absolute',
|
||||
width: width + 'px'
|
||||
};
|
||||
|
||||
/* vertical position */
|
||||
if ( window.innerHeight - rect.bottom > height ) {
|
||||
css.top = offset.top + rect.height + 'px';
|
||||
place += 'bottom';
|
||||
} else {
|
||||
place += 'top';
|
||||
css.top = offset.top - height + 'px';
|
||||
}
|
||||
|
||||
/* horisontal position */
|
||||
if ( offset.left > width || offset.left > window.innerWidth / 2 ) {
|
||||
css.left = offset.left + rect.width - width + 'px';
|
||||
place += '-left';
|
||||
} else {
|
||||
css.left = offset.left + 'px';
|
||||
place += '-right';
|
||||
}
|
||||
|
||||
/* border */
|
||||
switch ( place ) {
|
||||
case 'bottom-right':
|
||||
css.borderRadius = '0px 5px 5px 5px';
|
||||
break;
|
||||
case 'bottom-left':
|
||||
css.borderRadius = '5px 0px 5px 5px';
|
||||
break;
|
||||
case 'top-right':
|
||||
css.borderRadius = '5px 5px 5px 0px';
|
||||
break;
|
||||
case 'top-left':
|
||||
css.borderRadius = '5px 5px 0px 5px';
|
||||
break;
|
||||
}
|
||||
|
||||
return css;
|
||||
},
|
||||
|
||||
updatePosition: function () {
|
||||
if ( self.$dropdown && self.$dropdown.is(':visible') ) {
|
||||
self.$dropdown.css(self.calculatePosition());
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
itemHandler: function (e) {
|
||||
e.stopPropagation();
|
||||
|
||||
/* trigger 'click' in the original menu */
|
||||
var attrClass = $(e.currentTarget).attr('class');
|
||||
self.$menu.find('li a[class="' + attrClass + '"]').trigger('click');
|
||||
|
||||
/* hide dropdown */
|
||||
self.hide();
|
||||
},
|
||||
|
||||
triggerHandler: function (e) {
|
||||
e.stopPropagation();
|
||||
|
||||
self.$element = $(e.currentTarget);
|
||||
|
||||
if ( self.$element.data('um-new-dropdown-show') ) {
|
||||
self.hide();
|
||||
} else {
|
||||
self.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if ( typeof um_dropdown_triggers[ trigger ] == 'undefined' ) {
|
||||
um_dropdown_triggers[ trigger ] = [];
|
||||
}
|
||||
um_dropdown_triggers[ trigger ].push( element );
|
||||
self.$menu = $(element);
|
||||
|
||||
self.data = self.$menu.data();
|
||||
|
||||
self.$element = self.$menu.closest(self.data.element);
|
||||
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' ) {
|
||||
self.$menu.data('initted', true);
|
||||
$(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 ) {
|
||||
self.hideAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/* Add the method um_dropdownMenu() to the jQuery */
|
||||
$.fn.um_dropdownMenu = function (action) {
|
||||
if ( typeof action === 'string' && action ) {
|
||||
return this.map( function (i, menu) {
|
||||
var obj = um_dropdownMenu( menu );
|
||||
return typeof obj[action] === 'function' ? obj[action]() : obj[action];
|
||||
} ).toArray();
|
||||
} else {
|
||||
return this.each( function (i, menu) {
|
||||
um_dropdownMenu( menu );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
function um_init_new_dropdown() {
|
||||
jQuery('.um-new-dropdown').um_dropdownMenu();
|
||||
}
|
||||
|
||||
/* Init all dropdown menus on page load */
|
||||
jQuery( document ).ready( function($) {
|
||||
um_init_new_dropdown();
|
||||
|
||||
jQuery( document.body ).on( 'click', '.um-new-dropdown a', function(e) {
|
||||
jQuery(this).parents('.um-new-dropdown').hide();
|
||||
jQuery(this).parents('.um-new-dropdown').parent().data( 'um-new-dropdown-show', false );
|
||||
jQuery('body').trigger('click');
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
var um_dropdown_triggers={};function um_init_new_dropdown(){jQuery(".um-new-dropdown").each(function(){var r,e,u=jQuery(this);u.data("um-dropdown-inited")||(r=u.data("element"),e=u.data("trigger"),u.data("um-dropdown-inited",!0),-1===jQuery.inArray(r,um_dropdown_triggers[e])&&(jQuery(document.body).on(e,r,function(d){var n,o=jQuery(this);!0===o.data("um-new-dropdown-show")?(o.data("um-new-dropdown-show",!1),o.find(".um-new-dropdown").hide()):(jQuery(".um-new-dropdown").hide(),jQuery(".um-new-dropdown").parent().data("um-new-dropdown-show",!1),o.find(".um-new-dropdown").length?o.find(".um-new-dropdown").show():(n=u.clone(),o.append(n),o.trigger("fmwp_dropdown_render",{dropdown_layout:n,trigger:e,element:r,obj:o}),n.show()),o.data("um-new-dropdown-show",!0),jQuery(document.body).bind("click",function(d){0===jQuery(".um-new-dropdown").find("."+jQuery(d.target).attr("class").trim().replace(" ",".")).length&&jQuery("."+jQuery(d.target).attr("class").trim())!==r&&(jQuery(".um-new-dropdown").hide(),jQuery(".um-new-dropdown").parent().data("um-new-dropdown-show",!1),jQuery(document.body).unbind(d))}))}),void 0===um_dropdown_triggers[e]&&(um_dropdown_triggers[e]=[]),um_dropdown_triggers[e].push(r)))})}jQuery(document).ready(function(d){um_init_new_dropdown(),jQuery(document.body).on("click",".um-new-dropdown a",function(d){jQuery(this).parents(".um-new-dropdown").hide(),jQuery(this).parents(".um-new-dropdown").parent().data("um-new-dropdown-show",!1),jQuery("body").trigger("click"),d.stopPropagation()})});
|
||||
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()});
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+11
-9
@@ -748,19 +748,21 @@ jQuery(document.body).ready( function() {
|
||||
* Sorting
|
||||
*/
|
||||
|
||||
jQuery( document.body ).on( 'click', '.um-directory .um-member-directory-sorting-a .um-new-dropdown li a', function() {
|
||||
var directory = jQuery(this).parents('.um-directory');
|
||||
jQuery( document.body ).on( 'click', '.um-new-dropdown[data-element=".um-member-directory-sorting-a"] li a', function() {
|
||||
if ( jQuery( this ).data('selected') === 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var directory_hash = jQuery(this).data('directory-hash');
|
||||
var directory = jQuery('.um-directory[data-hash="' + directory_hash + '"]');
|
||||
|
||||
if ( um_is_directory_busy( directory ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( jQuery( this ).data('selected') === 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
um_members_show_preloader( directory );
|
||||
|
||||
var sorting_label = jQuery( this ).html();
|
||||
var sort = jQuery(this).data('value');
|
||||
|
||||
directory.data( 'sorting', sort );
|
||||
@@ -768,9 +770,9 @@ jQuery(document.body).ready( function() {
|
||||
|
||||
um_ajax_get_members( directory );
|
||||
|
||||
jQuery( this ).parents('.um-new-dropdown').find('a').data('selected', 0).prop('data-selected', 0).attr('data-selected', 0);
|
||||
jQuery( this ).data('selected', 1).prop('data-selected', 1).attr('data-selected', 1);
|
||||
jQuery( this ).parents('.um-member-directory-sorting-a').find('> a').html( jQuery( this ).html() );
|
||||
directory.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a').data('selected', 0).prop('data-selected', 0).attr('data-selected', 0);
|
||||
directory.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"] a[data-value="' + sort + '"]').data('selected', 1).prop('data-selected', 1).attr('data-selected', 1);
|
||||
directory.find('.um-member-directory-sorting-a').find('> a').html( sorting_label );
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -78,6 +78,152 @@ if ( ! empty( $_POST['role'] ) ) {
|
||||
|
||||
$data = $_POST['role'];
|
||||
|
||||
$all_roles = array_keys( UM()->roles()->get_roles() );
|
||||
|
||||
if ( array_key_exists( '_um_priority', $data ) ) {
|
||||
$data['_um_priority'] = (int) $data['_um_priority'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_access_wpadmin', $data ) ) {
|
||||
$data['_um_can_access_wpadmin'] = (bool) $data['_um_can_access_wpadmin'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_not_see_adminbar', $data ) ) {
|
||||
$data['_um_can_not_see_adminbar'] = (bool) $data['_um_can_not_see_adminbar'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_edit_everyone', $data ) ) {
|
||||
$data['_um_can_edit_everyone'] = (bool) $data['_um_can_edit_everyone'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_edit_roles', $data ) && ! empty( $data['_um_can_edit_roles'] ) ) {
|
||||
$data['_um_can_edit_roles'] = array_filter( $data['_um_can_edit_roles'], function( $v, $k ) use ( $all_roles ) {
|
||||
return in_array( $v, $all_roles );
|
||||
}, ARRAY_FILTER_USE_BOTH );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_delete_everyone', $data ) ) {
|
||||
$data['_um_can_delete_everyone'] = (bool) $data['_um_can_delete_everyone'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_delete_roles', $data ) && ! empty( $data['_um_can_delete_roles'] ) ) {
|
||||
$data['_um_can_delete_roles'] = array_filter( $data['_um_can_delete_roles'], function( $v, $k ) use ( $all_roles ) {
|
||||
return in_array( $v, $all_roles );
|
||||
}, ARRAY_FILTER_USE_BOTH );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_edit_profile', $data ) ) {
|
||||
$data['_um_can_edit_profile'] = (bool) $data['_um_can_edit_profile'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_delete_profile', $data ) ) {
|
||||
$data['_um_can_delete_profile'] = (bool) $data['_um_can_delete_profile'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_view_all', $data ) ) {
|
||||
$data['_um_can_view_all'] = (bool) $data['_um_can_view_all'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_view_roles', $data ) && ! empty( $data['_um_can_view_roles'] ) ) {
|
||||
$data['_um_can_view_roles'] = array_filter( $data['_um_can_view_roles'], function( $v, $k ) use ( $all_roles ) {
|
||||
return in_array( $v, $all_roles );
|
||||
}, ARRAY_FILTER_USE_BOTH );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_make_private_profile', $data ) ) {
|
||||
$data['_um_can_make_private_profile'] = (bool) $data['_um_can_make_private_profile'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_can_access_private_profile', $data ) ) {
|
||||
$data['_um_can_access_private_profile'] = (bool) $data['_um_can_access_private_profile'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_profile_noindex', $data ) ) {
|
||||
$data['_um_profile_noindex'] = $data['_um_profile_noindex'] !== '' ? (bool) $data['_um_profile_noindex'] : $data['_um_profile_noindex'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_default_homepage', $data ) ) {
|
||||
$data['_um_default_homepage'] = (bool) $data['_um_default_homepage'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_redirect_homepage', $data ) ) {
|
||||
$data['_um_redirect_homepage'] = esc_url_raw( $data['_um_redirect_homepage'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_status', $data ) ) {
|
||||
$data['_um_status'] = ! in_array( sanitize_key( $data['_um_status'] ), [ 'approved', 'checkmail', 'pending' ] ) ? 'approved' : sanitize_key( $data['_um_status'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_auto_approve_act', $data ) ) {
|
||||
$data['_um_auto_approve_act'] = ! in_array( sanitize_key( $data['_um_auto_approve_act'] ), [ 'redirect_profile', 'redirect_url' ] ) ? 'redirect_profile' : sanitize_key( $data['_um_auto_approve_act'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_auto_approve_url', $data ) ) {
|
||||
$data['_um_auto_approve_url'] = esc_url_raw( $data['_um_auto_approve_url'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_login_email_activate', $data ) ) {
|
||||
$data['_um_login_email_activate'] = (bool) $data['_um_login_email_activate'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_checkmail_action', $data ) ) {
|
||||
$data['_um_checkmail_action'] = ! in_array( sanitize_key( $data['_um_checkmail_action'] ), [ 'show_message', 'redirect_url' ] ) ? 'show_message' : sanitize_key( $data['_um_checkmail_action'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_checkmail_message', $data ) ) {
|
||||
$data['_um_checkmail_message'] = sanitize_textarea_field( $data['_um_checkmail_message'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_checkmail_url', $data ) ) {
|
||||
$data['_um_checkmail_url'] = esc_url_raw( $data['_um_checkmail_url'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_url_email_activate', $data ) ) {
|
||||
$data['_um_url_email_activate'] = esc_url_raw( $data['_um_url_email_activate'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_pending_action', $data ) ) {
|
||||
$data['_um_pending_action'] = ! in_array( sanitize_key( $data['_um_pending_action'] ), [ 'show_message', 'redirect_url' ] ) ? 'show_message' : sanitize_key( $data['_um_pending_action'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_pending_message', $data ) ) {
|
||||
$data['_um_pending_message'] = sanitize_textarea_field( $data['_um_pending_message'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_pending_url', $data ) ) {
|
||||
$data['_um_pending_url'] = esc_url_raw( $data['_um_pending_url'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_after_login', $data ) ) {
|
||||
$data['_um_after_login'] = ! in_array( sanitize_key( $data['_um_after_login'] ), [ 'redirect_profile', 'redirect_url', 'refresh', 'redirect_admin' ] ) ? 'redirect_profile' : sanitize_key( $data['_um_after_login'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_login_redirect_url', $data ) ) {
|
||||
$data['_um_login_redirect_url'] = esc_url_raw( $data['_um_login_redirect_url'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_after_logout', $data ) ) {
|
||||
$data['_um_after_logout'] = ! in_array( sanitize_key( $data['_um_after_logout'] ), [ 'redirect_home', 'redirect_url' ] ) ? 'redirect_home' : sanitize_key( $data['_um_after_logout'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_logout_redirect_url', $data ) ) {
|
||||
$data['_um_logout_redirect_url'] = esc_url_raw( $data['_um_logout_redirect_url'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_after_delete', $data ) ) {
|
||||
$data['_um_after_delete'] = ! in_array( sanitize_key( $data['_um_after_delete'] ), [ 'redirect_home', 'redirect_url' ] ) ? 'redirect_home' : sanitize_key( $data['_um_after_delete'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( '_um_delete_redirect_url', $data ) ) {
|
||||
$data['_um_delete_redirect_url'] = esc_url_raw( $data['_um_delete_redirect_url'] );
|
||||
}
|
||||
|
||||
if ( array_key_exists( 'wp_capabilities', $data ) && ! empty( $data['wp_capabilities'] ) ) {
|
||||
$data['wp_capabilities'] = array_map( 'boolval', array_filter( $data['wp_capabilities'] ) );
|
||||
}
|
||||
|
||||
$data = apply_filters( 'um_save_role_meta_sanitize', $data );
|
||||
|
||||
if ( 'add' == sanitize_key( $_GET['tab'] ) ) {
|
||||
|
||||
$data['name'] = trim( esc_html( strip_tags( $data['name'] ) ) );
|
||||
@@ -208,4 +354,4 @@ $screen_id = $current_screen->id; ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -149,8 +149,16 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
|
||||
|
||||
$max_upload_size = wp_max_upload_size();
|
||||
if ( ! $max_upload_size ) {
|
||||
$max_upload_size = 0;
|
||||
}
|
||||
|
||||
$localize_data = apply_filters( 'um_enqueue_localize_data', array(
|
||||
'nonce' => wp_create_nonce( "um-frontend-nonce" ),
|
||||
'max_upload_size' => $max_upload_size,
|
||||
'nonce' => wp_create_nonce( "um-frontend-nonce" ),
|
||||
) );
|
||||
wp_localize_script( 'um_scripts', 'um_scripts', $localize_data );
|
||||
|
||||
|
||||
@@ -2565,6 +2565,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
* @param array $items
|
||||
*/
|
||||
function dropdown_menu( $element, $trigger, $items = array() ) {
|
||||
// !!!!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; ?>">
|
||||
@@ -2585,14 +2586,15 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
* @param string $element
|
||||
* @param string $trigger
|
||||
* @param string $item
|
||||
* @param string $additional_attributes
|
||||
*/
|
||||
function dropdown_menu_js( $element, $trigger, $item ) {
|
||||
function dropdown_menu_js( $element, $trigger, $item, $additional_attributes = '' ) {
|
||||
?>
|
||||
|
||||
<div class="um-new-dropdown" data-element="<?php echo $element; ?>" data-trigger="<?php echo $trigger; ?>">
|
||||
<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}}}">{{{action.title}}}</a></li>
|
||||
<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>
|
||||
<# }); #>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -717,7 +717,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
}
|
||||
|
||||
$this->profile_role = $args['role'];
|
||||
} else {
|
||||
} elseif ( $this->profile_role != $args['role'] ) {
|
||||
ob_get_clean();
|
||||
return '';
|
||||
}
|
||||
@@ -1307,4 +1307,4 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1743,11 +1743,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$role = UM()->roles()->get_priority_user_role( $user_id );
|
||||
$permissions = UM()->roles()->role_data( $role );
|
||||
|
||||
if ( isset( $permissions['profile_noindex'] ) && $permissions['profile_noindex'] === '1' ) {
|
||||
if ( isset( $permissions['profile_noindex'] ) && (bool) $permissions['profile_noindex'] ) {
|
||||
// Setting "Avoid indexing profile by search engines" in [wp-admin > Ultimate Member > User Roles > Edit Role]
|
||||
$profile_noindex = true;
|
||||
|
||||
} elseif ( ( ! isset( $permissions['profile_noindex'] ) || $permissions['profile_noindex'] === '' ) && UM()->options()->get( 'profile_noindex' ) === '1' ) {
|
||||
} elseif ( ( ! isset( $permissions['profile_noindex'] ) || $permissions['profile_noindex'] === '' ) && (bool) UM()->options()->get( 'profile_noindex' ) ) {
|
||||
// Setting "Avoid indexing profile by search engines" in [wp-admin > Ultimate Member > Settings > General > Users]
|
||||
$profile_noindex = true;
|
||||
|
||||
@@ -2174,4 +2174,4 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
return $replace_placeholders;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-3
@@ -7,7 +7,7 @@ Tags: community, member, membership, user-profile, user-registration
|
||||
Requires PHP: 5.6
|
||||
Requires at least: 5.0
|
||||
Tested up to: 5.7
|
||||
Stable tag: 2.1.20
|
||||
Stable tag: 2.1.21
|
||||
License: GNU Version 2 or Any Later Version
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
@@ -155,10 +155,28 @@ 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.21: June 17, 2021 =
|
||||
|
||||
* Enhancements:
|
||||
- Added: `um_scripts.max_upload_size` localized variable getting from `wp_max_upload_size()`
|
||||
- Updated: dropdown.js library to make the stable working
|
||||
|
||||
* Bugfixes:
|
||||
- Fixed: Displaying different profile form shortcodes with different role visibility settings on the same page
|
||||
- Fixed: Displaying avatar on the logout page
|
||||
- Fixed: Role meta sanitizing and related XSS vulnerability
|
||||
|
||||
* Templates required update:
|
||||
- logout.php
|
||||
- members.php
|
||||
- members-list.php
|
||||
|
||||
* Cached and optimized/minified assets(JS/CSS) must be flushed/re-generated after upgrade
|
||||
|
||||
= 2.1.20: May 7, 2021 =
|
||||
|
||||
* Enhancements:
|
||||
- Added: Hook to unlock the ability to add new users through the registration form
|
||||
- Added: Hook `um_registration_for_loggedin_users` to unlock the ability to add new users through the registration form
|
||||
- Added: Filter hook 'um_change_usermeta_for_update' for extending `$to_update` usermeta array after all profile fields validations
|
||||
- Added: Filter hook 'um_profile_tabs_privacy_list' and 'um_profile_menu_can_view_tab' for extending privacy options for Profile Tabs
|
||||
|
||||
@@ -2775,4 +2793,4 @@ Credits to "James Golovich http://www.pritect.net" for the security checks
|
||||
|
||||
= 1.0.0: January, 2015 =
|
||||
|
||||
* First official release!
|
||||
* First official release!
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<div class="um-misc-img">
|
||||
<a href="<?php echo esc_url( um_get_core_page( 'user' ) ); ?>">
|
||||
<?php echo um_user( 'profile_photo', 80 ); ?>
|
||||
<?php echo get_avatar( um_user( 'ID' ), 80 ) ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -64,4 +64,4 @@
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -276,7 +276,7 @@ if ( ( ( $search && $show_search ) || ( $filters && $show_filters && count( $sea
|
||||
<?php $items = array();
|
||||
|
||||
foreach ( $sorting_options as $value => $title ) {
|
||||
$items[] = '<a href="javascript:void(0);" data-value="' . esc_attr( $value ) . '" data-selected="' . ( ( $sort_from_url == $value ) ? '1' : '0' ) . '" data-default="' . ( ( $default_sorting == $value ) ? '1' : '0' ) . '">' . $title . '</a>'; ?>
|
||||
$items[] = '<a href="javascript:void(0);" data-directory-hash="' . esc_attr( substr( md5( $form_id ), 10, 5 ) ) . '" class="um-sortyng-by-' . esc_attr( $value ) . '" data-value="' . esc_attr( $value ) . '" data-selected="' . ( ( $sort_from_url == $value ) ? '1' : '0' ) . '" data-default="' . ( ( $default_sorting == $value ) ? '1' : '0' ) . '">' . $title . '</a>'; ?>
|
||||
<?php }
|
||||
|
||||
UM()->member_directory()->dropdown_menu( '.um-member-directory-sorting-a', 'click', $items ); ?>
|
||||
|
||||
+2
-2
@@ -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.20
|
||||
Version: 2.1.21
|
||||
Author: Ultimate Member
|
||||
Author URI: http://ultimatemember.com/
|
||||
Text Domain: ultimate-member
|
||||
@@ -21,4 +21,4 @@ define( 'ultimatemember_version', $plugin_data['Version'] );
|
||||
define( 'ultimatemember_plugin_name', $plugin_data['Name'] );
|
||||
|
||||
require_once 'includes/class-functions.php';
|
||||
require_once 'includes/class-init.php';
|
||||
require_once 'includes/class-init.php';
|
||||
|
||||
Reference in New Issue
Block a user