diff --git a/README.md b/README.md
index 2084e86e..cb06e481 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Ultimate Member is the #1 user profile & membership plugin for WordPress. The pl
| Latest Version |Requires at least|Stable Tag|
| :------------: |:------------:|:------------:|
-| 2.0.17 | WordPress 4.9 or higher| 2.0.17 |
+| 2.0.18 | WordPress 4.9 or higher| 2.0.18 |
Features of the plugin include:
@@ -48,7 +48,7 @@ GNU Version 2 or Any Later Version
Releases
====================
-[Official Release Version: 2.0.17](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.17).
+[Official Release Version: 2.0.18](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.18).
[Official Release Version: 1.3.88](https://github.com/ultimatemember/ultimatemember/releases).
diff --git a/assets/css/um-styles.css b/assets/css/um-styles.css
index 9296a16e..1c1053a0 100644
--- a/assets/css/um-styles.css
+++ b/assets/css/um-styles.css
@@ -621,11 +621,40 @@ input[type=submit].um-button:hover {
-moz-border-radius: 4px !important;
-webkit-border-radius: 4px !important;
border-radius: 4px !important;
- border-top: 1px solid rgba(0,0,0,0.0) !important;
- border-bottom: 2px solid rgba(0, 0, 0, 0.1) !important;
+ -webkit-box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
+ box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
opacity: 1;
}
+a.um-button {
+ font-size: 15px;
+ border: none !important;
+ display: block;
+ width: 100%;
+ line-height: 1em !important;
+ padding: 16px 20px !important;
+ text-decoration: none !important;
+ text-align: center;
+ text-transform: none !important;
+ font-weight: normal !important;
+ overflow: hidden;
+ position: relative;
+
+ transition: 0.25s;
+ box-sizing: border-box;
+ -moz-border-radius: 4px !important;
+ -webkit-border-radius: 4px !important;
+ border-radius: 4px !important;
+ -webkit-box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
+ box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
+ opacity: 1;
+}
+
+a.um-button:hover {
+ -webkit-box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
+ box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
+}
+
.um-button.um-btn-auto-width {
width: auto;
diff --git a/assets/js/um-conditional.js b/assets/js/um-conditional.js
index c66433d3..11a58835 100644
--- a/assets/js/um-conditional.js
+++ b/assets/js/um-conditional.js
@@ -12,7 +12,6 @@ jQuery(document).ready( function (){
function um_get_field_default_value( $dom ) {
var default_value = '';
var type = um_get_field_type($dom);
-
switch ( type ) {
case 'text':
@@ -25,7 +24,6 @@ jQuery(document).ready( function (){
case 'multiselect':
default_value = $dom.find('select').val();
-
break;
case 'radio':
@@ -249,7 +247,6 @@ jQuery(document).ready( function (){
}
if (condition.operator == 'equals to') {
-
if (condition.value == live_field_value && um_in_array(live_field_value, $owners_values[condition.owner])) {
$owners[condition.owner][index] = true;
} else {
@@ -505,17 +502,22 @@ jQuery(document).ready( function (){
}
}
- jQuery(document).on('change', '.um-field select, .um-field input[type=radio], .um-field input[type=checkbox]', function () {
+ jQuery(document).on('change', '.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]', function () {
var me = jQuery(this);
um_apply_conditions(me, false);
});
- jQuery(document).on('input change', '.um-field input[type=text]', function () {
+ jQuery(document).on('input change', '.um-field input[type="text"]', function () {
var me = jQuery(this);
um_apply_conditions(me, false);
});
- jQuery(document).on('input change', '.um-field input[type=password]', function () {
+ jQuery(document).on('input change', '.um-field input[type="number"]', function () {
+ var me = jQuery(this);
+ um_apply_conditions(me, false);
+ });
+
+ jQuery(document).on('input change', '.um-field input[type="password"]', function () {
var me = jQuery(this);
um_apply_conditions(me, false);
});
diff --git a/assets/js/um-conditional.min.js b/assets/js/um-conditional.min.js
index 53af0c12..4b9c8602 100644
--- a/assets/js/um-conditional.min.js
+++ b/assets/js/um-conditional.min.js
@@ -1 +1 @@
-jQuery(document).ready(function(){function e(e){var n="",a=i(e);switch(a){case"text":case"number":case"date":case"textarea":case"select":n=e.find("input:text,input[type=number],textarea,select").val();break;case"multiselect":n=e.find("select").val();break;case"radio":e.find("input[type=radio]:checked").length>=1&&(n=e.find("input[type=radio]:checked").val());break;case"checkbox":e.find("input[type=checkbox]:checked").length>=1&&(e.find("input[type=checkbox]:checked").length>1?e.find("input[type=checkbox]:checked").each(function(){n=n+jQuery(this).val()+" "}):n=e.find("input[type=checkbox]:checked").val())}return{type:a,value:n}}function n(e){var n=i(e);switch(n){case"text":case"number":case"date":case"textarea":case"select":case"multiselect":case"radio":case"checkbox":return e.find("input,textarea,select")}return""}function i(e){var n="",i=e.attr("class");return jQuery.each(i.split(" "),function(e,i){i.indexOf("um-field-type")!=-1&&(n=i.split("_")[1])}),n}function a(e){var n=[];return jQuery.each(h,function(i,a){a.field.parent==e&&n.push(a.field.condition)}),n}function t(e){return um_live_field=e.parents(".um-field").data("key"),um_live_value=e.val(),e.is(":checkbox")&&(um_live_value="",e.parents(".um-field").find("input:checked").length>1?e.parents(".um-field").find("input:checked").each(function(){um_live_value=um_live_value+jQuery(this).val()+" "}):e.parents(".um-field").find("input:checked").length>=1&&(um_live_value=e.parents(".um-field").find("input:checked").val())),e.is(":radio")&&(um_live_value=e.parents(".um-field").find("input[type=radio]:checked").val()),um_live_value}function c(e,n,i){var a,t=!1,i=!!i;for(a in n)if(i&&n[a]===e||!i&&n[a]==e){t=!0;break}return t}function r(e,n){var a=e.parents(".um-field[data-key]").data("key"),r=p[a],u=t(e),d={},s={},l={};jQuery.each(r,function(e,n){"undefined"==typeof s[n.owner]&&(s[n.owner]=[],l[n.owner]={}),s[n.owner].push(n.value),l[n.owner]=n}),jQuery.each(r,function(n,a){"undefined"==typeof d[a.owner]&&(d[a.owner]={}),"empty"==a.operator&&(!u||""==u&&c(u,s[a.owner])?d[a.owner][n]=!0:d[a.owner][n]=!1),"not empty"==a.operator&&(u&&""!=u&&!c(u,s[a.owner])?d[a.owner][n]=!0:d[a.owner][n]=!1),"equals to"==a.operator&&(a.value==u&&c(u,s[a.owner])?d[a.owner][n]=!0:d[a.owner][n]=!1),"not equals"==a.operator&&(jQuery.isNumeric(a.value)&&parseInt(u)!=parseInt(a.value)&&u&&!c(u,s[a.owner])?d[a.owner][n]=!0:a.value==u||c(u,s[a.owner])?d[a.owner][n]=!1:d[a.owner][n]=!0),"greater than"==a.operator&&(jQuery.isNumeric(a.value)&&parseInt(u)>parseInt(a.value)?d[a.owner][n]=!0:d[a.owner][n]=!1),"less than"==a.operator&&(jQuery.isNumeric(a.value)&&parseInt(u)=0&&c(a.value,u)?d[a.owner][n]=!0:d[a.owner][n]=!1:"checkbox"==i(e.parents(".um-field[data-key]"))?u&&u.indexOf(a.value)>=0?d[a.owner][n]=!0:d[a.owner][n]=!1:u&&u.indexOf(a.value)>=0&&c(u,s[a.owner])?d[a.owner][n]=!0:d[a.owner][n]=!1)}),jQuery.each(d,function(n,i){c(!0,i)?o(e,l[n],!0):o(e,l[n],!1)}),e.trigger("um_fields_change")}function o(e,n,i){var a=jQuery('div.um-field[data-key="'+n.owner+'"]');"show"==n.action&&i&&(a.show(),l(a),u(a)),"show"!=n.action||i||(a.hide(),s(a)),"hide"==n.action&&i&&(a.hide(),s(a)),"hide"!=n.action||i||(a.show(),l(a),u(a)),e.removeClass("um-field-has-changed")}function u(e){var a=i(e),t=e.data("key"),c=v[t];switch(a){case"text":case"number":case"date":case"textarea":e.find("input:text,input[type=number],textareas").val(c.value);break;case"select":e.find("select").find("option").prop("selected",!1),e.find("select").val(c.value),e.find("select").trigger("change");break;case"multiselect":e.find("select").find("option").prop("selected",!1),jQuery.each(c.value,function(n,i){e.find("select").find('option[value="'+i+'"]').attr("selected",!0)}),e.find("select").trigger("change");break;case"checkbox":if(e.find("input[type=checkbox]:checked").length>=1)if(e.find("input[type=checkbox]:checked").removeAttr("checked"),e.find("span.um-field-checkbox-state i").removeClass("um-icon-android-checkbox-outline"),e.find("span.um-field-checkbox-state i").addClass("um-icon-android-checkbox-outline-blank"),e.find(".um-field-checkbox.active").removeClass("active"),jQuery.isArray(c.value))jQuery.each(c.value,function(n,i){var a=e.find('input[type=checkbox][value="'+i+'"]');a.attr("checked",!0),a.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),a.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),a.closest(".um-field-checkbox").addClass("active")});else{var r=e.find('input[type=checkbox][value="'+c.value+'"]');r.attr("checked",!0),r.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),r.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),r.closest(".um-field-checkbox").addClass("active")}break;case"radio":e.find("input[type=radio]:checked").length>=1&&setTimeout(function(){e.find("input[type=radio]:checked").removeAttr("checked"),e.find("span.um-field-radio-state i").removeClass("um-icon-android-radio-button-on"),e.find("span.um-field-radio-state i").addClass("um-icon-android-radio-button-off"),e.find(".um-field-radio.active").removeClass("active");var n=e.find("input[type=radio][value='"+c.value+"']");n.attr("checked",!0),n.closest(".um-field-radio").find("i").removeClass("um-icon-android-radio-button-off"),n.closest(".um-field-radio").find("i").addClass("um-icon-android-radio-button-on"),n.closest(".um-field-radio").addClass("active")},100)}if(!e.hasClass("um-field-has-changed")){var o=n(e);"radio"!=a&&"checkbox"!=a||(o=o.find(":checked")),o&&(o.trigger("change"),e.addClass("um-field-has-changed"))}}function d(){jQuery.each(p,function(e,n){(jQuery('.um-field[data-key="'+e+'"]:hidden').length>=1||"none"==jQuery('.um-field[data-key="'+e+'"]').css("display"))&&jQuery.each(n,function(e,n){jQuery('.um-field[data-key="'+n.owner+'"]').hide()})})}function s(e){"undefined"!=typeof jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"hidden"})}function l(e){"undefined"!=typeof jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"visible"})}function f(){var i=[];jQuery(".um-field[data-key]").each(function(){var n=jQuery(this).data("key");i.push(n);var a={};jQuery.each(jQuery(this)[0].attributes,function(e,n){if(n.name.indexOf("data-cond")!=-1){var i=n.name.slice(10),t=i.substring(1,0),c=i.slice(2);"undefined"==typeof a[t]&&(a[t]={}),a[t][c]=n.value}}),jQuery.each(a,function(e,i){var a={field:{owner:n,action:i.action,parent:i.field,operator:i.operator,value:i.value,condition:{owner:n,action:i.action,operator:i.operator,value:i.value}}};h.push(a)}),v[jQuery(this).data("key")]=e(jQuery(this))}),jQuery.each(i,function(e,n){p[n]=a(n)}),jQuery(".um-field[data-key]:visible").each(function(){var e=jQuery(this),i=n(e);"undefined"!=typeof i.trigger&&i.trigger("change")})}var h=[],p={},v={};jQuery(document).on("change",".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]",function(){var e=jQuery(this);r(e,!1)}),jQuery(document).on("input change",".um-field input[type=text]",function(){var e=jQuery(this);r(e,!1)}),jQuery(document).on("input change",".um-field input[type=password]",function(){var e=jQuery(this);r(e,!1)}),jQuery(document).on("um_fields_change",function(){d(),d()}),f()});
\ No newline at end of file
+jQuery(document).ready(function(){var e,t=[],d={},o={};function r(e){switch(s(e)){case"text":case"number":case"date":case"textarea":case"select":case"multiselect":case"radio":case"checkbox":return e.find("input,textarea,select")}return""}function s(e){var n="",i=e.attr("class");return jQuery.each(i.split(" "),function(e,i){-1!=i.indexOf("um-field-type")&&(n=i.split("_")[1])}),n}function l(e,i,n){var a,t=!1;n=!!n;for(a in i)if(n&&i[a]===e||!n&&i[a]==e){t=!0;break}return t}function i(n,e){var i,a=n.parents(".um-field[data-key]").data("key"),t=d[a],c=(i=n,um_live_field=i.parents(".um-field").data("key"),um_live_value=i.val(),i.is(":checkbox")&&(um_live_value="",1parseInt(i.value)?o[i.owner][e]=!0:o[i.owner][e]=!1),"less than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(c)")[0].getContext)},init:function(){var i=this.defaults;t.each(i,function(t,e){switch(t){case"aspectRatio":i[t]=O(A(e))||n;break;case"autoCropArea":i[t]=O(A(e))||.8;break;case"minWidth":case"minHeight":i[t]=O(A(e))||0;break;case"maxWidth":case"maxHeight":i[t]=O(A(e))||o}}),this.image={rotate:0},this.load()},load:function(){var i,e,h=this,s=this.$element,r=this.element,n=this.image,o="";s.is("img")?e=s.prop("src"):s.is("canvas")&&this.support.canvas&&(e=r.toDataURL()),e&&(this.replaced&&(n.rotate=0),this.defaults.checkImageOrigin&&(s.prop("crossOrigin")||this.isCrossOriginURL(e))&&(o=" crossOrigin"),this.$clone=i=t(" '),i.one("load",function(){n.naturalWidth=this.naturalWidth||i.width(),n.naturalHeight=this.naturalHeight||i.height(),n.aspectRatio=n.naturalWidth/n.naturalHeight,h.url=e,h.ready=a,h.build()}),i.addClass(w).prependTo("body"))},isCrossOriginURL:function(t){var i=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!i||i[1]===h.protocol&&i[2]===h.hostname&&i[3]===h.port?s:a},build:function(){var i,e,h=this.$element,r=this.defaults;this.ready&&(this.built&&this.unbuild(),h.one(k,r.build),i=t.Event(k),h.trigger(i),i.isDefaultPrevented()||(this.$cropper=e=t(I.TEMPLATE),h.addClass(u),this.$clone.removeClass(w).prependTo(e),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(u).prependTo(this.$cropper),this.originalImage=t.extend({},this.image)),this.$container=h.parent(),this.$container.append(e),this.$canvas=e.find(".cropper-canvas"),this.$dragger=e.find(".cropper-dragger"),this.$viewer=e.find(".cropper-viewer"),r.autoCrop?this.cropped=a:this.$dragger.addClass(u),r.dragCrop&&this.setDragMode("crop"),r.modal&&this.$canvas.addClass(m),!r.dashed&&this.$dragger.find(".cropper-dashed").addClass(u),!r.movable&&this.$dragger.find(".cropper-face").data(g,"move"),!r.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(u),this.addListeners(),this.initPreview(),this.built=a,this.update(),this.replaced=s,h.one(R,r.built),h.trigger(R)))},unbuild:function(){this.built&&(this.built=s,this.removeListeners(),this.$preview.empty(),this.$preview=r,this.$dragger=r,this.$canvas=r,this.$container=r,this.$cropper.remove(),this.$cropper=r)},update:function(t){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),t?(this.setData(t,a),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(t.proxy(this.update,this,this.getData()),200)},preview:function(){var i=this.image,e=this.dragger,h=i.width,a=i.height,s=e.left-i.left,r=e.top-i.top;this.$viewer.find("img").css({width:h,height:a,marginLeft:-s,marginTop:-r}),this.$preview.each(function(){var i=t(this),n=i.width()/e.width;i.find("img").css({width:h*n,height:a*n,marginLeft:-s*n,marginTop:-r*n})})},addListeners:function(){var h=this.defaults;this.$element.on(z,h.dragstart).on(L,h.dragmove).on(Y,h.dragend),this.$cropper.on(y,t.proxy(this.dragstart,this)).on(C,t.proxy(this.dblclick,this)),h.zoomable&&this.$cropper.on(W,t.proxy(this.wheel,this)),h.multiple?this.$cropper.on($,t.proxy(this.dragmove,this)).on(D,t.proxy(this.dragend,this)):e.on($,this._dragmove=T(this.dragmove,this)).on(D,this._dragend=T(this.dragend,this)),i.on(H,this._resize=T(this.resize,this))},removeListeners:function(){var t=this.defaults;this.$element.off(z,t.dragstart).off(L,t.dragmove).off(Y,t.dragend),this.$cropper.off(y,this.dragstart).off(C,this.dblclick),t.zoomable&&this.$cropper.off(W,this.wheel),t.multiple?this.$cropper.off($,this.dragmove).off(D,this.dragend):e.off($,this._dragmove).off(D,this._dragend),i.off(H,this._resize)},initPreview:function(){var i=' ';this.$preview=t(this.defaults.preview),this.$viewer.html(i),this.$preview.html(i).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var t=this.$container;t!==r&&(this.container={width:P(t.width(),300),height:P(t.height(),150)})},initCropper:function(){var t,i=this.container,e=this.image;e.naturalWidth*i.height/e.naturalHeight-i.width>=0?(t={width:i.width,height:i.width/e.aspectRatio,left:0},t.top=(i.height-t.height)/2):(t={width:i.height*e.aspectRatio,height:i.height,top:0},t.left=(i.width-t.width)/2),this.$cropper&&this.$cropper.css({width:t.width,height:t.height,left:t.left,top:t.top}),this.cropper=t},initImage:function(){var i=this.image,e=this.cropper,h={_width:e.width,_height:e.height,width:e.width,height:e.height,left:0,top:0,ratio:e.width/i.naturalWidth};this.defaultImage=t.extend({},i,h),i._width!==e.width||i._height!==e.height?t.extend(i,h):(i=t.extend({},h,i),this.replaced&&(i.ratio=h.ratio)),this.image=i,this.renderImage()},renderImage:function(t){var i=this.image;"zoom"===t&&(i.left-=(i.width-i.oldWidth)/2,i.top-=(i.height-i.oldHeight)/2),i.left=_(P(i.left,i._width-i.width),0),i.top=_(P(i.top,i._height-i.height),0),this.$clone.css({width:i.width,height:i.height,marginLeft:i.left,marginTop:i.top}),t&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var i,e=this.defaults,h=this.cropper,a=e.aspectRatio||this.image.aspectRatio,s=this.image.ratio;i=h.height*a-h.width>=0?{height:h.width/a,width:h.width,left:0,top:(h.height-h.width/a)/2,maxWidth:h.width,maxHeight:h.width/a}:{height:h.height,width:h.height*a,left:(h.width-h.height*a)/2,top:0,maxWidth:h.height*a,maxHeight:h.height},i.minWidth=0,i.minHeight=0,e.aspectRatio?(isFinite(e.maxWidth)?(i.maxWidth=_(i.maxWidth,e.maxWidth*s),i.maxHeight=i.maxWidth/a):isFinite(e.maxHeight)&&(i.maxHeight=_(i.maxHeight,e.maxHeight*s),i.maxWidth=i.maxHeight*a),e.minWidth>0?(i.minWidth=P(0,e.minWidth*s),i.minHeight=i.minWidth/a):e.minHeight>0&&(i.minHeight=P(0,e.minHeight*s),i.minWidth=i.minHeight*a)):(i.maxWidth=_(i.maxWidth,e.maxWidth*s),i.maxHeight=_(i.maxHeight,e.maxHeight*s),i.minWidth=P(0,e.minWidth*s),i.minHeight=P(0,e.minHeight*s)),i.minWidth=_(i.maxWidth,i.minWidth),i.minHeight=_(i.maxHeight,i.minHeight),i.height*=e.autoCropArea,i.width*=e.autoCropArea,i.left=(h.width-i.width)/2,i.top=(h.height-i.height)/2,i.oldLeft=i.left,i.oldTop=i.top,this.defaultDragger=i,this.dragger=t.extend({},i)},renderDragger:function(){var t=this.dragger,i=this.cropper;t.width>t.maxWidth?(t.width=t.maxWidth,t.left=t.oldLeft):t.widtht.maxHeight?(t.height=t.maxHeight,t.top=t.oldTop):t.height').one("load",function(){o.width=this.width,o.height=this.height,h.clearRect(0,0,o.width,o.height),h.drawImage(this,0,0),r.load()})))},setData:function(i,e){var h=this.cropper,a=this.dragger,s=this.image,n=this.defaults.aspectRatio;this.built&&typeof i!==d&&((i===r||t.isEmptyObject(i))&&(a=t.extend({},this.defaultDragger)),t.isPlainObject(i)&&!t.isEmptyObject(i)&&(e||(this.defaults.data=i),i=this.transformData(i),X(i.x)&&i.x<=h.width-s.left&&(a.left=i.x+s.left),X(i.y)&&i.y<=h.height-s.top&&(a.top=i.y+s.top),n?X(i.width)&&i.width<=a.maxWidth&&i.width>=a.minWidth?(a.width=i.width,a.height=a.width/n):X(i.height)&&i.height<=a.maxHeight&&i.height>=a.minHeight&&(a.height=i.height,a.width=a.height*n):(X(i.width)&&i.width<=a.maxWidth&&i.width>=a.minWidth&&(a.width=i.width),X(i.height)&&i.height<=a.maxHeight&&i.height>=a.minHeight&&(a.height=i.height))),this.dragger=a,this.renderDragger())},getData:function(t){var i=this.dragger,e=this.image,h={};return this.built&&(h={x:i.left-e.left,y:i.top-e.top,width:i.width,height:i.height},h=this.transformData(h,a,t)),h},transformData:function(i,e,h){var a=this.image.ratio,s={};return t.each(i,function(t,i){i=A(i),c.test(t)&&!isNaN(i)&&(s[t]=e?h?Math.round(i/a):i/a:i*a)}),s},setAspectRatio:function(t){var i="auto"===t;t=A(t),(i||!isNaN(t)&&t>0)&&(this.defaults.aspectRatio=i?n:t,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var i={};return this.ready&&t.each(this.image,function(t,e){f.test(t)&&(i[t]=e)}),i},getDataURL:function(i,e,h){var a,s=t("")[0],r=this.getData(),n="";return t.isPlainObject(i)||(h=e,e=i,i={}),i=t.extend({width:r.width,height:r.height},i),this.cropped&&this.support.canvas&&(s.width=i.width,s.height=i.height,a=s.getContext("2d"),"image/jpeg"===e&&(a.fillStyle="#fff",a.fillRect(0,0,i.width,i.height)),a.drawImage(this.$clone[0],r.x,r.y,r.width,r.height,0,0,i.width,i.height),n=s.toDataURL(e,h)),n},setDragMode:function(t){var i=this.$canvas,e=this.defaults,h=s,r=s;if(this.built&&!this.disabled){switch(t){case"crop":e.dragCrop&&(h=a,i.data(g,t));break;case"move":r=a,i.data(g,t);break;default:i.removeData(g)}i.toggleClass(x,h).toggleClass(v,r)}},enable:function(){this.built&&(this.disabled=s,this.$cropper.removeClass(b))},disable:function(){this.built&&(this.disabled=a,this.$cropper.addClass(b))},rotate:function(t){var i=this.image;t=A(t)||0,this.built&&0!==t&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=a,t=i.rotate=(i.rotate+t)%360,this.replace(this.getRotatedDataURL(t),!0))},getRotatedDataURL:function(i){var e=t("")[0],h=e.getContext("2d"),a=i*Math.PI/180,s=O(i)%180,r=s>90?180-s:s,n=r*Math.PI/180,o=this.originalImage,d=o.naturalWidth,g=o.naturalHeight,l=O(d*j(n)+g*U(n)),p=O(d*U(n)+g*j(n));return e.width=l,e.height=p,h.save(),h.translate(l/2,p/2),h.rotate(a),h.drawImage(this.$original[0],-d/2,-g/2,d,g),h.restore(),e.toDataURL()},zoom:function(t){var i,e,h,a=this.image;t=A(t),this.built&&t&&!this.disabled&&this.defaults.zoomable&&(i=a.width*(1+t),e=a.height*(1+t),h=i/a._width,h>10||(h<1&&(i=a._width,e=a._height),h<=1?this.setDragMode("crop"):this.setDragMode("move"),a.oldWidth=a.width,a.oldHeight=a.height,a.width=i,a.height=e,a.ratio=a.width/a.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||(this.$canvas.hasClass(x)?this.setDragMode("move"):this.setDragMode("crop"))},wheel:function(t){var i,e=t.originalEvent,h=117.25,a=5,s=166.66665649414062,r=.1;this.disabled||(t.preventDefault(),e.deltaY?(i=e.deltaY,i=i%a===0?i/a:i%h===0?i/h:i/s):i=e.wheelDelta?-e.wheelDelta/120:e.detail?e.detail/3:0,this.zoom(i*r))},dragstart:function(i){var e,h,r,n=i.originalEvent.touches,o=i;if(!this.disabled){if(n){if(r=n.length,r>1){if(!this.defaults.zoomable||2!==r)return;o=n[1],this.startX2=o.pageX,this.startY2=o.pageY,e="zoom"}o=n[0]}if(e=e||t(o.target).data(g),p.test(e)){if(i.preventDefault(),h=t.Event(z),this.$element.trigger(h),h.isDefaultPrevented())return;this.directive=e,this.cropping=s,this.startX=o.pageX,this.startY=o.pageY,"crop"===e&&(this.cropping=a,this.$canvas.addClass(m))}}},dragmove:function(i){var e,h,a=i.originalEvent.touches,s=i;if(!this.disabled){if(a){if(h=a.length,h>1){if(!this.defaults.zoomable||2!==h)return;s=a[1],this.endX2=s.pageX,this.endY2=s.pageY}s=a[0]}if(this.directive){if(i.preventDefault(),e=t.Event(L),this.$element.trigger(e),e.isDefaultPrevented())return;this.endX=s.pageX,this.endY=s.pageY,this.dragging()}}},dragend:function(i){var e;if(!this.disabled&&this.directive){if(i.preventDefault(),e=t.Event(Y),this.$element.trigger(e),e.isDefaultPrevented())return;this.cropping&&(this.cropping=s,this.$canvas.toggleClass(m,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var t,i=this.directive,e=this.image,h=this.cropper,r=h.width,n=h.height,o=this.dragger,d=o.width,g=o.height,l=o.left,p=o.top,c=l+d,f=p+g,m=a,w=this.defaults,v=w.aspectRatio,x={x:this.endX-this.startX,y:this.endY-this.startY};switch(v&&(x.X=x.y*v,x.Y=x.x/v),i){case"all":l+=x.x,p+=x.y;break;case"e":if(x.x>=0&&(c>=r||v&&(p<=0||f>=n))){m=s;break}d+=x.x,v&&(g=d/v,p-=x.Y/2),d<0&&(i="w",d=0);break;case"n":if(x.y<=0&&(p<=0||v&&(l<=0||c>=r))){m=s;break}g-=x.y,p+=x.y,v&&(d=g*v,l+=x.X/2),g<0&&(i="s",g=0);break;case"w":if(x.x<=0&&(l<=0||v&&(p<=0||f>=n))){m=s;break}d-=x.x,l+=x.x,v&&(g=d/v,p+=x.Y/2),d<0&&(i="e",d=0);break;case"s":if(x.y>=0&&(f>=n||v&&(l<=0||c>=r))){m=s;break}g+=x.y,v&&(d=g*v,l-=x.X/2),g<0&&(i="n",g=0);break;case"ne":if(v){if(x.y<=0&&(p<=0||c>=r)){m=s;break}g-=x.y,p+=x.y,d=g*v}else x.x>=0?c0&&(g-=x.y,p+=x.y):(g-=x.y,p+=x.y);g<0&&(i="sw",g=0,d=0);break;case"nw":if(v){if(x.y<=0&&(p<=0||l<=0)){m=s;break}g-=x.y,p+=x.y,d=g*v,l+=x.X}else x.x<=0?l>0?(d-=x.x,l+=x.x):x.y<=0&&p<=0&&(m=s):(d-=x.x,l+=x.x),x.y<=0?p>0&&(g-=x.y,p+=x.y):(g-=x.y,p+=x.y);g<0&&(i="se",g=0,d=0);break;case"sw":if(v){if(x.x<=0&&(l<=0||f>=n)){m=s;break}d-=x.x,l+=x.x,g=d/v}else x.x<=0?l>0?(d-=x.x,l+=x.x):x.y>=0&&f>=n&&(m=s):(d-=x.x,l+=x.x),x.y>=0?f=0&&(c>=r||f>=n)){m=s;break}d+=x.x,g=d/v}else x.x>=0?c=0&&f>=n&&(m=s):d+=x.x,x.y>=0?f0?x.y>0?i="se":(i="ne",p-=g):x.y>0?(i="sw",l-=d):(i="nw",l-=d,p-=g),this.cropped||(this.cropped=a,this.$dragger.removeClass(u)))}m&&(o.width=d,o.height=g,o.left=l,o.top=p,this.directive=i,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},I.TEMPLATE=function(t,i){return i=i.split(","),t.replace(/\d+/g,function(t){return i[t]})}('<0 6="5-container"><0 6="5-canvas">0><0 6="5-dragger"><1 6="5-viewer">1><1 6="5-8 8-h">1><1 6="5-8 8-v">1><1 6="5-face" 3-2="all">1><1 6="5-7 7-e" 3-2="e">1><1 6="5-7 7-n" 3-2="n">1><1 6="5-7 7-w" 3-2="w">1><1 6="5-7 7-s" 3-2="s">1><1 6="5-4 4-e" 3-2="e">1><1 6="5-4 4-n" 3-2="n">1><1 6="5-4 4-w" 3-2="w">1><1 6="5-4 4-s" 3-2="s">1><1 6="5-4 4-ne" 3-2="ne">1><1 6="5-4 4-nw" 3-2="nw">1><1 6="5-4 4-sw" 3-2="sw">1><1 6="5-4 4-se" 3-2="se">1>0>0>',"div,span,directive,data,point,cropper,class,line,dashed"),I.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:t.noop,preview:"",multiple:s,autoCrop:a,dragCrop:a,dashed:a,modal:a,movable:a,resizable:a,zoomable:a,rotatable:a,checkImageOrigin:a,minWidth:0,minHeight:0,maxWidth:o,maxHeight:o,build:r,built:r,dragstart:r,dragmove:r,dragend:r},I.setDefaults=function(i){t.extend(I.DEFAULTS,i)},I.other=t.fn.cropper,t.fn.cropper=function(i){var e,h=M(arguments,1);return this.each(function(){var a,s=t(this),r=s.data("cropper");r||s.data("cropper",r=new I(this,i)),"string"==typeof i&&t.isFunction(a=r[i])&&(e=a.apply(r,h))}),typeof e!==d?e:this},t.fn.cropper.Constructor=I,t.fn.cropper.setDefaults=I.setDefaults,t.fn.cropper.noConflict=function(){return t.fn.cropper=I.other,this}});
\ No newline at end of file
+!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}(function(l){"use strict";var i,e=l(window),h=l(document),a=window.location,D=!0,W=!1,r=null,n="undefined",o="directive",t=".cropper",d=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,g=/^(x|y|width|height)$/,s=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,p="cropper-modal",H="cropper-hidden",c="cropper-invisible",f="cropper-crop",m="cropper-disabled",u="mousedown touchstart",w="mousemove touchmove",v="mouseup mouseleave touchend touchleave touchcancel",x="wheel mousewheel DOMMouseScroll",b="resize"+t,y="dblclick",$="build"+t,C="built"+t,k="dragstart"+t,R="dragmove"+t,z="dragend"+t,L=function(t){return"number"==typeof t},Y=function(t,i){var e=[];return"number"==typeof i&&e.push(i),e.slice.apply(t,e)},X=function(t,i){var e=Y(arguments,2);return function(){return t.apply(i,e.concat(Y(arguments)))}},M=function(t,i){this.element=t,this.$element=l(t),this.defaults=l.extend({},M.DEFAULTS,l.isPlainObject(i)?i:{}),this.$original=r,this.ready=W,this.built=W,this.cropped=W,this.rotated=W,this.disabled=W,this.replaced=W,this.init()},T=Math.sqrt,I=Math.min,E=Math.max,_=Math.abs,P=Math.sin,O=Math.cos,U=parseFloat;M.prototype={constructor:M,support:{canvas:l.isFunction(l("")[0].getContext)},init:function(){var e=this.defaults;l.each(e,function(t,i){switch(t){case"aspectRatio":e[t]=_(U(i))||NaN;break;case"autoCropArea":e[t]=_(U(i))||.8;break;case"minWidth":case"minHeight":e[t]=_(U(i))||0;break;case"maxWidth":case"maxHeight":e[t]=_(U(i))||1/0}}),this.image={rotate:0},this.load()},load:function(){var t,i,e=this,h=this.$element,a=this.element,s=this.image,r="";h.is("img")?i=h.prop("src"):h.is("canvas")&&this.support.canvas&&(i=a.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(h.prop("crossOrigin")||this.isCrossOriginURL(i))&&(r=" crossOrigin"),this.$clone=t=l(" '),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,e.url=i,e.ready=D,e.build()}),t.addClass(c).prependTo("body"))},isCrossOriginURL:function(t){var i=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!i||i[1]===a.protocol&&i[2]===a.hostname&&i[3]===a.port?W:D},build:function(){var t,i,e=this.$element,h=this.defaults;this.ready&&(this.built&&this.unbuild(),e.one($,h.build),t=l.Event($),e.trigger(t),t.isDefaultPrevented()||(this.$cropper=i=l(M.TEMPLATE),e.addClass(H),this.$clone.removeClass(c).prependTo(i),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(H).prependTo(this.$cropper),this.originalImage=l.extend({},this.image)),this.$container=e.parent(),this.$container.append(i),this.$canvas=i.find(".cropper-canvas"),this.$dragger=i.find(".cropper-dragger"),this.$viewer=i.find(".cropper-viewer"),h.autoCrop?this.cropped=D:this.$dragger.addClass(H),h.dragCrop&&this.setDragMode("crop"),h.modal&&this.$canvas.addClass(p),!h.dashed&&this.$dragger.find(".cropper-dashed").addClass(H),!h.movable&&this.$dragger.find(".cropper-face").data(o,"move"),!h.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(H),this.addListeners(),this.initPreview(),this.built=D,this.update(),this.replaced=W,e.one(C,h.built),e.trigger(C)))},unbuild:function(){this.built&&(this.built=W,this.removeListeners(),this.$preview.empty(),this.$preview=r,this.$dragger=r,this.$canvas=r,this.$container=r,this.$cropper.remove(),this.$cropper=r)},update:function(t){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),t?(this.setData(t,D),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(l.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,e=this.dragger,h=t.width,a=t.height,s=e.left-t.left,r=e.top-t.top;this.$viewer.find("img").css({width:h,height:a,marginLeft:-s,marginTop:-r}),this.$preview.each(function(){var t=l(this),i=t.width()/e.width;t.find("img").css({width:h*i,height:a*i,marginLeft:-s*i,marginTop:-r*i})})},addListeners:function(){var t=this.defaults;this.$element.on(k,t.dragstart).on(R,t.dragmove).on(z,t.dragend),this.$cropper.on(u,l.proxy(this.dragstart,this)).on(y,l.proxy(this.dblclick,this)),t.zoomable&&this.$cropper.on(x,l.proxy(this.wheel,this)),t.multiple?this.$cropper.on(w,l.proxy(this.dragmove,this)).on(v,l.proxy(this.dragend,this)):h.on(w,this._dragmove=X(this.dragmove,this)).on(v,this._dragend=X(this.dragend,this)),e.on(b,this._resize=X(this.resize,this))},removeListeners:function(){var t=this.defaults;this.$element.off(k,t.dragstart).off(R,t.dragmove).off(z,t.dragend),this.$cropper.off(u,this.dragstart).off(y,this.dblclick),t.zoomable&&this.$cropper.off(x,this.wheel),t.multiple?this.$cropper.off(w,this.dragmove).off(v,this.dragend):h.off(w,this._dragmove).off(v,this._dragend),e.off(b,this._resize)},initPreview:function(){var t=' ';this.$preview=l(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var t=this.$container;t!==r&&(this.container={width:E(t.width(),300),height:E(t.height(),150)})},initCropper:function(){var t,i=this.container,e=this.image;0<=e.naturalWidth*i.height/e.naturalHeight-i.width?(t={width:i.width,height:i.width/e.aspectRatio,left:0}).top=(i.height-t.height)/2:(t={width:i.height*e.aspectRatio,height:i.height,top:0}).left=(i.width-t.width)/2,this.$cropper&&this.$cropper.css({width:t.width,height:t.height,left:t.left,top:t.top}),this.cropper=t},initImage:function(){var t=this.image,i=this.cropper,e={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=l.extend({},t,e),t._width!==i.width||t._height!==i.height?l.extend(t,e):(t=l.extend({},e,t),this.replaced&&(t.ratio=e.ratio)),this.image=t,this.renderImage()},renderImage:function(t){var i=this.image;"zoom"===t&&(i.left-=(i.width-i.oldWidth)/2,i.top-=(i.height-i.oldHeight)/2),i.left=I(E(i.left,i._width-i.width),0),i.top=I(E(i.top,i._height-i.height),0),this.$clone.css({width:i.width,height:i.height,marginLeft:i.left,marginTop:i.top}),t&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t,i=this.defaults,e=this.cropper,h=i.aspectRatio||this.image.aspectRatio,a=this.image.ratio;(t=0<=e.height*h-e.width?{height:e.width/h,width:e.width,left:0,top:(e.height-e.width/h)/2,maxWidth:e.width,maxHeight:e.width/h}:{height:e.height,width:e.height*h,left:(e.width-e.height*h)/2,top:0,maxWidth:e.height*h,maxHeight:e.height}).minWidth=0,t.minHeight=0,i.aspectRatio?(isFinite(i.maxWidth)?(t.maxWidth=I(t.maxWidth,i.maxWidth*a),t.maxHeight=t.maxWidth/h):isFinite(i.maxHeight)&&(t.maxHeight=I(t.maxHeight,i.maxHeight*a),t.maxWidth=t.maxHeight*h),0t.maxWidth?(t.width=t.maxWidth,t.left=t.oldLeft):t.widtht.maxHeight?(t.height=t.maxHeight,t.top=t.oldTop):t.height').one("load",function(){s.width=this.width,s.height=this.height,e.clearRect(0,0,s.width,s.height),e.drawImage(this,0,0),h.load()})))},setData:function(t,i){var e=this.cropper,h=this.dragger,a=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!==n&&((t===r||l.isEmptyObject(t))&&(h=l.extend({},this.defaultDragger)),l.isPlainObject(t)&&!l.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),L(t.x)&&t.x<=e.width-a.left&&(h.left=t.x+a.left),L(t.y)&&t.y<=e.height-a.top&&(h.top=t.y+a.top),s?L(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth?(h.width=t.width,h.height=h.width/s):L(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height,h.width=h.height*s):(L(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth&&(h.width=t.width),L(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height))),this.dragger=h,this.renderDragger())},getData:function(t){var i=this.dragger,e=this.image,h={};return this.built&&(h={x:i.left-e.left,y:i.top-e.top,width:i.width,height:i.height},h=this.transformData(h,D,t)),h},transformData:function(t,e,h){var a=this.image.ratio,s={};return l.each(t,function(t,i){i=U(i),g.test(t)&&!isNaN(i)&&(s[t]=e?h?Math.round(i/a):i/a:i*a)}),s},setAspectRatio:function(t){var i="auto"===t;t=U(t),(i||!isNaN(t)&&0")[0],s=this.getData(),r="";return l.isPlainObject(t)||(e=i,i=t,t={}),t=l.extend({width:s.width,height:s.height},t),this.cropped&&this.support.canvas&&(a.width=t.width,a.height=t.height,h=a.getContext("2d"),"image/jpeg"===i&&(h.fillStyle="#fff",h.fillRect(0,0,t.width,t.height)),h.drawImage(this.$clone[0],s.x,s.y,s.width,s.height,0,0,t.width,t.height),r=a.toDataURL(i,e)),r},setDragMode:function(t){var i=this.$canvas,e=this.defaults,h=W,a=W;if(this.built&&!this.disabled){switch(t){case"crop":e.dragCrop&&(h=D,i.data(o,t));break;case"move":a=D,i.data(o,t);break;default:i.removeData(o)}i.toggleClass(f,h).toggleClass("cropper-move",a)}},enable:function(){this.built&&(this.disabled=W,this.$cropper.removeClass(m))},disable:function(){this.built&&(this.disabled=D,this.$cropper.addClass(m))},rotate:function(t){var i=this.image;t=U(t)||0,this.built&&0!==t&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=D,t=i.rotate=(i.rotate+t)%360,this.replace(this.getRotatedDataURL(t),!0))},getRotatedDataURL:function(t){var i=l("")[0],e=i.getContext("2d"),h=t*Math.PI/180,a=_(t)%180,s=(90<0 6="5-canvas">0><0 6="5-dragger"><1 6="5-viewer">1><1 6="5-8 8-h">1><1 6="5-8 8-v">1><1 6="5-face" 3-2="all">1><1 6="5-7 7-e" 3-2="e">1><1 6="5-7 7-n" 3-2="n">1><1 6="5-7 7-w" 3-2="w">1><1 6="5-7 7-s" 3-2="s">1><1 6="5-4 4-e" 3-2="e">1><1 6="5-4 4-n" 3-2="n">1><1 6="5-4 4-w" 3-2="w">1><1 6="5-4 4-s" 3-2="s">1><1 6="5-4 4-ne" 3-2="ne">1><1 6="5-4 4-nw" 3-2="nw">1><1 6="5-4 4-sw" 3-2="sw">1><1 6="5-4 4-se" 3-2="se">1>0>0>'.replace(/\d+/g,function(t){return i[t]})),M.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:l.noop,preview:"",multiple:W,autoCrop:D,dragCrop:D,dashed:D,modal:D,movable:D,resizable:D,zoomable:D,rotatable:D,checkImageOrigin:D,minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,build:r,built:r,dragstart:r,dragmove:r,dragend:r},M.setDefaults=function(t){l.extend(M.DEFAULTS,t)},M.other=l.fn.cropper,l.fn.cropper=function(h){var a,s=Y(arguments,1);return this.each(function(){var t,i=l(this),e=i.data("cropper");e||i.data("cropper",e=new M(this,h)),"string"==typeof h&&l.isFunction(t=e[h])&&(a=t.apply(e,s))}),typeof a!==n?a:this},l.fn.cropper.Constructor=M,l.fn.cropper.setDefaults=M.setDefaults,l.fn.cropper.noConflict=function(){return l.fn.cropper=M.other,this}});
\ No newline at end of file
diff --git a/assets/js/um-fileupload.min.js b/assets/js/um-fileupload.min.js
index ae161bea..86ec2b68 100644
--- a/assets/js/um-fileupload.min.js
+++ b/assets/js/um-fileupload.min.js
@@ -1 +1 @@
-!function(e){void 0==e.fn.ajaxForm;var r={};r.fileapi=void 0!==e(" ").get(0).files,r.formdata=void 0!==window.FormData,e.fn.uploadFile=function(t){function o(){c.afterUploadAll&&!v&&(v=!0,function e(){0!=f.sCounter&&f.sCounter+f.fCounter==f.tCounter?(c.afterUploadAll(f),v=!1):window.setTimeout(e,100)}())}function a(r,t,o){o.on("dragenter",function(r){r.stopPropagation(),r.preventDefault(),e(this).css("border","2px dashed #ddd")}),o.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),o.on("drop",function(o){e(this).css("border","2px dashed #ddd"),o.preventDefault(),r.errorLog.html("");var a=o.originalEvent.dataTransfer.files;return!t.multiple&&a.length>1?void(t.showError&&e(""+t.multiDragErrorStr+"
").appendTo(r.errorLog)):void(0!=t.onSelect(a)&&i(t,r,a))}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),o.css("border","2px dashed #ddd")}),e(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),o.css("border","2px dashed #ddd")})}function s(r){var t=[];t="string"==jQuery.type(r)?r.split("&"):e.param(r).split("&");var o,a,s=t.length,i=[];for(o=0;or.maxFileSize)r.showError&&e(" "+r.sizeErrorStr+"
").appendTo(t.errorLog);else if(r.maxFileCount!=-1&&t.selectedFiles>=r.maxFileCount)r.showError&&e(""+r.maxFileCountErrorStr+"
").appendTo(t.errorLog);else{t.selectedFiles++;var i=r,l=new FormData,d=r.fileName.replace("[]","");l.append(d,o[a]);var c=r.formData;if(c)for(var h=s(c),f=0;f");g.appendTo("body");var b=[];b.push(o[a].name),p(g,i,m,b,t),t.fileCounter++}else r.showError&&e(""+r.extErrorStr+"
").appendTo(t.errorLog)}function n(e,r,t){var o=r.allowedTypes.toLowerCase().split(","),a=t.split(".").pop().toLowerCase();return!("*"!=r.allowedTypes&&jQuery.inArray(a,o)<0)}function l(r,t){if(r.showFileCounter){var o=e(".upload-filename").length;t.fileCounter=o+1,e(".upload-filename").each(function(t,a){var s=e(this).html().split(r.fileCounterStyle),i=(parseInt(s[0])-1,o+r.fileCounterStyle+s[1]);e(this).html(i),o--})}}function d(t,o,a,s){var c="ajax-upload-id-"+(new Date).getTime(),h=e(""),f=" ";a.multiple&&(a.fileName.indexOf("[]")!=a.fileName.length-2&&(a.fileName+="[]"),f=" ");var m=e(f).appendTo(h);m.change(function(){t.errorLog.html("");var c=(a.allowedTypes.toLowerCase().split(","),[]);if(this.files){for(b=0;b"+a.extErrorStr+"").appendTo(t.errorLog));if(m.push({name:f,size:"NA"}),0==a.onSelect(m))return}if(l(a,t),s.unbind("click"),h.hide(),d(t,o,a,s),h.addClass(o),r.fileapi&&r.formdata){h.removeClass(o);var v=this.files;i(a,t,v)}else{for(var g="",b=0;b":c[b]+" ",t.fileCounter++;if(a.maxFileCount!=-1&&t.selectedFiles+c.length>a.maxFileCount)return void(a.showError&&e(""+a.maxFileCountErrorStr+"
").appendTo(t.errorLog));t.selectedFiles+=c.length;var w=new u(t,a);w.filename.html(g),p(h,a,w,c,t)}}),h.css({margin:0,padding:0});var v=e(s).width()+10;10==v&&(v=120);var g=s.height()+10;10==g&&(g=35),s.css({position:"relative",overflow:"hidden",cursor:"default"}),m.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"34px",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),h.appendTo(s)}function u(r,t){return this.statusbar=e("
"),this.filename=e("
").appendTo(this.statusbar),this.progressDiv=e("").appendTo(this.statusbar).hide(),this.progressbar=e("
").appendTo(this.progressDiv),this.abort=e("
"+t.abortStr+"
").appendTo(this.statusbar).hide(),this.cancel=e("
"+t.cancelStr+"
").appendTo(this.statusbar).hide(),this.done=e("
"+t.doneStr+"
").appendTo(this.statusbar).hide(),this.del=e("
"+t.deletelStr+"
").appendTo(this.statusbar).hide(),r.errorLog.after(this.statusbar),this}function p(e,t,a,i,n){var d={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:t.formData,formData:t.fileData,dataType:t.returnType,beforeSubmit:function(r,l,d){if(0!=t.onSubmit.call(this,i)){var u=t.dynamicFormData();if(u){var p=s(u);if(p)for(var c=0;c
"+t.uploadErrorStr+" "),a.cancel.show(),e.remove(),a.cancel.click(function(){a.statusbar.remove()}),!1},beforeSend:function(e,o){a.progressDiv.show(),a.cancel.hide(),a.done.hide(),t.showAbort&&(a.abort.show(),a.abort.click(function(){e.abort(),n.selectedFiles-=i.length})),r.formdata?a.progressbar.width("1%"):a.progressbar.width("5%")},uploadProgress:function(e,r,o,s){s>98&&(s=98);var i=s+"%";s>1&&a.progressbar.width(i),t.showProgress&&(a.progressbar.html(i),a.progressbar.css("text-align","center"))},success:function(r,o,s){n.responses.push(r),a.progressbar.width("100%"),t.showProgress&&(a.progressbar.html("100%"),a.progressbar.css("text-align","center")),a.abort.hide(),t.onSuccess.call(this,i,r,s),t.showStatusAfterSuccess?(t.showDone?(a.done.show(),a.done.click(function(){a.statusbar.hide("slow"),a.statusbar.remove()})):a.done.hide(),t.showDelete?(a.del.show(),a.del.click(function(){a.statusbar.hide().remove(),t.deleteCallback&&t.deleteCallback.call(this,r,a),n.selectedFiles-=i.length,l(t,n)})):a.del.hide()):(a.statusbar.hide("slow"),a.statusbar.remove()),e.remove(),n.sCounter+=i.length},error:function(r,o,s){a.abort.hide(),"abort"==r.statusText?(a.statusbar.hide("slow").remove(),l(t,n)):(t.onError.call(this,i,o,s),t.showStatusAfterError?(a.progressDiv.hide(),a.statusbar.append("ERROR: "+s+" ")):(a.statusbar.hide(),a.statusbar.remove()),n.selectedFiles-=i.length),e.remove(),n.fCounter+=i.length}};t.autoSubmit?e.ajaxSubmit(d):(t.showCancel&&(a.cancel.show(),a.cancel.click(function(){e.remove(),a.statusbar.remove(),n.selectedFiles-=i.length,l(t,n)})),e.ajaxForm(d))}var c=e.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!0,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showProgress:!1,onSelect:function(e){return!0},onSubmit:function(e,r){},onSuccess:function(e,r,t){},onError:function(e,r,t){},deleteCallback:!1,afterUploadAll:!1,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},t);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var h="upload-"+(new Date).getTime();this.formGroup=h,this.hide(),this.errorLog=e("
"),this.after(this.errorLog),this.responses=[],r.formdata||(c.dragDrop=!1),r.formdata||(c.multiple=!1);var f=this,m=e(""+e(this).html()+"
");e(m).addClass(c.uploadButtonClass),function r(){if(e.fn.ajaxForm){if(c.dragDrop){var t=e('
');e(f).before(t),e(t).append(m),e(t).prepend(e(c.dragDropStr)),a(f,c,t)}else e(f).before(m);d(f,h,c,m)}else window.setTimeout(r,10)}(),this.startUpload=function(){e("."+this.formGroup).each(function(r,t){e(this).is("form")&&e(this).submit()})},this.stopUpload=function(){e(".upload-red").each(function(r,t){e(this).hasClass(f.formGroup)&&e(this).click()})},this.getResponses=function(){return this.responses};var v=!1;return this}}(jQuery);
\ No newline at end of file
+!function(S){S.fn.ajaxForm;var C={};C.fileapi=void 0!==S(" ").get(0).files,C.formdata=void 0!==window.FormData,S.fn.uploadFile=function(e){var p=S.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!0,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showProgress:!1,onSelect:function(e){return!0},onSubmit:function(e,r){},onSuccess:function(e,r,t){},onError:function(e,r,t){},deleteCallback:!1,afterUploadAll:!1,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},e);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var s="upload-"+(new Date).getTime();this.formGroup=s,this.hide(),this.errorLog=S("
"),this.after(this.errorLog),this.responses=[],C.formdata||(p.dragDrop=!1),C.formdata||(p.multiple=!1);var c=this,i=S(""+S(this).html()+"
");S(i).addClass(p.uploadButtonClass),function e(){if(S.fn.ajaxForm){if(p.dragDrop){var r=S('
');S(c).before(r),S(r).append(i),S(r).prepend(S(p.dragDropStr)),t=c,o=p,(a=r).on("dragenter",function(e){e.stopPropagation(),e.preventDefault(),S(this).css("border","2px dashed #ddd")}),a.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),a.on("drop",function(e){S(this).css("border","2px dashed #ddd"),e.preventDefault(),t.errorLog.html("");var r=e.originalEvent.dataTransfer.files;!o.multiple&&1"+o.multiDragErrorStr+"").appendTo(t.errorLog):0!=o.onSelect(r)&&m(o,t,r)}),S(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),S(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")}),S(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")})}else S(c).before(i);!function l(n,d,u,p){var e="ajax-upload-id-"+(new Date).getTime();var c=S("");var r=" ";u.multiple&&(u.fileName.indexOf("[]")!=u.fileName.length-2&&(u.fileName+="[]"),r=" ");var t=S(r).appendTo(c);t.change(function(){n.errorLog.html("");u.allowedTypes.toLowerCase().split(",");var e=[];if(this.files){for(s=0;s"+u.extErrorStr+"").appendTo(n.errorLog));if(t.push({name:r,size:"NA"}),0==u.onSelect(t))return}if(g(u,n),p.unbind("click"),c.hide(),l(n,d,u,p),c.addClass(d),C.fileapi&&C.formdata){c.removeClass(d);var o=this.files;m(u,n,o)}else{for(var a="",s=0;s":a+=e[s]+" ",n.fileCounter++;if(-1!=u.maxFileCount&&n.selectedFiles+e.length>u.maxFileCount)return void(u.showError&&S(""+u.maxFileCountErrorStr+"
").appendTo(n.errorLog));n.selectedFiles+=e.length;var i=new b(n,u);i.filename.html(a),w(c,u,i,e,n)}});c.css({margin:0,padding:0});var o=S(p).width()+10;10==o&&(o=120);var a=p.height()+10;10==a&&(a=35);p.css({position:"relative",overflow:"hidden",cursor:"default"});t.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"34px",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"});c.appendTo(p)}(c,s,p,i)}else window.setTimeout(e,10);var t,o,a}(),this.startUpload=function(){S("."+this.formGroup).each(function(e,r){S(this).is("form")&&S(this).submit()})},this.stopUpload=function(){S(".upload-red").each(function(e,r){S(this).hasClass(c.formGroup)&&S(this).click()})};var h=!(this.getResponses=function(){return this.responses});function f(e){var r,t,o=[],a=(o="string"==jQuery.type(e)?e.split("&"):S.param(e).split("&")).length,s=[];for(r=0;re.maxFileSize)e.showError&&S(""+e.sizeErrorStr+"
").appendTo(r.errorLog);else if(-1!=e.maxFileCount&&r.selectedFiles>=e.maxFileCount)e.showError&&S(""+e.maxFileCountErrorStr+"
").appendTo(r.errorLog);else{r.selectedFiles++;var a=e,s=new FormData,i=e.fileName.replace("[]","");s.append(i,t[o]);var l=e.formData;if(l)for(var n=f(l),d=0;d");c.appendTo("body");var h=[];h.push(t[o].name),w(c,a,u,h,r),r.fileCounter++}else e.showError&&S(""+e.extErrorStr+"
").appendTo(r.errorLog)}function v(e,r,t){var o=r.allowedTypes.toLowerCase().split(","),a=t.split(".").pop().toLowerCase();return!("*"!=r.allowedTypes&&jQuery.inArray(a,o)<0)}function g(a,e){if(a.showFileCounter){var s=S(".upload-filename").length;e.fileCounter=s+1,S(".upload-filename").each(function(e,r){var t=S(this).html().split(a.fileCounterStyle),o=(parseInt(t[0]),s+a.fileCounterStyle+t[1]);S(this).html(o),s--})}}function b(e,r){return this.statusbar=S("
"),this.filename=S("
").appendTo(this.statusbar),this.progressDiv=S("").appendTo(this.statusbar).hide(),this.progressbar=S("
").appendTo(this.progressDiv),this.abort=S("
"+r.abortStr+"
").appendTo(this.statusbar).hide(),this.cancel=S("
"+r.cancelStr+"
").appendTo(this.statusbar).hide(),this.done=S("
"+r.doneStr+"
").appendTo(this.statusbar).hide(),this.del=S("
"+r.deletelStr+"
").appendTo(this.statusbar).hide(),e.errorLog.after(this.statusbar),this}function w(i,l,n,d,u){var e={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:l.formData,formData:l.fileData,dataType:l.returnType,beforeSubmit:function(e,r,t){if(0!=l.onSubmit.call(this,d)){var o=l.dynamicFormData();if(o){var a=f(o);if(a)for(var s=0;s
"+l.uploadErrorStr+" "),n.cancel.show(),i.remove(),n.cancel.click(function(){n.statusbar.remove()}),!1},beforeSend:function(e,r){n.progressDiv.show(),n.cancel.hide(),n.done.hide(),l.showAbort&&(n.abort.show(),n.abort.click(function(){e.abort(),u.selectedFiles-=d.length})),C.formdata?n.progressbar.width("1%"):n.progressbar.width("5%")},uploadProgress:function(e,r,t,o){98ERROR: "+t+"")):(n.statusbar.hide(),n.statusbar.remove()),u.selectedFiles-=d.length),i.remove(),u.fCounter+=d.length}};l.autoSubmit?i.ajaxSubmit(e):(l.showCancel&&(n.cancel.show(),n.cancel.click(function(){i.remove(),n.statusbar.remove(),u.selectedFiles-=d.length,g(l,u)})),i.ajaxForm(e))}return this}}(jQuery);
\ No newline at end of file
diff --git a/assets/js/um-functions.js b/assets/js/um-functions.js
index ff8a1ab2..d0e2a1e7 100644
--- a/assets/js/um-functions.js
+++ b/assets/js/um-functions.js
@@ -635,7 +635,6 @@ function um_modal_responsive() {
}
function um_remove_modal(){
-
jQuery('img.cropper-hidden').cropper('destroy');
jQuery('body,html,textarea').css("overflow", "auto");
@@ -670,6 +669,14 @@ function prepare_Modal() {
function remove_Modal() {
if ( jQuery('.um-popup-overlay').length ) {
+ jQuery( document ).trigger( 'um_before_modal_removed' );
+
+ if ( jQuery('.um-popup-autogrow:visible').length ) {
+ jQuery('.um-popup-autogrow:visible').mCustomScrollbar("destroy");
+ } else if ( jQuery('.um-popup-autogrow2:visible').length ) {
+ jQuery('.um-popup-autogrow2:visible').mCustomScrollbar("destroy");
+ }
+
jQuery('.tipsy').remove();
jQuery('.um-popup').empty().remove();
jQuery('.um-popup-overlay').empty().remove();
diff --git a/assets/js/um-functions.min.js b/assets/js/um-functions.min.js
index 742ac5a6..4e015bae 100644
--- a/assets/js/um-functions.min.js
+++ b/assets/js/um-functions.min.js
@@ -1 +1 @@
-function UM_check_password_matched(){jQuery(document).on("keyup","input[data-key=user_password],input[data-key=confirm_user_password]",function(e){var t=jQuery("input[data-key=user_password]").val(),a=jQuery("input[data-key=confirm_user_password]").val(),o=jQuery("input[data-key=user_password],input[data-key=confirm_user_password]");t||a?t!==a?o.removeClass("um-validate-matched").addClass("um-validate-not-matched"):o.removeClass("um-validate-not-matched").addClass("um-validate-matched"):o.removeClass("um-validate-matched").removeClass("um-validate-not-matched")})}function UM_hide_menus(){menu=jQuery(".um-dropdown"),menu.parents("div").find("a").removeClass("active"),menu.hide()}function UM_domenus(){jQuery(".um-dropdown").each(function(){var e=jQuery(this),t=jQuery(this).attr("data-element"),a=jQuery(this).attr("data-position");jQuery(t).addClass("um-trigger-menu-on-"+e.attr("data-trigger")),jQuery(window).width()<=1200&&"div.um-profile-edit"==t&&(a="lc"),"lc"==a&&(200>jQuery(t).find("img").width()?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),gap_right=jQuery(t).width()+17,e.css({top:0,width:200,left:"auto",right:gap_right+"px","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-right-b"),e.find(".um-dropdown-arr").css({top:"4px",left:"auto",right:"-17px"})),"bc"==a&&(200>jQuery(t).find("img").width()?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),e.css({top:top_p,width:200,left:left_p+left_gap,right:"auto","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-up-b"),e.find(".um-dropdown-arr").css({top:"-17px",left:e.width()/2-12,right:"auto"}))})}function um_responsive(){jQuery(".um").each(function(){element_width=jQuery(this).width(),element_width<=340?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob340")):element_width<=500?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob500")):element_width<=800?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob800")):element_width<=960?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob960")):element_width>960&&(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960")),jQuery(".um-account-nav").length>0&&jQuery(".um-account-side").is(":visible")&&0==jQuery(".um-account-tab:visible").length&&jQuery(".um-account-side li a.current").trigger("click"),jQuery(this).css("opacity",1)}),jQuery(".um-cover, .um-member-cover, .um-cover-e").each(function(){var e=jQuery(this),t=e.data("ratio"),a=e.width(),o=t.split(":");calcHeight=Math.round(a/o[0])+"px",e.height(calcHeight),e.find(".um-cover-add").height(calcHeight)}),jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),UM_domenus()}function UM_Member_Grid(e){e.masonry({itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"})}function initImageUpload_UM(e){e.data("upload_help_text")?upload_help_text=''+e.data("upload_help_text")+" ":upload_help_text="",e.data("icon")?icon=' ':icon="",e.data("upload_text")?upload_text=''+e.data("upload_text")+" ":upload_text="",e.uploadFile({url:um_scripts.imageupload,method:"POST",multiple:!1,formData:{key:e.data("key"),set_id:e.data("set_id"),set_mode:e.data("set_mode"),_wpnonce:e.data("nonce"),timestamp:e.data("timestamp")},fileName:e.data("key"),allowedTypes:e.data("allowed_types"),maxFileSize:e.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:e.data("max_size_error"),extErrorStr:e.data("extension_error"),maxFileCountErrorStr:e.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(t){e.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(t,a,o){e.selectedFiles=0;try{a=jQuery.parseJSON(a)}catch(e){return void console.log(e,a)}a.error&&""!=a.error?(e.parents(".um-modal-body").append(''+a.error+"
"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(a,function(t,a){var o=e.parents(".um-modal-body").find(".um-single-image-preview img"),i=e.parents(".um-modal-body").find(".um-single-image-preview");o.attr("src",a),o.load(function(){e.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),e.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),i.show(0),um_modal_responsive()})})}})}function initFileUpload_UM(e){e.data("upload_help_text")?upload_help_text=''+e.data("upload_help_text")+" ":upload_help_text="",e.data("icon")?icon=' ':icon="",e.data("upload_text")?upload_text=''+e.data("upload_text")+" ":upload_text="",e.uploadFile({url:um_scripts.fileupload,method:"POST",multiple:!1,formData:{key:e.data("key"),set_id:e.data("set_id"),set_mode:e.data("set_mode"),_wpnonce:e.data("nonce"),timestamp:e.data("timestamp")},fileName:e.data("key"),allowedTypes:e.data("allowed_types"),maxFileSize:e.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:e.data("max_size_error"),extErrorStr:e.data("extension_error"),maxFileCountErrorStr:e.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(t){e.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(t,a,o){e.selectedFiles=0,a=jQuery.parseJSON(a),a.error&&""!=a.error?(e.parents(".um-modal-body").append(''+a.error+"
"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),setTimeout(function(){um_modal_responsive()},1e3)):(jQuery.each(a,function(t,a){e.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),e.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),e.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==t?e.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(a):"icon_bg"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":a}):"filename"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(a):e.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",a)}),setTimeout(function(){um_modal_responsive()},1e3))}})}function initCrop_UM(){var e=jQuery(".um-modal .um-single-image-preview img").first(),t=jQuery(".um-modal .um-single-image-preview"),a=e.parent().attr("data-crop"),o=e.parent().attr("data-min_width"),i=e.parent().attr("data-min_height"),r=e.parent().attr("data-ratio");if(jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"))var r=jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"),u=r.split(":"),r=u[0];if(e.length&&""!=e.attr("src")){var d=jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height();if(e.css({height:"auto"}),t.css({height:"auto"}),jQuery(window).height()<=400?(t.css({height:d+"px","max-height":d+"px"}),e.css({height:"auto"})):(e.css({height:"auto","max-height":d+"px"}),t.css({height:e.height(),"max-height":d+"px"})),"square"==a)var s={minWidth:o,minHeight:i,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}};else if("cover"==a){Math.round(o/r)>0&&(i=Math.round(o/r));var s={minWidth:o,minHeight:i,dragCrop:!1,aspectRatio:r,zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}}}else if("user"==a)var s={minWidth:o,minHeight:i,dragCrop:!0,aspectRatio:"auto",zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}};0!=a&&(e.cropper(s),jQuery(".um-single-image-preview img.cropper-hidden").cropper("destroy"),jQuery(".um-single-image-preview img.lazyloaded").addClass("cropper-hidden"),jQuery(".um-single-image-preview img.lazyloaded").removeClass("lazyloaded"),jQuery(".um-single-image-preview .cropper-container").append('
'))}}function um_new_modal(e,t,a,o){var i=jQuery("body").find(".um-modal-overlay");if(0==i.length)if(jQuery(".tipsy").hide(),UM_hide_menus(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),a?jQuery("body").append('
'):jQuery("body").append('
'),jQuery("#"+e).prependTo(".um-modal"),a){jQuery(".um-modal").find(".um-modal-photo").html(" ");var r=jQuery(".um-modal-photo img"),u=jQuery(window).width()-60,d=jQuery(window).height()-.25*jQuery(window).height();r.attr("src",o),r.load(function(){jQuery("#"+e).show(),jQuery(".um-modal").show(),r.css({opacity:0}),r.css({"max-width":u}),r.css({"max-height":d}),jQuery(".um-modal").css({width:r.width(),"margin-left":"-"+r.width()/2+"px"}),r.animate({opacity:1},1e3),um_modal_responsive()})}else jQuery("#"+e).show(),jQuery(".um-modal").show(),um_modal_size(t),initImageUpload_UM(jQuery(".um-modal:visible").find(".um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible").find(".um-single-file-upload")),um_modal_responsive()}function um_modal_responsive(){var e=jQuery(".um-modal:visible"),t=jQuery(".um-modal-body.photo:visible");if(t.length){e.removeClass("uimob340"),e.removeClass("uimob500");var a=jQuery(".um-modal-photo img"),o=jQuery(window).width()-60,i=jQuery(window).height()-.25*jQuery(window).height();a.css({opacity:0}),a.css({"max-width":o}),a.css({"max-height":i}),jQuery(".um-modal").css({width:a.width(),"margin-left":"-"+a.width()/2+"px"}),a.animate({opacity:1},1e3);var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(e.length){var u=jQuery(window).width();if(e.removeClass("uimob340"),e.removeClass("uimob500"),u<=340)e.addClass("uimob340"),initCrop_UM(),e.animate({bottom:0},300);else if(u<=500)e.addClass("uimob500"),initCrop_UM(),e.animate({bottom:0},300);else if(u<=800){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(u<=960){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(u>960){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}}}function um_remove_modal(){jQuery("img.cropper-hidden").cropper("destroy"),jQuery("body,html,textarea").css("overflow","auto"),jQuery(document).unbind("touchmove"),jQuery('.um-modal div[id^="um_"]').hide().appendTo("body"),jQuery(".um-modal,.um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").addClass(e)}function um_modal_add_attr(e,t){jQuery(".um-modal:visible").data(e,t)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append(''),jQuery("body").append(''),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(jQuery(".tipsy").remove(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,offset:3}))}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(ag_height=jQuery(window).height()-jQuery(".um-popup um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80,ag_height>350&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?(jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}),jQuery(".um-popup-autogrow:visible").mCustomScrollbar({theme:"dark-3",mouseWheelPixels:500}).mCustomScrollbar("scrollTo","bottom",{scrollInertia:0})):jQuery(".um-popup-autogrow2:visible").length&&(jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}),jQuery(".um-popup-autogrow2:visible").mCustomScrollbar({theme:"dark-3",mouseWheelPixels:500})))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").removeAttr("checked").removeAttr("selected")}function um_selected(e,t){if(e==t)return"selected='selected'"}jQuery(function(){jQuery(".um-search form *").keypress(function(e){if(13==e.which)return jQuery(".um-search form").submit(),!1}),2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()});
\ No newline at end of file
+function UM_check_password_matched(){jQuery(document).on("keyup","input[data-key=user_password],input[data-key=confirm_user_password]",function(e){var t=jQuery("input[data-key=user_password]").val(),o=jQuery("input[data-key=confirm_user_password]").val(),a=jQuery("input[data-key=user_password],input[data-key=confirm_user_password]");t||o?t!==o?a.removeClass("um-validate-matched").addClass("um-validate-not-matched"):a.removeClass("um-validate-not-matched").addClass("um-validate-matched"):a.removeClass("um-validate-matched").removeClass("um-validate-not-matched")})}function UM_hide_menus(){menu=jQuery(".um-dropdown"),menu.parents("div").find("a").removeClass("active"),menu.hide()}function UM_domenus(){jQuery(".um-dropdown").each(function(){var e=jQuery(this),t=jQuery(this).attr("data-element"),o=jQuery(this).attr("data-position");jQuery(t).addClass("um-trigger-menu-on-"+e.attr("data-trigger")),jQuery(window).width()<=1200&&"div.um-profile-edit"==t&&(o="lc"),"lc"==o&&(jQuery(t).find("img").width()<200?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),gap_right=jQuery(t).width()+17,e.css({top:0,width:200,left:"auto",right:gap_right+"px","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-right-b"),e.find(".um-dropdown-arr").css({top:"4px",left:"auto",right:"-17px"})),"bc"==o&&(jQuery(t).find("img").width()<200?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),e.css({top:top_p,width:200,left:left_p+left_gap,right:"auto","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-up-b"),e.find(".um-dropdown-arr").css({top:"-17px",left:e.width()/2-12,right:"auto"}))})}function um_responsive(){jQuery(".um").each(function(){element_width=jQuery(this).width(),element_width<=340?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob340")):element_width<=500?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob500")):element_width<=800?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob800")):element_width<=960?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob960")):960'+i.data("upload_help_text")+"":upload_help_text="",i.data("icon")?icon=' ':icon="",i.data("upload_text")?upload_text=''+i.data("upload_text")+" ":upload_text="",i.uploadFile({url:um_scripts.imageupload,method:"POST",multiple:!1,formData:{key:i.data("key"),set_id:i.data("set_id"),set_mode:i.data("set_mode"),_wpnonce:i.data("nonce"),timestamp:i.data("timestamp")},fileName:i.data("key"),allowedTypes:i.data("allowed_types"),maxFileSize:i.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:i.data("max_size_error"),extErrorStr:i.data("extension_error"),maxFileCountErrorStr:i.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(e){i.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,o){i.selectedFiles=0;try{t=jQuery.parseJSON(t)}catch(e){return void console.log(e,t)}t.error&&""!=t.error?(i.parents(".um-modal-body").append(''+t.error+"
"),i.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(t,function(e,t){var o=i.parents(".um-modal-body").find(".um-single-image-preview img"),a=i.parents(".um-modal-body").find(".um-single-image-preview");o.attr("src",t),o.load(function(){i.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),i.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),a.show(0),um_modal_responsive()})})}})}function initFileUpload_UM(a){a.data("upload_help_text")?upload_help_text=''+a.data("upload_help_text")+" ":upload_help_text="",a.data("icon")?icon=' ':icon="",a.data("upload_text")?upload_text=''+a.data("upload_text")+" ":upload_text="",a.uploadFile({url:um_scripts.fileupload,method:"POST",multiple:!1,formData:{key:a.data("key"),set_id:a.data("set_id"),set_mode:a.data("set_mode"),_wpnonce:a.data("nonce"),timestamp:a.data("timestamp")},fileName:a.data("key"),allowedTypes:a.data("allowed_types"),maxFileSize:a.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:a.data("max_size_error"),extErrorStr:a.data("extension_error"),maxFileCountErrorStr:a.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(e){a.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,o){a.selectedFiles=0,(t=jQuery.parseJSON(t)).error&&""!=t.error?(a.parents(".um-modal-body").append(''+t.error+"
"),a.parents(".um-modal-body").find(".upload-statusbar").hide(0)):jQuery.each(t,function(e,t){a.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),a.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),a.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==e?a.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(t):"icon_bg"==e?a.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":t}):"filename"==e?a.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(t):a.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",t)}),setTimeout(function(){um_modal_responsive()},1e3)}})}function initCrop_UM(){var t=jQuery(".um-modal .um-single-image-preview img").first(),e=jQuery(".um-modal .um-single-image-preview"),o=t.parent().attr("data-crop"),a=t.parent().attr("data-min_width"),i=t.parent().attr("data-min_height"),r=t.parent().attr("data-ratio");if(jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"))r=(r=jQuery(".um-modal").find("#um_upload_single").attr("data-ratio")).split(":")[0];if(t.length&&""!=t.attr("src")){var u=jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height();if(t.css({height:"auto"}),e.css({height:"auto"}),jQuery(window).height()<=400?(e.css({height:u+"px","max-height":u+"px"}),t.css({height:"auto"})):(t.css({height:"auto","max-height":u+"px"}),e.css({height:t.height(),"max-height":u+"px"})),"square"==o)var d={minWidth:a,minHeight:i,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1,done:function(e){t.parent().attr("data-coord",Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height))}};else if("cover"==o){0'))}}function um_new_modal(e,t,o,a){if(0==jQuery("body").find(".um-modal-overlay").length)if(jQuery(".tipsy").hide(),UM_hide_menus(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),o?jQuery("body").append('
'):jQuery("body").append('
'),jQuery("#"+e).prependTo(".um-modal"),o){jQuery(".um-modal").find(".um-modal-photo").html(" ");var i=jQuery(".um-modal-photo img"),r=jQuery(window).width()-60,u=jQuery(window).height()-.25*jQuery(window).height();i.attr("src",a),i.load(function(){jQuery("#"+e).show(),jQuery(".um-modal").show(),i.css({opacity:0}),i.css({"max-width":r}),i.css({"max-height":u}),jQuery(".um-modal").css({width:i.width(),"margin-left":"-"+i.width()/2+"px"}),i.animate({opacity:1},1e3),um_modal_responsive()})}else jQuery("#"+e).show(),jQuery(".um-modal").show(),um_modal_size(t),initImageUpload_UM(jQuery(".um-modal:visible").find(".um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible").find(".um-single-file-upload")),um_modal_responsive()}function um_modal_responsive(){var e=jQuery(".um-modal:visible");if(jQuery(".um-modal-body.photo:visible").length){e.removeClass("uimob340"),e.removeClass("uimob500");var t=jQuery(".um-modal-photo img"),o=jQuery(window).width()-60,a=jQuery(window).height()-.25*jQuery(window).height();t.css({opacity:0}),t.css({"max-width":o}),t.css({"max-height":a}),jQuery(".um-modal").css({width:t.width(),"margin-left":"-"+t.width()/2+"px"}),t.animate({opacity:1},1e3);var i=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:i},300)}else if(e.length){var r=jQuery(window).width();if(e.removeClass("uimob340"),e.removeClass("uimob500"),r<=340)e.addClass("uimob340"),initCrop_UM(),e.animate({bottom:0},300);else if(r<=500)e.addClass("uimob500"),initCrop_UM(),e.animate({bottom:0},300);else if(r<=800){initCrop_UM();i=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:i},300)}else if(r<=960){initCrop_UM();i=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:i},300)}else if(960
');
- cloned.appendTo( content );
- cloned.find('select').val('');
+ template.find('input[type=text]').val('');
+ template.find('select').val('');
+
+ template.appendTo( content );
+ jQuery(template).removeClass("um-admin-cur-condition-template");
+ jQuery(template).addClass("um-admin-cur-condition");
+
um_admin_live_update_scripts();
um_admin_modal_responsive();
} else {
diff --git a/includes/admin/assets/js/um-admin-scripts.js b/includes/admin/assets/js/um-admin-scripts.js
index 000abca8..fc20bbe2 100644
--- a/includes/admin/assets/js/um-admin-scripts.js
+++ b/includes/admin/assets/js/um-admin-scripts.js
@@ -216,4 +216,22 @@ jQuery(document).ready(function() {
}
});
+
+ jQuery(document).on( 'click', '.um-admin-notice.is-dismissible .notice-dismiss', function(e) {
+ var notice_key = jQuery(this).parents('.um-admin-notice').data('key');
+
+ wp.ajax.send( 'um_dimiss_notice', {
+ data: {
+ key: notice_key,
+ nonce: um_admin_scripts.nonce
+ },
+ success: function( data ) {
+ return true;
+ },
+ error: function( data ) {
+ return false;
+ }
+ });
+ });
+
});
\ No newline at end of file
diff --git a/includes/admin/assets/js/um-admin-settings.js b/includes/admin/assets/js/um-admin-settings.js
index 654c92a9..27533528 100644
--- a/includes/admin/assets/js/um-admin-settings.js
+++ b/includes/admin/assets/js/um-admin-settings.js
@@ -1,42 +1,4 @@
jQuery( document ).ready( function() {
- /**
- * Email templates
- */
- /*jQuery( 'body' ).on( 'click', '.copy_email_template', function() {
- var obj = jQuery(this);
-
- jQuery.ajax({
- url: php_data.copy_email_template,
- type: 'POST',
- data: { email_key : obj.parents('.email_template_wrapper').data('key') },
- success: function(data){
- obj.parents('.email_template_wrapper').addClass('in_theme');
- },
- error: function(data){
- alert('Something went wrong');
- }
- });
- });*/
-
- jQuery( 'body' ).on( 'click', '.reset_email_template', function() {
- var obj = jQuery(this);
-
- jQuery.ajax({
- url: php_data.delete_email_template,
- type: 'POST',
- data: { email_key : obj.parents('.email_template_wrapper').data('key') },
- success: function(data){
- obj.parents('.email_template_wrapper').removeClass('in_theme');
- },
- error: function(data){
- alert('Something went wrong');
- }
- });
- });
-
-
-
-
/**
* Licenses
*/
diff --git a/includes/admin/core/class-admin-builder.php b/includes/admin/core/class-admin-builder.php
index 7efae58b..3f61932c 100644
--- a/includes/admin/core/class-admin-builder.php
+++ b/includes/admin/core/class-admin-builder.php
@@ -167,27 +167,27 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
function um_admin_pre_save_field_to_form( $array ){
unset( $array['conditions'] );
if ( isset($array['conditional_field']) && !empty( $array['conditional_action'] ) && !empty( $array['conditional_operator'] ) ) {
- $array['conditional_value'] = ! empty( $array['conditional_value'] ) ? $array['conditional_value'] : '';
+ $array['conditional_value'] = isset( $array['conditional_value'] ) ? $array['conditional_value'] : '';
$array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'] );
}
if ( isset($array['conditional_field1']) && !empty( $array['conditional_action1'] ) && !empty( $array['conditional_operator1'] ) ) {
- $array['conditional_value1'] = ! empty( $array['conditional_value1'] ) ? $array['conditional_value1'] : '';
+ $array['conditional_value1'] = isset( $array['conditional_value1'] ) ? $array['conditional_value1'] : '';
$array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] );
}
if ( isset($array['conditional_field2']) && !empty( $array['conditional_action2'] ) && !empty( $array['conditional_operator2'] ) ) {
- $array['conditional_value2'] = ! empty( $array['conditional_value2'] ) ? $array['conditional_value2'] : '';
+ $array['conditional_value2'] = isset( $array['conditional_value2'] ) ? $array['conditional_value2'] : '';
$array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] );
}
if ( isset($array['conditional_field3']) && !empty( $array['conditional_action3'] ) && !empty( $array['conditional_operator3'] ) ) {
- $array['conditional_value3'] = ! empty( $array['conditional_value3'] ) ? $array['conditional_value3'] : '';
+ $array['conditional_value3'] = isset( $array['conditional_value3'] ) ? $array['conditional_value3'] : '';
$array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] );
}
if ( isset($array['conditional_field4']) && !empty( $array['conditional_action4'] ) && !empty( $array['conditional_operator4'] ) ) {
- $array['conditional_value4'] = ! empty( $array['conditional_value4'] ) ? $array['conditional_value4'] : '';
+ $array['conditional_value4'] = isset( $array['conditional_value4'] ) ? $array['conditional_value4'] : '';
$array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] );
}
@@ -231,10 +231,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
-
+
+
- $arr ) {
@@ -247,11 +248,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
field_input( '_conditional_operator' . $k, $form_id ); ?>
field_input( '_conditional_value' . $k, $form_id ); ?>
-
-
-
-
-
+
@@ -274,7 +271,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
+
+ field_input( '_conditional_action', $form_id ); ?>
+ field_input( '_conditional_field', $form_id ); ?>
+ field_input( '_conditional_operator', $form_id ); ?>
+ field_input( '_conditional_value', $form_id ); ?>
+
+
+
+
+
@@ -659,6 +666,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
$output['error'] = apply_filters( 'um_admin_field_update_error_handling', $output['error'], $array );
extract( $array['post'] );
+
if ( empty( $output['error'] ) ){
$save = array();
diff --git a/includes/admin/core/class-admin-enqueue.php b/includes/admin/core/class-admin-enqueue.php
index f88469e7..279b0dfd 100644
--- a/includes/admin/core/class-admin-enqueue.php
+++ b/includes/admin/core/class-admin-enqueue.php
@@ -156,7 +156,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
wp_enqueue_script( 'um_admin_settings' );
$localize_data = array(
- 'delete_email_template' => UM()->get_ajax_route( 'um\core\Mail', 'delete_email_template' ),
'onbeforeunload_text' => __( 'Are sure, maybe some settings not saved', 'ultimate-member' ),
'texts' => array(
'remove' => __( 'Remove', 'ultimate-member' ),
@@ -303,7 +302,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
* Load jQuery custom code
*/
function load_custom_scripts() {
- wp_register_script( 'um_admin_scripts', $this->js_url . 'um-admin-scripts.js', '', '', true );
+ wp_register_script( 'um_admin_scripts', $this->js_url . 'um-admin-scripts.js', array('jquery','wp-util'), '', true );
wp_enqueue_script( 'um_admin_scripts' );
}
diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php
index 6b6fb523..02afa9fb 100644
--- a/includes/admin/core/class-admin-forms.php
+++ b/includes/admin/core/class-admin-forms.php
@@ -731,15 +731,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
$value = $this->get_field_value( $field_data );
$options = '';
- foreach ( $field_data['options'] as $key=>$option ) {
+ foreach ( $field_data['options'] as $key => $option ) {
if ( ! empty( $field_data['multi'] ) ) {
if ( ! is_array( $value ) || empty( $value ) )
$value = array();
- $options .= '' . $option . ' ';
+ $options .= '' . esc_html( $option ) . ' ';
} else {
- $options .= '' . $option . ' ';
+ $options .= '' . esc_html( $option ) . ' ';
}
}
@@ -1040,11 +1040,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
ob_start(); ?>
-
-
$class
)
); ?>
-
+
For default text for plain-text emails please see this doc
-
+
localize_note();
$this->show_update_messages();
$this->check_wrong_install_folder();
- //$this->admin_notice_tracking();
+ $this->admin_notice_tracking();
$this->need_upgrade();
$this->check_wrong_licenses();
+
+ //$this->future_changed();
+
/**
* UM hook
*
@@ -135,7 +140,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$admin_notices = $this->get_admin_notices();
- $hidden = get_user_meta( get_current_user_id(), 'um_hidden_admin_notices' );
+ $hidden = get_user_meta( get_current_user_id(), 'um_hidden_admin_notices', true );
$hidden = empty( $hidden ) ? array() : $hidden;
uasort( $admin_notices, array( &$this, 'notice_priority_sort' ) );
@@ -186,9 +191,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$class = ! empty( $notice_data['class'] ) ? $notice_data['class'] : 'updated';
+ $dimissible = ! empty( $admin_notices[ $key ]['dimissible'] );
+
ob_start(); ?>
-
+
@@ -494,13 +501,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
*/
public function admin_notice_tracking() {
- if ( ! current_user_can( 'manage_options' ) )
+ if ( ! current_user_can( 'manage_options' ) ) {
return;
+ }
$hide_notice = get_option( 'um_tracking_notice' );
- if ( $hide_notice )
+ if ( $hide_notice ) {
return;
+ }
$optin_url = esc_url( add_query_arg( 'um_adm_action', 'opt_into_tracking' ) );
$optout_url = esc_url( add_query_arg( 'um_adm_action', 'opt_out_of_tracking' ) );
@@ -508,7 +517,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
ob_start(); ?>
- %s! The core plugin is free but we also sell extensions which allow us to continue developing and supporting the plugin full time. If you subscribe to our mailing list (no spam) we will email you a 20%% discount code which you can use to purchase the extensions bundle .', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>
+ %s! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions for %s via our website. If you subscribe to our mailing list we will immediately email you a 20%% discount code for our extensions bundle (you\'ll need to confirm your subscription via email).', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>
@@ -517,9 +526,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
+
+ privacy policy', 'ultimate-member' ), 'https://ultimatemember.com/support/policy/' ); ?>
+
+
add_notice( 'invalid_dir', array(
+ $this->add_notice( 'tracking_notice', array(
'class' => 'updated',
'message' => $message,
), 2 );
@@ -595,5 +608,41 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
}
}
+
+ /**
+ * Check Future Changes notice
+ */
+ function future_changed() {
+
+ ob_start(); ?>
+
+
+ %s future plans! Detailed future list is here ', 'ultimate-member' ), ultimatemember_plugin_name, '#' ); ?>
+
+
+ add_notice( 'future_changes', array(
+ 'class' => 'updated',
+ 'message' => $message,
+ //'dimissible' => true,
+ ), 2 );
+ }
+
+
+ function dimiss_notice() {
+ if ( empty( $_POST['key'] ) ) {
+ wp_send_json_error( __( 'Wrong Data', 'ultimate-member' ) );
+ }
+
+ $hidden_notices = get_user_meta( get_current_user_id(), 'um_hidden_admin_notices', true );
+ $hidden_notices = empty( $hidden_notices ) ? array() : $hidden_notices;
+ $hidden_notices[] = $_POST['key'];
+
+ update_user_meta( get_current_user_id(), 'um_hidden_admin_notices', $hidden_notices );
+
+ wp_send_json_success();
+ }
+
}
}
\ No newline at end of file
diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php
index 29ff98fc..0a0828f3 100644
--- a/includes/admin/core/class-admin-settings.php
+++ b/includes/admin/core/class-admin-settings.php
@@ -617,7 +617,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
'id' => 'email_html',
'type' => 'checkbox',
'label' => __( 'Use HTML for E-mails?','ultimate-member' ),
- 'tooltip' => __('If you enable HTML for e-mails, you can customize the HTML e-mail templates found in
templates/email folder.','ultimate-member'),
+ 'tooltip' => __( 'If you plan use e-mails with HTML, please make sure that this option is enabled. Otherwise, HTML will be displayed as plain text.','ultimate-member'),
)
)
),
@@ -1692,8 +1692,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
$email_key = empty( $_GET['email'] ) ? '' : urldecode( $_GET['email'] );
$emails = UM()->config()->email_notifications;
- if ( empty( $email_key ) || empty( $emails[$email_key] ) )
+ if ( empty( $email_key ) || empty( $emails[ $email_key ] ) ) {
return $section;
+ }
$in_theme = UM()->mail()->template_in_theme( $email_key );
@@ -1722,7 +1723,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
array(
'id' => 'um_email_template',
'type' => 'hidden',
- 'value' => $email_key,
+ 'value' => $email_key,
),
array(
'id' => $email_key . '_on',
@@ -2526,18 +2527,16 @@ Use Only Cookies: mail()->get_template_file( 'theme', $template );
- $in_theme = UM()->mail()->template_in_theme( $template );
- if ( ! $in_theme ) {
- UM()->mail()->copy_email_template( $template );
- }
+ UM()->mail()->copy_email_template( $template );
$fp = fopen( $theme_template_path, "w" );
$result = fputs( $fp, $content );
@@ -2545,7 +2544,7 @@ Use Only Cookies: ' ) ) {
- $upgrade_notice = get_option( '%UNIQUE_ID%_major_update' . $lastversion );
+ if ( $old_version_array[0] < $new_version_array[0] ) {
+ $show_additional_notice = true;
+ } else {
+ if ( $old_version_array[1] < $new_version_array[1] ) {
+ $show_additional_notice = true;
+ }
+ }
- echo '' . wp_kses_post( $upgrade_notice );
}
- }*/
+
+ if ( $show_additional_notice ) {
+ ob_start(); ?>
+
+
+
+
+
+
+
+ mail()->get_template_filename( $template_name );
+ $ext = ! $html ? '.php' : '.html';
+
+ $blog_id = '';
+ if ( ! $html ) {
+ $blog_id = UM()->mail()->get_blog_id();
+ }
+
+ // check if there is template at theme folder
+ $template = locate_template( array(
+ trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . $ext
+ ) );
+ // Return what we found.
+ return ! $template ? false : true;
+}
+
+
+/**
+ * Method returns expected path for template
+ *
+ * @access public
+ * @param string $location
+ * @param string $template_name
+ * @param bool $html
+ * @return string
+ */
+function um_upgrade20beta1_get_template_file( $location, $template_name, $html = false ) {
+ $template_path = '';
+ $template_name_file = UM()->mail()->get_template_filename( $template_name );
+ $ext = ! $html ? '.php' : '.html';
+ switch( $location ) {
+ case 'theme':
+
+ $blog_id = '';
+ if ( ! $html ) {
+ $blog_id = UM()->mail()->get_blog_id();
+ }
+
+ $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' . $blog_id ). $template_name_file . $ext;
+ break;
+ case 'plugin':
+ $path = ! empty( UM()->mail()->path_by_slug[ $template_name ] ) ? UM()->mail()->path_by_slug[ $template_name ] : um_path . 'templates/email';
+ $template_path = trailingslashit( $path ) . $template_name . $ext;
+ break;
+ }
+ return $template_path;
+}
+
+
+/**
+ * Ajax copy template to the theme
+ *
+ * @param string $template
+ * @return bool
+ */
+function um_upgrade20beta1_copy_email_template( $template ) {
+ $in_theme = um_upgrade20beta1_template_in_theme( $template );
+ if ( $in_theme ) {
+ return false;
+ }
+ $plugin_template_path = um_upgrade20beta1_get_template_file( 'plugin', $template );
+ $theme_template_path = um_upgrade20beta1_get_template_file( 'theme', $template );
+ $temp_path = str_replace( trailingslashit( get_stylesheet_directory() ), '', $theme_template_path );
+ $temp_path = str_replace( '/', DIRECTORY_SEPARATOR, $temp_path );
+ $folders = explode( DIRECTORY_SEPARATOR, $temp_path );
+ $folders = array_splice( $folders, 0, count( $folders ) - 1 );
+ $cur_folder = '';
+ $theme_dir = trailingslashit( get_stylesheet_directory() );
+ foreach ( $folders as $folder ) {
+ $prev_dir = $cur_folder;
+ $cur_folder .= $folder . DIRECTORY_SEPARATOR;
+ if ( ! is_dir( $theme_dir . $cur_folder ) && wp_is_writable( $theme_dir . $prev_dir ) ) {
+ mkdir( $theme_dir . $cur_folder, 0777 );
+ }
+ }
+ if ( file_exists( $plugin_template_path ) && copy( $plugin_template_path, $theme_template_path ) ) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+/**
+ * Insert email template content to file
+ *
+ * @param string $path Filepath
+ * @param string $content Email template content
+ */
+function um_upgrade20beta1_insert_content( $path, $content ) {
+ $fp = @fopen( $path, "w" );
+ @fputs( $fp, $content );
+ @fclose( $fp );
+}
+
+
/**
* Transferring email templates to new logic
*/
-$templates_in_theme = 0;
+function um_upgrade20beta1_email_templates_process() {
+ $templates_in_theme = 0;
+ $emails = UM()->config()->email_notifications;
+ foreach ( $emails as $email_key => $value ) {
+
+ $in_theme = um_upgrade20beta1_template_in_theme( $email_key, true );
+ $theme_template_path = um_upgrade20beta1_get_template_file( 'theme', $email_key );
+
+ if ( ! $in_theme ) {
+ //there isn't HTML email template's file in theme, get from option
+ //this value is correct for each multisite's subsites
+ $setting_value = UM()->options()->get( $email_key );
+
+ $html_email = UM()->options()->get( 'email_html' );
+ if ( $html_email ) {
+
+ if ( ! um_upgrade20beta1_copy_email_template( $email_key ) ) {
+
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
+
+ } else {
+
+ $templates_in_theme++;
+
+ }
+ } else {
+
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
+
+ }
+
+ } else {
+ //there is HTML email template in a theme's folder
+ $theme_template_path_html = um_upgrade20beta1_get_template_file( 'theme', $email_key, true );
+
+ $setting_value = preg_replace( '/<\/body>|<\/head>||<\/html>|
|/' , '', file_get_contents( $theme_template_path_html ) );
+
+ if ( file_exists( $theme_template_path_html ) ) {
+
+ $temp_path = str_replace( trailingslashit( get_stylesheet_directory() ), '', $theme_template_path );
+ $temp_path = str_replace( '/', DIRECTORY_SEPARATOR, $temp_path );
+ $folders = explode( DIRECTORY_SEPARATOR, $temp_path );
+ $folders = array_splice( $folders, 0, count( $folders ) - 1 );
+ $cur_folder = '';
+ $theme_dir = trailingslashit( get_stylesheet_directory() );
+ foreach ( $folders as $folder ) {
+ $prev_dir = $cur_folder;
+ $cur_folder .= $folder . DIRECTORY_SEPARATOR;
+ if ( ! is_dir( $theme_dir . $cur_folder ) && wp_is_writable( $theme_dir . $prev_dir ) ) {
+ mkdir( $theme_dir . $cur_folder, 0777 );
+ }
+ }
+
+ if ( copy( $theme_template_path_html, $theme_template_path ) ) {
+
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
+
+ $templates_in_theme++;
+
+ }
+
+ }
+
+ }
+ }
+
+ $email_html = ( $templates_in_theme > 0 ) ? true : false;
+ UM()->options()->update( 'email_html', $email_html );
+}
+
+
+if ( is_multisite() ) {
+ $start_blog_id = get_current_blog_id();
+
+ $blog_ids = get_sites( array(
+ 'fields' => 'ids',
+ ) );
+
+ foreach ( $blog_ids as $blog_id ) {
+ switch_to_blog( $blog_id );
+ um_upgrade20beta1_email_templates_process();
+ }
+
+ restore_current_blog();
+} else {
+ um_upgrade20beta1_email_templates_process();
+}
+
+
+/**
+ * Transferring email templates to new logic
+ */
+/*$templates_in_theme = 0;
$emails = UM()->config()->email_notifications;
foreach ( $emails as $email_key => $value ) {
- $in_theme = UM()->mail()->template_in_theme( $email_key, true );
- $theme_template_path = UM()->mail()->get_template_file( 'theme', $email_key );
+ $in_theme = um_upgrade20beta1_template_in_theme( $email_key, true );
+ $theme_template_path = um_upgrade20beta1_get_template_file( 'theme', $email_key );
if ( ! $in_theme ) {
+ //there isn't HTML email template's file in theme, get from option
+ //this value is correct for each multisite's subsites
+ $setting_value = UM()->options()->get( $email_key );
+
$html_email = UM()->options()->get( 'email_html' );
-
if ( $html_email ) {
- if ( ! UM()->mail()->copy_email_template( $email_key ) ) {
- $setting_value = UM()->options()->get( $email_key );
- $fp = fopen( $theme_template_path, "w" );
- $result = fputs( $fp, $setting_value );
- fclose( $fp );
+ if ( ! um_upgrade20beta1_copy_email_template( $email_key ) ) {
+
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
+
} else {
+
$templates_in_theme++;
+
}
} else {
- $setting_value = UM()->options()->get( $email_key );
- $fp = @fopen( $theme_template_path, "w" );
- $result = @fputs( $fp, $setting_value );
- fclose( $fp );
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
+
}
+
} else {
- $theme_template_path_html = UM()->mail()->get_template_file( 'theme', $email_key, true );
+ //there is HTML email template in a theme's folder
+ $theme_template_path_html = um_upgrade20beta1_get_template_file( 'theme', $email_key, true );
$setting_value = preg_replace( '/<\/body>|<\/head>||<\/html>||/' , '', file_get_contents( $theme_template_path_html ) );
if ( file_exists( $theme_template_path_html ) ) {
+
if ( copy( $theme_template_path_html, $theme_template_path ) ) {
- $fp = fopen( $theme_template_path, "w" );
- $result = fputs( $fp, $setting_value );
- fclose( $fp );
+
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
$templates_in_theme++;
+
}
+
}
+
}
}
-if ( $templates_in_theme > 0 ) {
- UM()->options()->update( 'email_html', true );
-} else {
- UM()->options()->update( 'email_html', false );
-}
\ No newline at end of file
+$email_html = ( $templates_in_theme > 0 ) ? true : false;
+UM()->options()->update( 'email_html', $email_html );*/
\ No newline at end of file
diff --git a/includes/admin/core/packages/2.0-beta1/functions.php b/includes/admin/core/packages/2.0-beta1/functions.php
index 824fdfef..52adba1f 100644
--- a/includes/admin/core/packages/2.0-beta1/functions.php
+++ b/includes/admin/core/packages/2.0-beta1/functions.php
@@ -136,6 +136,8 @@ function um_upgrade_cpt20beta1() {
function um_upgrade_get_forums20beta1() {
um_maybe_unset_time_limit();
+ remove_all_actions( 'pre_get_posts' );
+
$bb_forums = get_posts( array(
'post_type' => 'forum',
'numberposts' => -1,
diff --git a/includes/admin/templates/form/profile_customize.php b/includes/admin/templates/form/profile_customize.php
index 6104eae0..b809ffcf 100644
--- a/includes/admin/templates/form/profile_customize.php
+++ b/includes/admin/templates/form/profile_customize.php
@@ -1,10 +1,11 @@
- roles()->get_roles( __( 'All roles', 'ultimate-member' ) ) as $key => $value ) {
- $_um_profile_role = UM()->query()->get_meta_value( '_um_profile_role', $key );
- if ( ! empty( $_um_profile_role ) )
- $profile_role = $_um_profile_role;
+ roles()->get_roles() as $key => $value ) {
+ $_um_profile_role = UM()->query()->get_meta_value( '_um_profile_role', $key );
+ if ( ! empty( $_um_profile_role ) ) {
+ $profile_role_array[] = $_um_profile_role;
+ }
}
UM()->admin_forms( array(
@@ -14,8 +15,8 @@
array(
'id' => '_um_profile_use_custom_settings',
'type' => 'select',
- 'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
- 'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
+ 'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
+ 'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_use_custom_settings', null, 0 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
@@ -23,13 +24,14 @@
),
),
array(
- 'id' => '_um_profile_role',
- 'type' => 'select',
- 'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
- 'tooltip' => __( 'Please note if you make a profile form specific to a role then you must make sure that every other role is assigned a profile form', 'ultimate-member' ),
- 'value' => ! empty( $profile_role ) ? $profile_role : 0,
- 'options' => UM()->roles()->get_roles( __( 'All roles', 'ultimate-member' ) ),
- 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
+ 'id' => '_um_profile_role',
+ 'type' => 'select',
+ 'multi' => true,
+ 'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
+ 'tooltip' => __( 'Please note if you make a profile form specific to a role then you must make sure that every other role is assigned a profile form', 'ultimate-member' ),
+ 'value' => $profile_role_array,
+ 'options' => UM()->roles()->get_roles(),
+ 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
),
array(
'id' => '_um_profile_template',
diff --git a/includes/class-config.php b/includes/class-config.php
index 2e61e1ab..7d92c771 100644
--- a/includes/class-config.php
+++ b/includes/class-config.php
@@ -210,7 +210,7 @@ if ( ! class_exists( 'um\Config' ) ) {
'_um_profile_header_menu' => 'bc',
'_um_profile_empty_text' => 1,
'_um_profile_empty_text_emo' => 1,
- '_um_profile_role' => '0',
+ '_um_profile_role' => array(),
'_um_profile_template' => 'profile',
'_um_profile_max_width' => '1000px',
'_um_profile_area_max_width' => '600px',
diff --git a/includes/class-dependencies.php b/includes/class-dependencies.php
index b0fe53b9..bd087afc 100644
--- a/includes/class-dependencies.php
+++ b/includes/class-dependencies.php
@@ -39,14 +39,14 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
'instagram' => '2.0',
'invitations' => '2.0',
'mailchimp' => '2.0.1',
- 'messaging' => '2.0.1',
+ 'messaging' => '2.0.5',
'mycred' => '2.0',
'notices' => '2.0.1',
'notifications' => '2.0.1',
'online' => '2.0',
'private-content' => '2.0',
'profile-completeness' => '2.0.1',
- 'recaptcha' => '2.0',
+ 'recaptcha' => '2.0.2',
'reviews' => '2.0.3',
'social-activity' => '2.0.1',
'social-login' => '2.0.1',
@@ -57,7 +57,7 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
'woocommerce' => '2.0.1',
'restrict-content' => '2.0',
'beaver-builder' => '2.0',
- 'gdpr' => '1.0.0',
+ 'photos' => '1.1',
);
diff --git a/includes/class-init.php b/includes/class-init.php
index 65552476..5aaa9227 100644
--- a/includes/class-init.php
+++ b/includes/class-init.php
@@ -495,6 +495,7 @@ if ( ! class_exists( 'UM' ) ) {
$this->metabox();
$this->admin_upgrade()->init_packages_ajax_handlers();
$this->admin_gdpr();
+ $this->columns();
} elseif ( $this->is_request( 'admin' ) ) {
$this->admin();
$this->admin_menu();
@@ -533,7 +534,7 @@ if ( ! class_exists( 'UM' ) ) {
$this->permalinks();
$this->modal();
$this->cron();
- //$this->tracking();
+ $this->tracking();
$this->mobile();
$this->external_integrations();
$this->gdpr();
diff --git a/includes/core/class-access.php b/includes/core/class-access.php
index 0bd198a6..0f3d7f95 100644
--- a/includes/core/class-access.php
+++ b/includes/core/class-access.php
@@ -1022,19 +1022,22 @@ if ( ! class_exists( 'um\core\Access' ) ) {
}
//post is private
- if ( '1' == $restriction['_um_accessible'] ) {
+ if ( '0' == $restriction['_um_accessible'] ) {
+ $filtered_items[] = $menu_item;
+ continue;
+ } elseif ( '1' == $restriction['_um_accessible'] ) {
//if post for not logged in users and user is not logged in
if ( ! is_user_logged_in() ) {
$filtered_items[] = $menu_item;
continue;
} else {
- if ( current_user_can( 'administrator' ) ) {
- $filtered_items[] = $menu_item;
- continue;
- }
+ if ( current_user_can( 'administrator' ) ) {
+ $filtered_items[] = $menu_item;
+ continue;
+ }
- //if not single query when exclude if set _um_access_hide_from_queries
+ //if not single query when exclude if set _um_access_hide_from_queries
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
$filtered_items[] = $menu_item;
continue;
@@ -1044,10 +1047,10 @@ if ( ! class_exists( 'um\core\Access' ) ) {
//if post for logged in users and user is not logged in
if ( is_user_logged_in() ) {
- if ( current_user_can( 'administrator' ) ) {
- $filtered_items[] = $menu_item;
- continue;
- }
+ if ( current_user_can( 'administrator' ) ) {
+ $filtered_items[] = $menu_item;
+ continue;
+ }
$custom_restrict = $this->um_custom_restriction( $restriction );
@@ -1078,8 +1081,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
}
}
}
-
- continue;
}
//add all other posts
diff --git a/includes/core/class-account.php b/includes/core/class-account.php
index a6fc0c67..5daa94b3 100644
--- a/includes/core/class-account.php
+++ b/includes/core/class-account.php
@@ -756,7 +756,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
-
+
'instagram_url',
'url_text' => 'Instagram',
'advanced' => 'social',
- 'color' => '#3f729b',
+ 'color' => 'radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%,#d6249f 60%,#285AEB 90%)',
'match' => 'https://instagram.com/',
),
diff --git a/includes/core/class-enqueue.php b/includes/core/class-enqueue.php
index b723b213..7c53f542 100644
--- a/includes/core/class-enqueue.php
+++ b/includes/core/class-enqueue.php
@@ -263,7 +263,9 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
*/
function load_selectjs() {
- if ( class_exists( 'WooCommerce' ) ) {
+ $dequeue_select2 = apply_filters( 'um_dequeue_select2_scripts', false );
+
+ if ( class_exists( 'WooCommerce' ) || $dequeue_select2 ) {
wp_dequeue_style( 'select2' );
wp_deregister_style( 'select2' );
diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php
index 40c2cb9e..42bcd689 100644
--- a/includes/core/class-fields.php
+++ b/includes/core/class-fields.php
@@ -182,8 +182,38 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*/
function delete_field_from_form( $id, $form_id ) {
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
- if (isset( $fields[$id] )) {
- unset( $fields[$id] );
+
+ if ( isset( $fields[ $id ] ) ) {
+ $condition_fields = get_option( 'um_fields' );
+
+ foreach ( $condition_fields as $key => $value ) {
+ $deleted_field = array_search( $id, $value );
+
+ if ( $key != $id && $deleted_field != false ) {
+ $deleted_field_id = str_replace( 'conditional_field', '', $deleted_field );
+
+ if ( $deleted_field_id == '' ) {
+ $arr_id = 0;
+ } else {
+ $arr_id = $deleted_field_id;
+ }
+
+ unset( $condition_fields[ $key ][ 'conditional_action' . $deleted_field_id ] );
+ unset( $condition_fields[ $key ][ $deleted_field ] );
+ unset( $condition_fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
+ unset( $condition_fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
+ unset( $condition_fields[ $key ]['conditions'][ $arr_id ] );
+
+ unset( $fields[ $key ][ 'conditional_action' . $deleted_field_id ] );
+ unset( $fields[ $key ][ $deleted_field ] );
+ unset( $fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
+ unset( $fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
+ unset( $fields[ $key ]['conditions'][ $arr_id ] );
+ }
+ }
+
+ update_option( 'um_fields' , $condition_fields );
+ unset( $fields[ $id ] );
UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
}
}
@@ -628,9 +658,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
} elseif ( ( um_user( $key ) || isset( $data['show_anyway'] ) ) && $this->viewing == true ) {
- $value = um_filtered_value( $key, $data );
-
- return $value;
+ return um_filtered_value( $key, $data );
} elseif ( isset( UM()->user()->profile[ $key ] ) ) {
@@ -1106,10 +1134,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*/
function get_label( $key ) {
$fields = UM()->builtin()->all_user_fields;
- if (isset( $fields[$key]['label'] ))
- return $fields[$key]['label'];
- if (isset( $fields[$key]['title'] ))
- return $fields[$key]['title'];
+ if ( isset( $fields[$key]['label'] ) )
+ return stripslashes( $fields[$key]['label'] );
+ if ( isset( $fields[$key]['title'] ) )
+ return stripslashes( $fields[$key]['title'] );
return '';
}
@@ -1690,7 +1718,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
case 'select':
case 'radio':
- $form_key = str_replace( 'role_select', 'role', $key );
+ $form_key = str_replace( array( 'role_select', 'role_radio' ), 'role', $key );
$field_id = $form_key;
break;
default:
@@ -2571,9 +2599,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
}
- $options = $this->get_available_roles( $form_key, $options );
-
- // add an empty option!
$output .= '
';
$field_value = '';
@@ -2583,6 +2608,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$options_pair = true;
}
+ $options = $this->get_available_roles( $form_key, $options );
+
// add options
if ( ! empty( $options ) ) {
foreach ( $options as $k => $v ) {
@@ -2890,7 +2917,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$um_field_checkbox_item_title = $v;
$option_value = $v;
- if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role', 'role_radio' ) ) ) {
+ if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role' ) ) ) {
$um_field_checkbox_item_title = $v;
$option_value = $k;
}
@@ -2910,6 +2937,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$class = "um-icon-android-radio-button-off";
}
+
if (isset( $data['editable'] ) && $data['editable'] == 0) {
$col_class .= " um-field-radio-state-disabled";
}
@@ -4010,23 +4038,23 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
switch ($act_id) {
case 'um_admin_duplicate_field':
- UM()->fields()->duplicate_field( $arg1, $arg2 );
+ $this->duplicate_field( $arg1, $arg2 );
break;
case 'um_admin_remove_field_global':
- UM()->fields()->delete_field_from_db( $arg1 );
+ $this->delete_field_from_db( $arg1 );
break;
case 'um_admin_remove_field':
- UM()->fields()->delete_field_from_form( $arg1, $arg2 );
+ $this->delete_field_from_form( $arg1, $arg2 );
break;
case 'um_admin_add_field_from_predefined':
- UM()->fields()->add_field_from_predefined( $arg1, $arg2, $position );
+ $this->add_field_from_predefined( $arg1, $arg2, $position );
break;
case 'um_admin_add_field_from_list':
- UM()->fields()->add_field_from_list( $arg1, $arg2, $position );
+ $this->add_field_from_list( $arg1, $arg2, $position );
break;
}
diff --git a/includes/core/class-files.php b/includes/core/class-files.php
index 39932ad5..7317fc6d 100644
--- a/includes/core/class-files.php
+++ b/includes/core/class-files.php
@@ -1133,14 +1133,16 @@ if ( ! class_exists( 'um\core\Files' ) ) {
* @return string
*/
function format_bytes( $size , $precision = 1 ) {
+ if ( is_numeric( $size ) ) {
+ $base = log( $size, 1024 );
+ $suffixes = array( '', 'kb', 'MB', 'GB', 'TB' );
+ $computed_size = round( pow( 1024, $base - floor( $base ) ), $precision );
+ $unit = $suffixes[ floor( $base ) ];
- $base = log($size, 1024);
- $suffixes = array('', 'kb', 'MB', 'GB', 'TB');
- $computed_size = round(pow(1024, $base - floor($base)), $precision);
- $unit = $suffixes[ floor($base) ];
-
- return $computed_size.' '.$unit;
+ return $computed_size.' '.$unit;
+ }
+ return '';
}
diff --git a/includes/core/class-form.php b/includes/core/class-form.php
index 7c0c1db6..39f6887a 100644
--- a/includes/core/class-form.php
+++ b/includes/core/class-form.php
@@ -308,7 +308,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
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 ( ! empty( $role ) &&
diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php
index e92a208f..a4e71542 100644
--- a/includes/core/class-mail.php
+++ b/includes/core/class-mail.php
@@ -36,6 +36,23 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
}
+ /**
+ * Mandrill compatibility
+ *
+ * @param $nl2br
+ * @param string $message
+ * @return bool
+ */
+ function mandrill_nl2br( $nl2br, $message = '' ) {
+ // text emails
+ if ( ! UM()->options()->get( 'email_html' ) ) {
+ $nl2br = true;
+ }
+
+ return $nl2br;
+ }
+
+
/**
* Init paths for email notifications
*/
@@ -66,72 +83,73 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
/**
- * Mandrill compatibility
+ * Check blog ID on multisite, return '' if single site
*
- * @param $nl2br
- * @param string $message
- * @return bool
+ * @return string
*/
- function mandrill_nl2br( $nl2br, $message = '' ) {
- // text emails
- if ( ! UM()->options()->get( 'email_html' ) ) {
- $nl2br = true;
+ function get_blog_id() {
+ $blog_id = '';
+ if ( is_multisite() ) {
+ $blog_id = '/' . get_current_blog_id();
}
- return $nl2br;
+ return $blog_id;
}
/**
- * Send Email function
+ * Locate a template and return the path for inclusion.
*
- * @param string $email
- * @param null $template
- * @param array $args
+ * @access public
+ * @param string $template_name
+ * @return string
*/
- function send( $email, $template, $args = array() ) {
+ function locate_template( $template_name ) {
+ // check if there is template at theme folder
+ $blog_id = $this->get_blog_id();
- if ( ! is_email( $email ) ) return;
- if ( UM()->options()->get( $template . '_on' ) != 1 ) return;
+ //get template file from current blog ID folder
+ $template = locate_template( array(
+ trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name . '.php'
+ ) );
- $this->attachments = null;
- $this->headers = 'From: '. UM()->options()->get('mail_from') .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
+ //if there isn't template at theme folder for current blog ID get template file from theme folder
+ if ( is_multisite() && ! $template ) {
+ $template = locate_template( array(
+ trailingslashit( 'ultimate-member/email' ) . $template_name . '.php'
+ ) );
+ }
+ //if there isn't template at theme folder get template file from plugin dir
+ if ( ! $template ) {
+ $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
+ $template = trailingslashit( $path ) . $template_name . '.php';
+ }
+
+ // Return what we found.
/**
* UM hook
*
* @type filter
- * @title um_email_send_subject
- * @description Change email notification subject
+ * @title um_locate_email_template
+ * @description Change email notification template path
* @input_vars
- * [{"var":"$subject","type":"string","desc":"Subject"},
- * {"var":"$key","type":"string","desc":"Template Key"}]
+ * [{"var":"$template","type":"string","desc":"Template Path"},
+ * {"var":"$template_name","type":"string","desc":"Template Name"}]
* @change_log
* ["Since: 2.0"]
* @usage
- *
+ *
* @example
*
*/
- $subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template );
- $this->subject = um_convert_tags( $subject , $args );
-
- $this->message = $this->prepare_template( $template, $args );
-
- if ( UM()->options()->get( 'email_html' ) ) {
- $this->headers .= "Content-Type: text/html\r\n";
- } else {
- $this->headers .= "Content-Type: text/plain\r\n";
- }
-
- // Send mail
- wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
+ return apply_filters( 'um_locate_email_template', $template, $template_name );
}
@@ -313,7 +331,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
>
- get_email_template( $slug, $args ); ?>
+ get_email_template( $slug, $args ); ?>
@@ -358,48 +376,55 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
/**
- * Locate a template and return the path for inclusion.
+ * Send Email function
*
- * @access public
- * @param string $template_name
- * @return string
+ * @param string $email
+ * @param null $template
+ * @param array $args
*/
- function locate_template( $template_name ) {
- // check if there is template at theme folder
- $template = locate_template( array(
- trailingslashit( 'ultimate-member/email' ) . $template_name . '.php'
- ) );
+ function send( $email, $template, $args = array() ) {
- //if there isn't template at theme folder get template file from plugin dir
- if ( ! $template ) {
- $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
- $template = trailingslashit( $path ) . $template_name . '.php';
- }
+ if ( ! is_email( $email ) ) return;
+ if ( UM()->options()->get( $template . '_on' ) != 1 ) return;
+
+ $this->attachments = null;
+ $this->headers = 'From: '. UM()->options()->get('mail_from') .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
- // Return what we found.
/**
* UM hook
*
* @type filter
- * @title um_locate_email_template
- * @description Change email notification template path
+ * @title um_email_send_subject
+ * @description Change email notification subject
* @input_vars
- * [{"var":"$template","type":"string","desc":"Template Path"},
- * {"var":"$template_name","type":"string","desc":"Template Name"}]
+ * [{"var":"$subject","type":"string","desc":"Subject"},
+ * {"var":"$key","type":"string","desc":"Template Key"}]
* @change_log
* ["Since: 2.0"]
* @usage
- *
+ *
* @example
*
*/
- return apply_filters( 'um_locate_email_template', $template, $template_name );
+ $subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template );
+ $this->subject = um_convert_tags( $subject , $args );
+
+ $this->message = $this->prepare_template( $template, $args );
+
+ if ( UM()->options()->get( 'email_html' ) ) {
+ $this->headers .= "Content-Type: text/html\r\n";
+ } else {
+ $this->headers .= "Content-Type: text/plain\r\n";
+ }
+
+ // Send mail
+ wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
}
@@ -439,16 +464,16 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
*
* @access public
* @param string $template_name
- * @param bool $html
* @return string
*/
- function template_in_theme( $template_name, $html = false ) {
+ function template_in_theme( $template_name ) {
$template_name_file = $this->get_template_filename( $template_name );
- $ext = ! $html ? '.php' : '.html';
- // check if there is template at theme folder
+ $blog_id = $this->get_blog_id();
+
+ // check if there is template at theme blog ID folder
$template = locate_template( array(
- trailingslashit( 'ultimate-member/email' ) . $template_name_file . $ext
+ trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . '.php'
) );
// Return what we found.
@@ -460,24 +485,26 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
* Method returns expected path for template
*
* @access public
+ *
* @param string $location
* @param string $template_name
- * @param bool $html
+ *
* @return string
*/
- function get_template_file( $location, $template_name, $html = false ) {
+ function get_template_file( $location, $template_name ) {
$template_path = '';
$template_name_file = $this->get_template_filename( $template_name );
- $ext = ! $html ? '.php' : '.html';
-
switch( $location ) {
case 'theme':
- $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' ). $template_name_file . $ext;
+ //save email template in blog ID folder if we use multisite
+ $blog_id = $this->get_blog_id();
+
+ $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' . $blog_id ). $template_name_file . '.php';
break;
case 'plugin':
$path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
- $template_path = trailingslashit( $path ) . $template_name . $ext;
+ $template_path = trailingslashit( $path ) . $template_name . '.php';
break;
}
@@ -488,10 +515,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
/**
* Ajax copy template to the theme
*
- * @param bool $template
+ * @param string $template
* @return bool
*/
- function copy_email_template( $template = false ) {
+ function copy_email_template( $template ) {
$in_theme = $this->template_in_theme( $template );
if ( $in_theme ) {
@@ -522,26 +549,5 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
return false;
}
}
-
-
- /**
- * Delete Email Notification Template
- */
- function delete_email_template() {
- $template = $_POST['email_key'];
-
- $in_theme = $this->template_in_theme( $template );
- if ( ! $in_theme ) {
- wp_send_json_error( new \WP_Error( 'template_in_theme', __( 'Template does not exists in theme', 'ultimate-member' ) ) );
- }
-
- $theme_template_path = $this->get_template_file( 'theme', $template );
-
- if ( unlink( $theme_template_path ) ) {
- wp_send_json_success();
- } else {
- wp_send_json_error( new \WP_Error( 'template_not_exists', __( 'Can not remove template from theme', 'ultimate-member' ) ) );
- }
- }
}
}
\ No newline at end of file
diff --git a/includes/core/class-password.php b/includes/core/class-password.php
index 774e66fa..25bb55a8 100644
--- a/includes/core/class-password.php
+++ b/includes/core/class-password.php
@@ -107,6 +107,10 @@ if ( ! class_exists( 'um\core\Password' ) ) {
UM()->form()->post_form = $_POST;
+ if ( empty( UM()->form()->post_form['mode'] ) ) {
+ UM()->form()->post_form['mode'] = 'password';
+ }
+
/**
* UM hook
*
diff --git a/includes/core/class-permalinks.php b/includes/core/class-permalinks.php
index d2bb240e..d88200e9 100644
--- a/includes/core/class-permalinks.php
+++ b/includes/core/class-permalinks.php
@@ -130,51 +130,10 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
* @return mixed|void
*/
function get_current_url( $no_query_params = false ) {
- /*
- * future fix
- * global $wp;
- echo home_url( $wp->request );
- */
- $server_name_method = UM()->options()->get( 'current_url_method' );
- $server_name_method = ! empty( $server_name_method ) ? $server_name_method : 'SERVER_NAME';
+ //use WP native function for fill $_SERVER variables by correct values
+ wp_fix_server_vars();
- $um_port_forwarding_url = UM()->options()->get( 'um_port_forwarding_url' );
- $um_port_forwarding_url = ! empty( $um_port_forwarding_url ) ? $um_port_forwarding_url : '';
-
- $page_url = '';
- if ( is_multisite() ) {
- $blog_id = get_current_blog_id();
- $siteurl = get_site_url( $blog_id );
-
- $network_permalink_structure = UM()->options()->get( 'network_permalink_structure' );
-
- if( $network_permalink_structure == "sub-directory" ){
- $page_url .= "//";
- $page_url .= $_SERVER[ $server_name_method ];
- }else{
- $page_url .= $siteurl;
- }
-
- if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
- $page_url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
- } else {
- $page_url .= $_SERVER["REQUEST_URI"];
- }
-
- } else {
- if ( !isset( $_SERVER['SERVER_NAME'] ) )
- return '';
-
- $page_url .= "//";
-
- if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
- $page_url .= $_SERVER[ $server_name_method ].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
-
- } else {
- $page_url .= $_SERVER[ $server_name_method ].$_SERVER["REQUEST_URI"];
- }
-
- }
+ $page_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if ( $no_query_params == true ) {
$page_url = strtok( $page_url, '?' );
@@ -201,7 +160,7 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
* }
* ?>
*/
- return apply_filters( 'um_get_current_page_url', set_url_scheme( $page_url ) );
+ return apply_filters( 'um_get_current_page_url', $page_url );
}
diff --git a/includes/core/class-profile.php b/includes/core/class-profile.php
index a857654a..5ea09603 100644
--- a/includes/core/class-profile.php
+++ b/includes/core/class-profile.php
@@ -118,18 +118,20 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
// disable private tabs
if ( ! is_admin() ) {
- if( is_user_logged_in() ) {
- $user_id = um_user('ID');
- um_fetch_user( get_current_user_id() );
- }
+ if ( is_user_logged_in() ) {
+ $user_id = um_user('ID');
+ um_fetch_user( get_current_user_id() );
+ }
+
foreach ( $tabs as $id => $tab ) {
if ( ! $this->can_view_tab( $id ) ) {
- unset( $tabs[$id] );
+ unset( $tabs[ $id ] );
}
}
- if( is_user_logged_in() ) {
- um_fetch_user( $user_id );
- }
+
+ if ( is_user_logged_in() ) {
+ um_fetch_user( $user_id );
+ }
}
return $tabs;
@@ -143,10 +145,13 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
*/
function tabs_active() {
$tabs = $this->tabs();
- foreach( $tabs as $id => $info ) {
- if ( ! UM()->options()->get('profile_tab_'.$id) && !isset( $info['_builtin'] ) && !isset( $info['custom'] ) )
+
+ foreach ( $tabs as $id => $info ) {
+ if ( ! UM()->options()->get( 'profile_tab_' . $id ) && ! isset( $info['_builtin'] ) && ! isset( $info['custom'] ) ) {
unset( $tabs[ $id ] );
+ }
}
+
return $tabs;
}
@@ -212,28 +217,38 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
* @return bool
*/
function can_view_tab( $tab ) {
- $privacy = intval( UM()->options()->get( 'profile_tab_' . $tab . '_privacy' ) );
+
+ $target_id = UM()->user()->target_id;
+ if ( empty( $target_id ) ) {
+ return true;
+ }
+
$can_view = false;
- switch( $privacy ) {
+ $privacy = intval( UM()->options()->get( 'profile_tab_' . $tab . '_privacy' ) );
+ switch ( $privacy ) {
+ case 0:
+ $can_view = true;
+ break;
+
case 1:
- $can_view = is_user_logged_in() ? false : true;
+ $can_view = ! is_user_logged_in();
break;
case 2:
- $can_view = is_user_logged_in() ? true : false;
+ $can_view = is_user_logged_in();
break;
case 3:
- $can_view = get_current_user_id() == um_user( 'ID' ) ? true : false;
+ $can_view = is_user_logged_in() && get_current_user_id() === $target_id;
break;
case 4:
- $can_view = false;
- if( is_user_logged_in() ) {
- $roles = UM()->options()->get( 'profile_tab_' . $tab . '_roles' );
- if( is_array( $roles )
- && in_array( UM()->user()->get_role(), $roles ) ) {
+ if ( is_user_logged_in() ) {
+ $roles = (array) UM()->options()->get( 'profile_tab_' . $tab . '_roles' );
+
+ $current_user_roles = um_user( 'roles' );
+ if ( ! empty( $current_user_roles ) && count( array_intersect( $current_user_roles, $roles ) ) > 0 ) {
$can_view = true;
}
}
diff --git a/includes/core/class-rest-api.php b/includes/core/class-rest-api.php
index 8a75f37e..288d8737 100644
--- a/includes/core/class-rest-api.php
+++ b/includes/core/class-rest-api.php
@@ -70,10 +70,10 @@ if ( ! class_exists( 'um\core\REST_API' ) ) {
add_action( 'template_redirect', array( $this, 'process_query' ), -1 );
add_filter( 'query_vars', array( $this, 'query_vars' ) );
- add_filter( 'um_user_profile_additional_fields', array( $this, 'user_key_field' ), 3, 2 );
+ //add_filter( 'um_user_profile_additional_fields', array( $this, 'user_key_field' ), 3, 2 );
- add_action( 'personal_options_update', array( $this, 'update_key' ) );
- add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
+ //add_action( 'personal_options_update', array( $this, 'update_key' ) );
+ //add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
// Determine if JSON_PRETTY_PRINT is available
$this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
diff --git a/includes/core/class-rewrite.php b/includes/core/class-rewrite.php
index 68b93f41..140af7e0 100644
--- a/includes/core/class-rewrite.php
+++ b/includes/core/class-rewrite.php
@@ -205,6 +205,30 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
$user_id = username_exists( um_queried_user() );
+ //Try
+ if ( ! $user_id ) {
+ $permalink_base = UM()->options()->get( 'permalink_base' );
+
+ // Search by Profile Slug
+ $args = array(
+ "fields" => 'ids',
+ 'meta_query' => array(
+ array(
+ 'key' => 'um_user_profile_url_slug_'.$permalink_base,
+ 'value' => strtolower( um_queried_user() ),
+ 'compare' => '='
+ )
+ ),
+ 'number' => 1
+ );
+
+
+ $ids = new \WP_User_Query( $args );
+ if ( $ids->total_users > 0 ) {
+ $user_id = current( $ids->get_results() );
+ }
+ }
+
// Try nice name
if ( !$user_id ) {
$slug = um_queried_user();
diff --git a/includes/core/class-roles-capabilities.php b/includes/core/class-roles-capabilities.php
index 3f2a1489..0878254d 100644
--- a/includes/core/class-roles-capabilities.php
+++ b/includes/core/class-roles-capabilities.php
@@ -418,6 +418,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
$um_roles_keys = array_map( function( $item ) {
return 'um_' . $item;
}, $um_roles_keys );
+
}
$orders = array();
@@ -571,21 +572,25 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
* @return bool|int
*/
function um_current_user_can( $cap, $user_id ) {
- if ( ! is_user_logged_in() )
+ if ( ! is_user_logged_in() ) {
return false;
+ }
$return = 1;
um_fetch_user( get_current_user_id() );
$current_user_roles = UM()->roles()->get_all_user_roles( $user_id );
+
switch( $cap ) {
case 'edit':
if ( get_current_user_id() == $user_id && um_user( 'can_edit_profile' ) )
$return = 1;
- elseif ( ! um_user( 'can_edit_everyone' ) )
+ elseif ( get_current_user_id() == $user_id && ! um_user( 'can_edit_profile' ) )
$return = 0;
- elseif ( get_current_user_id() == $user_id && ! um_user( 'can_edit_profile') )
+ elseif ( um_user( 'can_edit_everyone' ) )
+ $return = 1;
+ elseif ( ! um_user( 'can_edit_everyone' ) )
$return = 0;
elseif ( um_user( 'can_edit_roles' ) && ( empty( $current_user_roles ) || count( array_intersect( $current_user_roles, um_user( 'can_edit_roles' ) ) ) <= 0 ) )
$return = 0;
@@ -618,6 +623,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
$user_id = get_current_user_id();
$role = UM()->roles()->get_priority_user_role( $user_id );
+
$permissions = $this->role_data( $role );
/**
@@ -647,6 +653,9 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
if ( isset( $permissions[ $permission ] ) && is_serialized( $permissions[ $permission ] ) )
return unserialize( $permissions[ $permission ] );
+ if ( isset( $permissions[ $permission ] ) && is_array( $permissions[ $permission ] ) )
+ return $permissions[ $permission ];
+
if ( isset( $permissions[ $permission ] ) && $permissions[ $permission ] == 1 )
return true;
diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php
index 98c78253..315e3463 100644
--- a/includes/core/class-shortcodes.php
+++ b/includes/core/class-shortcodes.php
@@ -522,8 +522,18 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$use_custom = get_post_meta( $this->form_id, "_um_{$mode}_use_custom_settings", true );
if ( $use_custom ) { // Custom Form settings
$current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() );
- if ( ! empty( $args['role'] ) && ! in_array( $args['role'], $current_user_roles ) ) {
- return '';
+
+ //backward compatibility between single/multi role form's setting
+ if ( ! empty( $args['role'] ) ) {
+ if ( is_array( $args['role'] ) ) {
+ if ( ! count( array_intersect( $args['role'], $current_user_roles ) ) ) {
+ return '';
+ }
+ } else {
+ if ( ! in_array( $args['role'], $current_user_roles ) ) {
+ return '';
+ }
+ }
}
}
}
diff --git a/includes/core/class-tracking.php b/includes/core/class-tracking.php
index 7b22bce0..17ecc503 100644
--- a/includes/core/class-tracking.php
+++ b/includes/core/class-tracking.php
@@ -161,7 +161,7 @@ if ( ! class_exists( 'um\core\Tracking' ) ) {
$request = wp_remote_post( 'https://ultimatemember.com/?um_action=checkin', array(
'method' => 'POST',
- 'timeout' => 20,
+ 'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
diff --git a/includes/core/class-user.php b/includes/core/class-user.php
index e52f459b..229cc7dc 100644
--- a/includes/core/class-user.php
+++ b/includes/core/class-user.php
@@ -1467,6 +1467,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
function get_admin_actions() {
$items = array();
$actions = array();
+
/**
* UM hook
*
@@ -1488,12 +1489,16 @@ if ( ! class_exists( 'um\core\User' ) ) {
* }
* ?>
*/
- $actions = apply_filters('um_admin_user_actions_hook', $actions );
- if ( !isset( $actions ) || empty( $actions ) ) return false;
- foreach($actions as $id => $arr ) {
- $url = add_query_arg('um_action', $id );
- $url = add_query_arg('uid', um_profile_id(), $url );
- $items[] = '
' . $arr['label'] . ' ';
+ $actions = apply_filters( 'um_admin_user_actions_hook', $actions );
+ if ( ! isset( $actions ) || empty( $actions ) ) {
+ return false;
+ }
+
+ foreach ( $actions as $id => $arr ) {
+ $url = add_query_arg( array( 'um_action' => $id, 'uid' => um_profile_id() ) );
+ /*$url = add_query_arg( 'um_action', $id );
+ $url = add_query_arg( 'uid', um_profile_id(), $url );*/
+ $items[] = '
' . $arr['label'] . ' ';
}
return $items;
}
@@ -1652,18 +1657,12 @@ if ( ! class_exists( 'um\core\User' ) ) {
*/
$changes = apply_filters('um_before_update_profile', $changes, $this->id );
- // save or update profile meta
foreach ( $changes as $key => $value ) {
if ( ! in_array( $key, $this->update_user_keys ) ) {
-
update_user_meta( $this->id, $key, $value );
-
} else {
-
- $args[$key] = esc_attr( $changes[$key] );
-
+ $args[ $key ] = esc_attr( $changes[ $key ] );
}
-
}
diff --git a/includes/core/um-actions-core.php b/includes/core/um-actions-core.php
index fdfabc43..ba9ea420 100644
--- a/includes/core/um-actions-core.php
+++ b/includes/core/um-actions-core.php
@@ -9,32 +9,34 @@ function um_action_request_process() {
if ( is_admin() ) {
return;
}
+
if ( ! is_user_logged_in() ) {
return;
}
+
if ( ! isset( $_REQUEST['um_action'] ) ) {
return;
}
+
if ( isset( $_REQUEST['uid'] ) && ! UM()->user()->user_exists_by_id( $_REQUEST['uid'] ) ) {
return;
}
-
+
if ( isset( $_REQUEST['uid'] ) ) {
if ( is_super_admin( $_REQUEST['uid'] ) ) {
- wp_die( __( 'Super administrators can not be modified.','ultimate-member' ) );
+ wp_die( __( 'Super administrators can not be modified.', 'ultimate-member' ) );
}
}
- if ( isset( $_REQUEST['um_action'] ) && $_REQUEST['um_action'] != "edit" && ! current_user_can( 'edit_users' ) ) {
- wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
- }
+// if ( isset( $_REQUEST['um_action'] ) && $_REQUEST['um_action'] != "edit" && ! current_user_can( 'edit_users' ) ) {
+// wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
+// }
if ( isset( $_REQUEST['uid'] ) ) {
$uid = $_REQUEST['uid'];
}
-
+
switch ( $_REQUEST['um_action'] ) {
-
default:
$uid = isset( $_REQUEST['uid'] ) ? $_REQUEST['uid'] : 0;
/**
@@ -59,63 +61,90 @@ function um_action_request_process() {
*/
do_action( 'um_action_user_request_hook', $_REQUEST['um_action'], $uid );
break;
-
+
case 'edit':
UM()->fields()->editing = true;
- if ( !um_can_edit_my_profile() ) {
- $url = um_edit_my_profile_cancel_uri();
- exit( wp_redirect( $url ) );
+ if ( ! um_is_myprofile() ) {
+ if ( ! UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
+ exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
+ }
+ } else {
+ if ( ! um_can_edit_my_profile() ) {
+ $url = um_edit_my_profile_cancel_uri();
+ exit( wp_redirect( $url ) );
+ }
}
break;
-
+
case 'um_switch_user':
- if ( !current_user_can('delete_users') ) {
+ if ( ! current_user_can( 'delete_users' ) ) {
return;
}
UM()->user()->auto_login( $_REQUEST['uid'] );
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
break;
-
+
case 'um_reject_membership':
+ if ( ! current_user_can( 'manage_options' ) ) {
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
+ }
+
um_fetch_user( $uid );
UM()->user()->reject();
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
break;
-
+
case 'um_approve_membership':
case 'um_reenable':
- um_fetch_user( $uid );
- UM()->user()->approve();
- exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
- break;
-
+ if ( ! current_user_can( 'manage_options' ) ) {
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
+ }
+
+ um_fetch_user( $uid );
+ UM()->user()->approve();
+ exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
+ break;
+
case 'um_put_as_pending':
+ if ( ! current_user_can( 'manage_options' ) ) {
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
+ }
+
um_fetch_user( $uid );
UM()->user()->pending();
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
break;
-
+
case 'um_resend_activation':
+ if ( ! current_user_can( 'manage_options' ) ) {
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
+ }
+
um_fetch_user( $uid );
UM()->user()->email_pending();
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
break;
-
+
case 'um_deactivate':
+ if ( ! current_user_can( 'manage_options' ) ) {
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
+ }
+
um_fetch_user( $uid );
UM()->user()->deactivate();
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
break;
-
+
case 'um_delete':
if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) {
- wp_die( __('You do not have permission to delete this user.','ultimate-member') );
+ wp_die( __( 'You do not have permission to delete this user.', 'ultimate-member' ) );
}
+
um_fetch_user( $uid );
UM()->user()->delete();
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
break;
-
+
}
}
-add_action( 'init', 'um_action_request_process', 10 );
\ No newline at end of file
+add_action( 'template_redirect', 'um_action_request_process', 10000 );
\ No newline at end of file
diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php
index 4e035551..2af4ac9e 100644
--- a/includes/core/um-actions-profile.php
+++ b/includes/core/um-actions-profile.php
@@ -1064,113 +1064,104 @@ add_action( 'um_pre_profile_shortcode', 'um_pre_profile_shortcode' );
* @param $args
*/
function um_add_edit_icon( $args ) {
- $output = '';
-
- if (!is_user_logged_in()) return; // not allowed for guests
-
- if (isset( UM()->user()->cannot_edit ) && UM()->user()->cannot_edit == 1) return; // do not proceed if user cannot edit
-
- if (UM()->fields()->editing == true) {
-
- ?>
-
-
-
-
-
-
-
- fields()->editing == true ) { ?>
+
+
+
+ roles()->um_current_user_can( 'edit', um_profile_id() ) && ! UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) {
+ return;
+ }
+
+ $items = UM()->user()->get_admin_actions();
+ if ( UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
+ $items['editprofile'] = '
' . __( 'Edit Profile', 'ultimate-member' ) . ' ';
+ }
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_profile_edit_menu_items
+ * @description Edit menu items on profile page
+ * @input_vars
+ * [{"var":"$items","type":"array","desc":"User Menu"},
+ * {"var":"$user_id","type":"int","desc":"Profile ID"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage
+ *
+ * @example
+ *
+ */
+ $items = apply_filters( 'um_profile_edit_menu_items', $items, um_profile_id() );
+
+ $items['cancel'] = '
' . __( 'Cancel', 'ultimate-member' ) . ' ';
+
+ } else {
+ $items = array(
+ 'editprofile' => '
' . __( 'Edit Profile', 'ultimate-member' ) . ' ',
+ 'myaccount' => '
' . __( 'My Account', 'ultimate-member' ) . ' ',
+ 'logout' => '
' . __( 'Logout', 'ultimate-member' ) . ' ',
+ 'cancel' => '
' . __( 'Cancel', 'ultimate-member' ) . ' ',
+ );
+
+ if ( ! empty( UM()->user()->cannot_edit ) ) {
+ unset( $items['editprofile'] );
+ }
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_myprofile_edit_menu_items
+ * @description Edit menu items on my profile page
+ * @input_vars
+ * [{"var":"$items","type":"array","desc":"User Menu"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage
+ *
+ * @example
+ *
+ */
+ $items = apply_filters( 'um_myprofile_edit_menu_items', $items );
+ } ?>
+
+
+
+ options()->get( 'profile_menu' ) )
+ if ( ! UM()->options()->get( 'profile_menu' ) ) {
return;
+ }
// get active tabs
$tabs = UM()->profile()->tabs_active();
diff --git a/includes/core/um-filters-fields.php b/includes/core/um-filters-fields.php
index 4a2f59bf..089fdf4c 100644
--- a/includes/core/um-filters-fields.php
+++ b/includes/core/um-filters-fields.php
@@ -146,8 +146,9 @@ add_filter( 'um_profile_field_filter_hook___um_last_login', 'um_profile_field_fi
* @return mixed|string|void
*/
function um_profile_field_filter_hook__textarea( $value, $data ) {
- if ( isset( $data ) && isset( $data['html'] ) && $data['html'] == 1 )
+ if ( isset( $data['html'] ) && $data['html'] == 1 ) {
return $value;
+ }
$value = esc_textarea( $value );
$value = preg_replace('$(https?://[a-z0-9_./?=-]+)(?![^<>]*>)$i', '
$1 ', $value." ");
@@ -612,10 +613,12 @@ function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) {
if( 'text' == $type && ! in_array( $data['validate'], array( 'unique_email' ) ) || 'password' == $type ) {
$value = esc_attr( $value );
- }elseif( $type == 'url' ) {
+ } elseif( $type == 'url' ) {
$value = esc_url( $value );
- } elseif ( 'textarea' == $type ){
- $value = wp_kses_post( $value );
+ } elseif ( 'textarea' == $type ) {
+ if ( empty( $data['html'] ) ) {
+ $value = wp_kses_post( $value );
+ }
}
}
diff --git a/includes/core/um-filters-user.php b/includes/core/um-filters-user.php
index 6fef1987..1cc1e154 100644
--- a/includes/core/um-filters-user.php
+++ b/includes/core/um-filters-user.php
@@ -9,49 +9,47 @@
* @return null
*/
function um_admin_user_actions_hook( $actions ) {
-
$actions = null;
um_fetch_user( um_profile_id() );
- if ( current_user_can('manage_options') ) {
+ //if ( UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
+ if ( current_user_can( 'manage_options' ) ) {
- if ( um_user('account_status') == 'awaiting_admin_review' ){
- $actions['um_approve_membership'] = array( 'label' => __('Approve Membership','ultimate-member') );
- $actions['um_reject_membership'] = array( 'label' => __('Reject Membership','ultimate-member') );
+ if ( um_user( 'account_status' ) == 'awaiting_admin_review' ) {
+ $actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
+ $actions['um_reject_membership'] = array( 'label' => __( 'Reject Membership', 'ultimate-member' ) );
}
- if ( um_user('account_status') == 'rejected' ) {
- $actions['um_approve_membership'] = array( 'label' => __('Approve Membership','ultimate-member') );
+ if ( um_user( 'account_status' ) == 'rejected' ) {
+ $actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
}
- if ( um_user('account_status') == 'approved' ) {
- $actions['um_put_as_pending'] = array( 'label' => __('Put as Pending Review','ultimate-member') );
+ if ( um_user( 'account_status' ) == 'approved' ) {
+ $actions['um_put_as_pending'] = array( 'label' => __( 'Put as Pending Review', 'ultimate-member' ) );
}
- if ( um_user('account_status') == 'awaiting_email_confirmation' ) {
- $actions['um_resend_activation'] = array( 'label' => __('Resend Activation E-mail','ultimate-member') );
+ if ( um_user( 'account_status' ) == 'awaiting_email_confirmation' ) {
+ $actions['um_resend_activation'] = array( 'label' => __( 'Resend Activation E-mail', 'ultimate-member' ) );
}
- if ( um_user('account_status') != 'inactive' ) {
- $actions['um_deactivate'] = array( 'label' => __('Deactivate this account','ultimate-member') );
+ if ( um_user( 'account_status' ) != 'inactive' ) {
+ $actions['um_deactivate'] = array( 'label' => __( 'Deactivate this account', 'ultimate-member' ) );
}
- if ( um_user('account_status') == 'inactive' ) {
- $actions['um_reenable'] = array( 'label' => __('Reactivate this account','ultimate-member') );
- }
-
- if ( UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) {
- $actions['um_delete'] = array( 'label' => __('Delete this user','ultimate-member') );
+ if ( um_user( 'account_status' ) == 'inactive' ) {
+ $actions['um_reenable'] = array( 'label' => __( 'Reactivate this account', 'ultimate-member' ) );
}
}
- if ( current_user_can('delete_users') ) {
- $actions['um_switch_user'] = array( 'label' => __('Login as this user','ultimate-member') );
+ if ( UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) {
+ $actions['um_delete'] = array( 'label' => __( 'Delete this user', 'ultimate-member' ) );
}
-
+ if ( current_user_can( 'delete_users' ) ) {
+ $actions['um_switch_user'] = array( 'label' => __( 'Login as this user', 'ultimate-member' ) );
+ }
return $actions;
}
diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php
index b0758afa..6906efee 100644
--- a/includes/um-short-functions.php
+++ b/includes/um-short-functions.php
@@ -705,10 +705,11 @@ function um_filtered_value( $key, $data = false ) {
* @return bool|int|null
*/
function um_profile_id() {
+ $requested_user = um_get_requested_user();
- if ( um_get_requested_user() ) {
+ if ( $requested_user ) {
return um_get_requested_user();
- } else if (is_user_logged_in() && get_current_user_id()) {
+ } elseif ( is_user_logged_in() && get_current_user_id() ) {
return get_current_user_id();
}
@@ -1063,10 +1064,11 @@ function um_requesting_password_reset() {
* @return bool
*/
function um_requesting_password_change() {
- if (um_is_core_page( 'account' ) && isset( $_POST['_um_account'] ) == 1)
+ if ( um_is_core_page( 'account' ) && isset( $_POST['_um_account'] ) == 1 & isset( $_POST['_um_account_tab'] ) == 'password' ) {
return true;
- else if (isset( $_POST['_um_password_change'] ) && $_POST['_um_password_change'] == 1)
+ } elseif ( isset( $_POST['_um_password_change'] ) && $_POST['_um_password_change'] == 1 ) {
return true;
+ }
return false;
}
@@ -1766,102 +1768,108 @@ function um_get_default_avatar_uri() {
* @return bool|string
*/
function um_get_user_avatar_data( $user_id = '', $size = '96' ) {
- if( empty( $user_id ) ) {
- $user_id = um_user( 'ID' );
- } else {
- um_fetch_user( $user_id );
- }
+ if( empty( $user_id ) ) {
+ $user_id = um_user( 'ID' );
+ } else {
+ um_fetch_user( $user_id );
+ }
- $data = array(
- 'user_id' => $user_id,
- 'default' => um_get_default_avatar_uri(),
- 'class' => 'gravatar avatar avatar-' . $size . ' um-avatar',
- 'size' => $size
- );
+ $data = array(
+ 'user_id' => $user_id,
+ 'default' => um_get_default_avatar_uri(),
+ 'class' => 'gravatar avatar avatar-' . $size . ' um-avatar',
+ 'size' => $size
+ );
if ( $profile_photo = um_profile( 'profile_photo' ) ) {
$data['url'] = um_get_avatar_uri( $profile_photo, $size );
- $data['type'] = 'upload';
- $data['class'] .= ' um-avatar-uploaded';
- } else if( $synced_profile_photo = um_user( 'synced_profile_photo' ) ) {
- $data['url'] = $synced_profile_photo;
- $data['type'] = 'sync';
- $data['class'] .= ' um-avatar-default';
- } else if( UM()->options()->get( 'use_gravatars' ) ) {
- $avatar_hash_id = get_user_meta( $user_id, 'synced_gravatar_hashed_id', true );
- $data['url'] = set_url_scheme( '//gravatar.com/avatar/' . $avatar_hash_id );
- $data['url'] = add_query_arg( 's', 400, $data['url'] );
- $rating = get_option('avatar_rating');
- if ( !empty( $rating ) ) {
+ $data['type'] = 'upload';
+ $data['class'] .= ' um-avatar-uploaded';
+ } elseif ( $synced_profile_photo = um_user( 'synced_profile_photo' ) ) {
+ $data['url'] = $synced_profile_photo;
+ $data['type'] = 'sync';
+ $data['class'] .= ' um-avatar-default';
+ } elseif ( UM()->options()->get( 'use_gravatars' ) ) {
+ $avatar_hash_id = md5( um_user( 'user_email' ) );
+ $data['url'] = set_url_scheme( '//gravatar.com/avatar/' . $avatar_hash_id );
+ $data['url'] = add_query_arg( 's', 400, $data['url'] );
+ $rating = get_option( 'avatar_rating' );
+ if ( ! empty( $rating ) ) {
$data['url'] = add_query_arg( 'r', $rating, $data['url'] );
}
- $gravatar_type = UM()->options()->get( 'use_um_gravatar_default_builtin_image' );
- if ( $gravatar_type == 'default' ) {
- if ( UM()->options()->get( 'use_um_gravatar_default_image' ) ) {
- $data['url'] = add_query_arg( 'd', $data['default'], $data['url'] );
- }
- } else {
- $default = get_option( 'avatar_default', 'mystery' );
- if ( $default == 'gravatar_default' ) {
- $default = '';
- }
- $data['url'] = add_query_arg( 'd', $default, $data['url'] );
- }
- $data['type'] = 'gravatar';
- $data['class'] .= ' um-avatar-gravatar';
- } else {
- $data['url'] = $data['default'];
- $data['type'] = 'default';
- $data['class'] .= ' um-avatar-default';
- }
- /**
- * UM hook
- *
- * @type filter
- * @title um_user_avatar_url_filter
- * @description Change user avatar URL
- * @input_vars
- * [{"var":"$avatar_uri","type":"string","desc":"Avatar URL"},
- * {"var":"$user_id","type":"int","desc":"User ID"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_user_avatar_url_filter', 'function_name', 10, 2 );
- * @example
- *
- */
- $data['url'] = apply_filters( 'um_user_avatar_url_filter', $data['url'], $user_id, $data );
- /**
- * UM hook
- *
- * @type filter
- * @title um_avatar_image_alternate_text
- * @description Change user display name on um_user function profile photo
- * @input_vars
- * [{"var":"$display_name","type":"string","desc":"User Display Name"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 );
- * @example
- *
- */
- $data['alt'] = apply_filters( "um_avatar_image_alternate_text", um_user( "display_name" ), $data );
+ $gravatar_type = UM()->options()->get( 'use_um_gravatar_default_builtin_image' );
+ if ( $gravatar_type == 'default' ) {
+ if ( UM()->options()->get( 'use_um_gravatar_default_image' ) ) {
+ $data['url'] = add_query_arg( 'd', $data['default'], $data['url'] );
+ } else {
+ $default = get_option( 'avatar_default', 'mystery' );
+ if ( $default == 'gravatar_default' ) {
+ $default = '';
+ }
+ $data['url'] = add_query_arg( 'd', $default, $data['url'] );
+ }
+ } else {
+ $data['url'] = add_query_arg( 'd', $gravatar_type, $data['url'] );
+ }
+
+ $data['type'] = 'gravatar';
+ $data['class'] .= ' um-avatar-gravatar';
+ } else {
+ $data['url'] = $data['default'];
+ $data['type'] = 'default';
+ $data['class'] .= ' um-avatar-default';
+ }
+
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_user_avatar_url_filter
+ * @description Change user avatar URL
+ * @input_vars
+ * [{"var":"$avatar_uri","type":"string","desc":"Avatar URL"},
+ * {"var":"$user_id","type":"int","desc":"User ID"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_user_avatar_url_filter', 'function_name', 10, 2 );
+ * @example
+ *
+ */
+ $data['url'] = apply_filters( 'um_user_avatar_url_filter', $data['url'], $user_id, $data );
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_avatar_image_alternate_text
+ * @description Change user display name on um_user function profile photo
+ * @input_vars
+ * [{"var":"$display_name","type":"string","desc":"User Display Name"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 );
+ * @example
+ *
+ */
+ $data['alt'] = apply_filters( "um_avatar_image_alternate_text", um_user( "display_name" ), $data );
return $data;
}
+
/**
* get user avatar url
*
diff --git a/readme.txt b/readme.txt
index 9eb1d6fd..684b8d60 100644
--- a/readme.txt
+++ b/readme.txt
@@ -131,6 +131,32 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
= Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin =
+= 2.0.18: June 25, 2018 =
+
+* Enhancements:
+ - Added an ability to create different email templates for each site on multisites installs
+ - Added major version notice
+ - Added an ability to make Profile Form visible for 2 or more roles
+ - Redesign some parts of field's conditional logic settings
+
+* Bugfixes:
+ - Fixed PHP memory limit issue on some installs. Created pseudo-constructor
+ - Disabled email notification to user, which wasn't approved about delete their account
+ - Fixed profile tabs privacy
+ - Fixed default avatars and Gravatar displaying
+ - Fixed get current URL function
+ - Fixed admin bar displaying
+ - Fixed members directory search
+ - Fixed nav-menu items restriction handlers
+ - Fixed user displaying on multisite (added 404 error in some cases)
+ - Fixed XSS at wp-admin settings screen
+ - Fixed user's "user_login" permalinks
+ - Fixed user's capabilities ("Edit", "Delete" user) and profile actions displaying
+ - Fixed field's conditional logic
+
+* Deprecated:
+ - REST API user's key option;
+
= 2.0.17: May 30, 2018 =
* Enhancements:
diff --git a/ultimate-member.php b/ultimate-member.php
index 4e0d15a7..068a707c 100644
--- a/ultimate-member.php
+++ b/ultimate-member.php
@@ -3,7 +3,7 @@
Plugin Name: Ultimate Member
Plugin URI: http://ultimatemember.com/
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
-Version: 2.0.18-alpha1
+Version: 2.0.18
Author: Ultimate Member
Author URI: http://ultimatemember.com/
Text Domain: ultimate-member