Ultimate Member – User Profile & Membership Plugin - Version 2.0.21

Version Description

Download this release

Release Info

Developer nsinelnikov
Plugin Icon 128x128 Ultimate Member – User Profile & Membership Plugin
Version 2.0.21
Comparing to
See all releases

Code changes from version 2.0.17 to 2.0.21

Files changed (57) hide show
  1. assets/css/um-styles.css +31 -2
  2. assets/js/um-conditional.js +8 -6
  3. assets/js/um-conditional.min.js +1 -1
  4. assets/js/um-functions.js +8 -1
  5. assets/js/um-functions.min.js +1 -1
  6. includes/admin/assets/css/um-admin-global.css +4 -0
  7. includes/admin/assets/css/um-admin-misc.css +6 -0
  8. includes/admin/assets/css/um-admin-settings.css +0 -8
  9. includes/admin/assets/js/um-admin-ajax.js +0 -1
  10. includes/admin/assets/js/um-admin-field.js +39 -17
  11. includes/admin/assets/js/um-admin-global.js +71 -0
  12. includes/admin/assets/js/um-admin-modal.js +42 -13
  13. includes/admin/assets/js/um-admin-scripts.js +25 -1
  14. includes/admin/assets/js/um-admin-settings.js +0 -38
  15. includes/admin/core/class-admin-builder.php +21 -15
  16. includes/admin/core/class-admin-enqueue.php +11 -7
  17. includes/admin/core/class-admin-forms.php +5 -10
  18. includes/admin/core/class-admin-metabox.php +1 -1
  19. includes/admin/core/class-admin-notices.php +182 -13
  20. includes/admin/core/class-admin-settings.php +9 -15
  21. includes/admin/core/class-admin-upgrade.php +51 -31
  22. includes/admin/core/packages/2.0-beta1/email_templates.php +224 -22
  23. includes/admin/core/packages/2.0-beta1/functions.php +2 -0
  24. includes/admin/templates/form/profile_customize.php +16 -14
  25. includes/class-config.php +1 -2
  26. includes/class-dependencies.php +3 -3
  27. includes/class-init.php +13 -15
  28. includes/core/class-access.php +17 -15
  29. includes/core/class-account.php +1 -1
  30. includes/core/class-builtin.php +1 -1
  31. includes/core/class-enqueue.php +3 -1
  32. includes/core/class-fields.php +47 -19
  33. includes/core/class-files.php +8 -6
  34. includes/core/class-form.php +1 -1
  35. includes/core/class-mail.php +104 -98
  36. includes/core/class-members.php +20 -5
  37. includes/core/class-password.php +4 -0
  38. includes/core/class-permalinks.php +4 -40
  39. includes/core/class-plugin-updater.php +12 -4
  40. includes/core/class-profile.php +35 -20
  41. includes/core/class-rest-api.php +3 -3
  42. includes/core/class-rewrite.php +24 -0
  43. includes/core/class-roles-capabilities.php +12 -3
  44. includes/core/class-setup.php +3 -3
  45. includes/core/class-shortcodes.php +12 -2
  46. includes/core/class-tracking.php +0 -185
  47. includes/core/class-user.php +16 -13
  48. includes/core/um-actions-core.php +55 -26
  49. includes/core/um-actions-profile.php +82 -90
  50. includes/core/um-actions-wpadmin.php +2 -5
  51. includes/core/um-filters-fields.php +7 -4
  52. includes/core/um-filters-members.php +55 -34
  53. includes/core/um-filters-user.php +20 -22
  54. includes/um-short-functions.php +97 -89
  55. includes/widgets/class-um-search-widget.php +1 -1
  56. readme.txt +46 -1
  57. ultimate-member.php +1 -1
assets/css/um-styles.css CHANGED
@@ -621,11 +621,40 @@ input[type=submit].um-button:hover {
621
-moz-border-radius: 4px !important;
622
-webkit-border-radius: 4px !important;
623
border-radius: 4px !important;
624
- border-top: 1px solid rgba(0,0,0,0.0) !important;
625
- border-bottom: 2px solid rgba(0, 0, 0, 0.1) !important;
626
opacity: 1;
627
}
628
629
630
.um-button.um-btn-auto-width {
631
width: auto;
621
-moz-border-radius: 4px !important;
622
-webkit-border-radius: 4px !important;
623
border-radius: 4px !important;
624
+ -webkit-box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
625
+ box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
626
opacity: 1;
627
}
628
629
+ a.um-button {
630
+ font-size: 15px;
631
+ border: none !important;
632
+ display: block;
633
+ width: 100%;
634
+ line-height: 1em !important;
635
+ padding: 16px 20px !important;
636
+ text-decoration: none !important;
637
+ text-align: center;
638
+ text-transform: none !important;
639
+ font-weight: normal !important;
640
+ overflow: hidden;
641
+ position: relative;
642
+
643
+ transition: 0.25s;
644
+ box-sizing: border-box;
645
+ -moz-border-radius: 4px !important;
646
+ -webkit-border-radius: 4px !important;
647
+ border-radius: 4px !important;
648
+ -webkit-box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
649
+ box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
650
+ opacity: 1;
651
+ }
652
+
653
+ a.um-button:hover {
654
+ -webkit-box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
655
+ box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
656
+ }
657
+
658
659
.um-button.um-btn-auto-width {
660
width: auto;
assets/js/um-conditional.js CHANGED
@@ -12,7 +12,6 @@ jQuery(document).ready( function (){
12
function um_get_field_default_value( $dom ) {
13
var default_value = '';
14
var type = um_get_field_type($dom);
15
-
16
switch ( type ) {
17
18
case 'text':
@@ -25,7 +24,6 @@ jQuery(document).ready( function (){
25
26
case 'multiselect':
27
default_value = $dom.find('select').val();
28
-
29
break;
30
31
case 'radio':
@@ -249,7 +247,6 @@ jQuery(document).ready( function (){
249
}
250
251
if (condition.operator == 'equals to') {
252
-
253
if (condition.value == live_field_value && um_in_array(live_field_value, $owners_values[condition.owner])) {
254
$owners[condition.owner][index] = true;
255
} else {
@@ -505,17 +502,22 @@ jQuery(document).ready( function (){
505
}
506
}
507
508
- jQuery(document).on('change', '.um-field select, .um-field input[type=radio], .um-field input[type=checkbox]', function () {
509
var me = jQuery(this);
510
um_apply_conditions(me, false);
511
});
512
513
- jQuery(document).on('input change', '.um-field input[type=text]', function () {
514
var me = jQuery(this);
515
um_apply_conditions(me, false);
516
});
517
518
- jQuery(document).on('input change', '.um-field input[type=password]', function () {
519
var me = jQuery(this);
520
um_apply_conditions(me, false);
521
});
12
function um_get_field_default_value( $dom ) {
13
var default_value = '';
14
var type = um_get_field_type($dom);
15
switch ( type ) {
16
17
case 'text':
24
25
case 'multiselect':
26
default_value = $dom.find('select').val();
27
break;
28
29
case 'radio':
247
}
248
249
if (condition.operator == 'equals to') {
250
if (condition.value == live_field_value && um_in_array(live_field_value, $owners_values[condition.owner])) {
251
$owners[condition.owner][index] = true;
252
} else {
502
}
503
}
504
505
+ jQuery(document).on('change', '.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]', function () {
506
+ var me = jQuery(this);
507
+ um_apply_conditions(me, false);
508
+ });
509
+
510
+ jQuery(document).on('input change', '.um-field input[type="text"]', function () {
511
var me = jQuery(this);
512
um_apply_conditions(me, false);
513
});
514
515
+ jQuery(document).on('input change', '.um-field input[type="number"]', function () {
516
var me = jQuery(this);
517
um_apply_conditions(me, false);
518
});
519
520
+ jQuery(document).on('input change', '.um-field input[type="password"]', function () {
521
var me = jQuery(this);
522
um_apply_conditions(me, false);
523
});
assets/js/um-conditional.min.js CHANGED
@@ -1 +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)<parseInt(a.value)?d[a.owner][n]=!0:d[a.owner][n]=!1),"contains"==a.operator&&("multiselect"==i(e.parents(".um-field[data-key]"))?u&&u.indexOf(a.value)>=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()});
1
+ jQuery(document).ready(function(){function e(e){var n="",t=i(e);switch(t){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:t,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 t(e){var n=[];return jQuery.each(h,function(i,t){t.field.parent==e&&n.push(t.field.condition)}),n}function a(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 t,a=!1,i=!!i;for(t in n)if(i&&n[t]===e||!i&&n[t]==e){a=!0;break}return a}function r(e,n){var t=e.parents(".um-field[data-key]").data("key"),r=p[t],o=a(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,t){"undefined"==typeof d[t.owner]&&(d[t.owner]={}),"empty"==t.operator&&(!o||""==o&&c(o,s[t.owner])?d[t.owner][n]=!0:d[t.owner][n]=!1),"not empty"==t.operator&&(o&&""!=o&&!c(o,s[t.owner])?d[t.owner][n]=!0:d[t.owner][n]=!1),"equals to"==t.operator&&(t.value==o&&c(o,s[t.owner])?d[t.owner][n]=!0:d[t.owner][n]=!1),"not equals"==t.operator&&(jQuery.isNumeric(t.value)&&parseInt(o)!=parseInt(t.value)&&o&&!c(o,s[t.owner])?d[t.owner][n]=!0:t.value==o||c(o,s[t.owner])?d[t.owner][n]=!1:d[t.owner][n]=!0),"greater than"==t.operator&&(jQuery.isNumeric(t.value)&&parseInt(o)>parseInt(t.value)?d[t.owner][n]=!0:d[t.owner][n]=!1),"less than"==t.operator&&(jQuery.isNumeric(t.value)&&parseInt(o)<parseInt(t.value)?d[t.owner][n]=!0:d[t.owner][n]=!1),"contains"==t.operator&&("multiselect"==i(e.parents(".um-field[data-key]"))?o&&o.indexOf(t.value)>=0&&c(t.value,o)?d[t.owner][n]=!0:d[t.owner][n]=!1:"checkbox"==i(e.parents(".um-field[data-key]"))?o&&o.indexOf(t.value)>=0?d[t.owner][n]=!0:d[t.owner][n]=!1:o&&o.indexOf(t.value)>=0&&c(o,s[t.owner])?d[t.owner][n]=!0:d[t.owner][n]=!1)}),jQuery.each(d,function(n,i){c(!0,i)?u(e,l[n],!0):u(e,l[n],!1)}),e.trigger("um_fields_change")}function u(e,n,i){var t=jQuery('div.um-field[data-key="'+n.owner+'"]');"show"==n.action&&i&&(t.show(),l(t),o(t)),"show"!=n.action||i||(t.hide(),s(t)),"hide"==n.action&&i&&(t.hide(),s(t)),"hide"!=n.action||i||(t.show(),l(t),o(t)),e.removeClass("um-field-has-changed")}function o(e){var t=i(e),a=e.data("key"),c=v[a];switch(t){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 t=e.find('input[type=checkbox][value="'+i+'"]');t.attr("checked",!0),t.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),t.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),t.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 u=n(e);"radio"!=t&&"checkbox"!=t||(u=u.find(":checked")),u&&(u.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 t={};jQuery.each(jQuery(this)[0].attributes,function(e,n){if(n.name.indexOf("data-cond")!=-1){var i=n.name.slice(10),a=i.substring(1,0),c=i.slice(2);"undefined"==typeof t[a]&&(t[a]={}),t[a][c]=n.value}}),jQuery.each(t,function(e,i){var t={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(t)}),v[jQuery(this).data("key")]=e(jQuery(this))}),jQuery.each(i,function(e,n){p[n]=t(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="number"]',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()});
assets/js/um-functions.js CHANGED
@@ -635,7 +635,6 @@ function um_modal_responsive() {
635
}
636
637
function um_remove_modal(){
638
-
639
jQuery('img.cropper-hidden').cropper('destroy');
640
641
jQuery('body,html,textarea').css("overflow", "auto");
@@ -670,6 +669,14 @@ function prepare_Modal() {
670
671
function remove_Modal() {
672
if ( jQuery('.um-popup-overlay').length ) {
673
jQuery('.tipsy').remove();
674
jQuery('.um-popup').empty().remove();
675
jQuery('.um-popup-overlay').empty().remove();
635
}
636
637
function um_remove_modal(){
638
jQuery('img.cropper-hidden').cropper('destroy');
639
640
jQuery('body,html,textarea').css("overflow", "auto");
669
670
function remove_Modal() {
671
if ( jQuery('.um-popup-overlay').length ) {
672
+ jQuery( document ).trigger( 'um_before_modal_removed' );
673
+
674
+ if ( jQuery('.um-popup-autogrow:visible').length ) {
675
+ jQuery('.um-popup-autogrow:visible').mCustomScrollbar("destroy");
676
+ } else if ( jQuery('.um-popup-autogrow2:visible').length ) {
677
+ jQuery('.um-popup-autogrow2:visible').mCustomScrollbar("destroy");
678
+ }
679
+
680
jQuery('.tipsy').remove();
681
jQuery('.um-popup').empty().remove();
682
jQuery('.um-popup-overlay').empty().remove();
assets/js/um-functions.min.js CHANGED
@@ -1 +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='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":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('<div class="um-error-block">'+a.error+"</div>"),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='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":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('<div class="um-error-block">'+a.error+"</div>"),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('<div class="um-clear"></div>'))}}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('<div class="um-modal-overlay"></div><div class="um-modal is-photo"></div>'):jQuery("body").append('<div class="um-modal-overlay"></div><div class="um-modal no-photo"></div>'),jQuery("#"+e).prependTo(".um-modal"),a){jQuery(".um-modal").find(".um-modal-photo").html("<img />");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('<div class="um-popup-overlay"></div>'),jQuery("body").append('<div class="um-popup"></div>'),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()});
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(),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&&(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"==o&&(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"),o=e.width(),a=t.split(":");calcHeight=Math.round(o/a[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='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":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,o,a){e.selectedFiles=0;try{o=jQuery.parseJSON(o)}catch(e){return void console.log(e,o)}o.error&&""!=o.error?(e.parents(".um-modal-body").append('<div class="um-error-block">'+o.error+"</div>"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(o,function(t,o){var a=e.parents(".um-modal-body").find(".um-single-image-preview img"),i=e.parents(".um-modal-body").find(".um-single-image-preview");a.attr("src",o),a.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='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":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,o,a){e.selectedFiles=0,o=jQuery.parseJSON(o),o.error&&""!=o.error?(e.parents(".um-modal-body").append('<div class="um-error-block">'+o.error+"</div>"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),setTimeout(function(){um_modal_responsive()},1e3)):(jQuery.each(o,function(t,o){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(o):"icon_bg"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":o}):"filename"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(o):e.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",o)}),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"),o=e.parent().attr("data-crop"),a=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"==o)var s={minWidth:a,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"==o){Math.round(a/r)>0&&(i=Math.round(a/r));var s={minWidth:a,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"==o)var s={minWidth:a,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!=o&&(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('<div class="um-clear"></div>'))}}function um_new_modal(e,t,o,a){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()}),o?jQuery("body").append('<div class="um-modal-overlay"></div><div class="um-modal is-photo"></div>'):jQuery("body").append('<div class="um-modal-overlay"></div><div class="um-modal no-photo"></div>'),jQuery("#"+e).prependTo(".um-modal"),o){jQuery(".um-modal").find(".um-modal-photo").html("<img />");var r=jQuery(".um-modal-photo img"),u=jQuery(window).width()-60,d=jQuery(window).height()-.25*jQuery(window).height();r.attr("src",a),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 o=jQuery(".um-modal-photo img"),a=jQuery(window).width()-60,i=jQuery(window).height()-.25*jQuery(window).height();o.css({opacity:0}),o.css({"max-width":a}),o.css({"max-height":i}),jQuery(".um-modal").css({width:o.width(),"margin-left":"-"+o.width()/2+"px"}),o.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('<div class="um-popup-overlay"></div>'),jQuery("body").append('<div class="um-popup"></div>'),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(jQuery(document).trigger("um_before_modal_removed"),jQuery(".um-popup-autogrow:visible").length?jQuery(".um-popup-autogrow:visible").mCustomScrollbar("destroy"):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(),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()});
includes/admin/assets/css/um-admin-global.css CHANGED
@@ -197,4 +197,8 @@ a.um-delete{ color: #a00; }
197
.wp-admin p.um-nav-roles label {
198
margin-top: 2px !important;
199
margin-bottom: 2px !important;
200
}
197
.wp-admin p.um-nav-roles label {
198
margin-top: 2px !important;
199
margin-bottom: 2px !important;
200
+ }
201
+
202
+ .um_hidden_notice {
203
+ display: none;
204
}
includes/admin/assets/css/um-admin-misc.css CHANGED
@@ -258,3 +258,9 @@ p.disabled-on-off .um-admin-yesno *{
258
visibility: hidden;
259
height: 0;
260
}
258
visibility: hidden;
259
height: 0;
260
}
261
+
262
+ .um-admin-cur-condition-template {
263
+ display: none;
264
+ }
265
+
266
+
includes/admin/assets/css/um-admin-settings.css CHANGED
@@ -240,14 +240,6 @@ th.column-email.column-primary {
240
}
241
*/
242
243
- .email_template_wrapper .reset_email_template {
244
- display: none;
245
- }
246
-
247
- .email_template_wrapper.in_theme .reset_email_template {
248
- display: block;
249
- }
250
-
251
.um_setting_ajax_button_response.complete {
252
color:darkgreen;
253
font-style: italic;
240
}
241
*/
242
243
.um_setting_ajax_button_response.complete {
244
color:darkgreen;
245
font-style: italic;
includes/admin/assets/js/um-admin-ajax.js CHANGED
@@ -28,7 +28,6 @@ jQuery(document).ready(function() {
28
jQuery('.tipsy').hide();
29
30
um_admin_remove_modal();
31
-
32
jQuery.ajax({
33
url: um_admin_ajax_data.ajax_url,
34
type: 'POST',
28
jQuery('.tipsy').hide();
29
30
um_admin_remove_modal();
31
jQuery.ajax({
32
url: um_admin_ajax_data.ajax_url,
33
type: 'POST',
includes/admin/assets/js/um-admin-field.js CHANGED
@@ -3,13 +3,13 @@ jQuery(document).ready(function() {
3
/* Remove field permanently */
4
jQuery(document).on('click', '.um-admin-btns a span.remove', function(e){
5
e.preventDefault();
6
-
7
- if (confirm('This will permanently delete this custom field from database')) {
8
-
9
jQuery(this).parents('a').remove();
10
-
11
arg1 = jQuery(this).parents('a').data('arg1');
12
-
13
jQuery.ajax({
14
url: um_admin_field_data.do_ajax_url,
15
type: 'POST',
@@ -21,18 +21,41 @@ jQuery(document).ready(function() {
21
22
}
23
});
24
-
25
-
26
}
27
-
28
return false;
29
});
30
-
31
/* Add a Field */
32
jQuery(document).on('submit', 'form.um_add_field', function(e){
33
-
34
e.preventDefault();
35
-
36
var form = jQuery(this);
37
38
jQuery.ajax({
@@ -50,9 +73,8 @@ jQuery(document).ready(function() {
50
form.css({'opacity': 1});
51
},
52
success: function(data){
53
-
54
if (data.error){
55
-
56
c = 0;
57
jQuery.each(data.error, function(i, v){
58
c++;
@@ -61,11 +83,11 @@ jQuery(document).ready(function() {
61
form.find('.um-admin-error-block').show().html(v);
62
}
63
});
64
-
65
um_admin_modal_responsive();
66
-
67
} else {
68
-
69
jQuery('.um-col-demon-settings').data('in_row', '');
70
jQuery('.um-col-demon-settings').data('in_sub_row', '');
71
jQuery('.um-col-demon-settings').data('in_column', '');
@@ -78,7 +100,7 @@ jQuery(document).ready(function() {
78
79
},
80
error: function(data){
81
-
82
}
83
});
84
3
/* Remove field permanently */
4
jQuery(document).on('click', '.um-admin-btns a span.remove', function(e){
5
e.preventDefault();
6
+
7
+ if ( confirm( 'This will permanently delete this custom field from database' ) ) {
8
+
9
jQuery(this).parents('a').remove();
10
+
11
arg1 = jQuery(this).parents('a').data('arg1');
12
+
13
jQuery.ajax({
14
url: um_admin_field_data.do_ajax_url,
15
type: 'POST',
21
22
}
23
});
24
}
25
+
26
return false;
27
});
28
+
29
+
30
/* Add a Field */
31
jQuery(document).on('submit', 'form.um_add_field', function(e){
32
+
33
e.preventDefault();
34
+ var conditions = jQuery('.um-admin-cur-condition');
35
+ //need fields refactor
36
+ jQuery(conditions).each( function ( i ) {
37
+
38
+ if ( jQuery( this ).find('[id^="_conditional_action"]').val() === '' ||
39
+ jQuery( this ).find('[id^="_conditional_field"]').val() === '' ||
40
+ jQuery( this ).find('[id^="_conditional_operator"]').val() ==='' )
41
+ {
42
+ jQuery(conditions[i]).find('.um-admin-remove-condition').click();
43
+ }
44
+ } );
45
+ conditions = jQuery('.um-admin-cur-condition');
46
+ jQuery(conditions).each( function ( i ) {
47
+ var id = i === 0 ? '' : i;
48
+
49
+ jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id);
50
+ jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id);
51
+ jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id);
52
+ jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id);
53
+ jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id);
54
+ jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
55
+ jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
56
+ jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
57
+
58
+ } );
59
var form = jQuery(this);
60
61
jQuery.ajax({
73
form.css({'opacity': 1});
74
},
75
success: function(data){
76
if (data.error){
77
+
78
c = 0;
79
jQuery.each(data.error, function(i, v){
80
c++;
83
form.find('.um-admin-error-block').show().html(v);
84
}
85
});
86
+
87
um_admin_modal_responsive();
88
+
89
} else {
90
+
91
jQuery('.um-col-demon-settings').data('in_row', '');
92
jQuery('.um-col-demon-settings').data('in_sub_row', '');
93
jQuery('.um-col-demon-settings').data('in_column', '');
100
101
},
102
error: function(data){
103
+ console.log(data);
104
}
105
});
106
includes/admin/assets/js/um-admin-global.js ADDED
@@ -0,0 +1,71 @@
1
+ jQuery(document).ready(function() {
2
+
3
+
4
+ jQuery(document).on('click', '#um_add_review_love', function (e) {
5
+ jQuery(this).parents('#um_start_review_notice').hide();
6
+ jQuery('.um_hidden_notice[data-key="love"]').show();
7
+ });
8
+
9
+
10
+ jQuery(document).on('click', '#um_add_review_good', function (e) {
11
+ jQuery(this).parents('#um_start_review_notice').hide();
12
+ jQuery('.um_hidden_notice[data-key="good"]').show();
13
+ });
14
+
15
+
16
+ jQuery(document).on('click', '#um_add_review_bad', function (e) {
17
+ jQuery(this).parents('#um_start_review_notice').hide();
18
+ jQuery('.um_hidden_notice[data-key="bad"]').show();
19
+ });
20
+
21
+
22
+ jQuery(document).on('click', '.um_review_link', function (e) {
23
+ jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ).trigger('click');
24
+ });
25
+
26
+
27
+ jQuery(document).on('click', '.um_opt_in_link', function (e) {
28
+ jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ).trigger('click');
29
+ });
30
+
31
+
32
+ jQuery(document).on('click', '#um_opt_in_start', function (e) {
33
+ var obj = jQuery(this);
34
+ var dismiss = jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' );
35
+ jQuery(this).prop('disabled', true).attr('disabled', 'disabled');
36
+
37
+ wp.ajax.send( 'um_opt_in_notice', {
38
+ data: {
39
+ nonce: um_admin_scripts.nonce
40
+ },
41
+ success: function( data ) {
42
+ dismiss.trigger('click');
43
+ obj.prop('disabled', false).removeAttr( 'disabled' );
44
+ },
45
+ error: function( data ) {
46
+ obj.prop('disabled', false).removeAttr( 'disabled' );
47
+ return false;
48
+ }
49
+ });
50
+ });
51
+
52
+
53
+ jQuery(document).on( 'click', '.um-admin-notice.is-dismissible .notice-dismiss', function(e) {
54
+ var notice_key = jQuery(this).parents('.um-admin-notice').data('key');
55
+
56
+ wp.ajax.send( 'um_dismiss_notice', {
57
+ data: {
58
+ key: notice_key,
59
+ nonce: um_admin_scripts.nonce
60
+ },
61
+ success: function( data ) {
62
+ return true;
63
+ },
64
+ error: function( data ) {
65
+ return false;
66
+ }
67
+ });
68
+ });
69
+
70
+
71
+ });
includes/admin/assets/js/um-admin-modal.js CHANGED
@@ -190,35 +190,51 @@ jQuery(document).ready(function() {
190
}
191
um_admin_modal_responsive();
192
});
193
-
194
/**
195
clone a condition
196
**/
197
- jQuery(document).on('click', '.um-admin-new-condition', function(){
198
if ( jQuery(this).hasClass('disabled') )
199
return false;
200
201
- var content = jQuery(this).parents('.um-admin-btn-content');
202
- var length = content.find('.um-admin-cur-condition').length;
203
if ( length < 5 ) {
204
//content.find('select').select2('destroy');
205
206
- var cloned = jQuery(this).parents('.um-admin-cur-condition').clone();
207
- cloned.find('input[type=text],select').each(function(){
208
- jQuery(this).attr('id', jQuery(this).attr('id') + length );
209
- jQuery(this).attr('name', jQuery(this).attr('name') + length );
210
- });
211
- cloned.find('input[type=text]').val('');
212
- cloned.find('.um-admin-new-condition').replaceWith('<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>');
213
214
- cloned.appendTo( content );
215
- cloned.find('select').val('');
216
um_admin_live_update_scripts();
217
um_admin_modal_responsive();
218
} else {
219
jQuery(this).addClass('disabled');
220
alert( 'You already have 5 rules' );
221
}
222
});
223
224
/**
@@ -242,6 +258,19 @@ jQuery(document).ready(function() {
242
jQuery('.um-admin-new-condition').removeClass('disabled');
243
jQuery('.tipsy').remove();
244
condition.remove();
245
um_admin_live_update_scripts();
246
um_admin_modal_responsive();
247
});
190
}
191
um_admin_modal_responsive();
192
});
193
+
194
+
195
+
196
/**
197
clone a condition
198
**/
199
+ jQuery(document).on('click', '.um-admin-new-condition', function() {
200
+
201
if ( jQuery(this).hasClass('disabled') )
202
return false;
203
204
+ var content = jQuery(this).parents('.um-admin-btn-content'),
205
+ length = content.find('.um-admin-cur-condition').length;
206
+
207
if ( length < 5 ) {
208
//content.find('select').select2('destroy');
209
210
+ var template = jQuery('.um-admin-btn-content').find('.um-admin-cur-condition-template').clone();
211
+ template.find('input[type=text]').val('');
212
+ template.find('select').val('');
213
+
214
+ template.appendTo( content );
215
+ jQuery(template).removeClass("um-admin-cur-condition-template");
216
+ jQuery(template).addClass("um-admin-cur-condition");
217
218
um_admin_live_update_scripts();
219
um_admin_modal_responsive();
220
} else {
221
jQuery(this).addClass('disabled');
222
alert( 'You already have 5 rules' );
223
}
224
+ //need fields refactor
225
+ var conditions = jQuery('.um-admin-cur-condition');
226
+ jQuery(conditions).each( function ( i ) {
227
+ id = i === 0 ? '' : i;
228
+ jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id);
229
+ jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id);
230
+ jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id);
231
+ jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id);
232
+ jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id);
233
+ jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
234
+ jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
235
+ jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
236
+ } );
237
+
238
});
239
240
/**
258
jQuery('.um-admin-new-condition').removeClass('disabled');
259
jQuery('.tipsy').remove();
260
condition.remove();
261
+ //need fields refactor
262
+ var conditions = jQuery('.um-admin-cur-condition');
263
+ jQuery(conditions).each( function ( i ) {
264
+ id = i === 0 ? '' : i;
265
+ jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id);
266
+ jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id);
267
+ jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id);
268
+ jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id);
269
+ jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id);
270
+ jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
271
+ jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
272
+ jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
273
+ } );
274
um_admin_live_update_scripts();
275
um_admin_modal_responsive();
276
});
includes/admin/assets/js/um-admin-scripts.js CHANGED
@@ -12,6 +12,31 @@ function um_init_tooltips() {
12
13
jQuery(document).ready(function() {
14
15
/**
16
clone a field dropdown
17
**/
@@ -215,5 +240,4 @@ jQuery(document).ready(function() {
215
jQuery(this).parents('.um-nav-edit').find('.um-nav-roles').hide();
216
}
217
});
218
-
219
});
12
13
jQuery(document).ready(function() {
14
15
+ /**
16
+ clone a field dropdown
17
+ **/
18
+ jQuery(document).on( 'click', '#um_add_review_love', function(e){
19
+ jQuery(this).parents('#um_start_review_notice').hide();
20
+ jQuery('.um_hidden_notice[data-key="love"]').show();
21
+ });
22
+
23
+ /**
24
+ clone a field dropdown
25
+ **/
26
+ jQuery(document).on( 'click', '#um_add_review_good', function(e){
27
+ jQuery(this).parents('#um_start_review_notice').hide();
28
+ jQuery('.um_hidden_notice[data-key="good"]').show();
29
+ });
30
+
31
+ /**
32
+ clone a field dropdown
33
+ **/
34
+ jQuery(document).on( 'click', '#um_add_review_bad', function(e){
35
+ jQuery(this).parents('#um_start_review_notice').hide();
36
+ jQuery('.um_hidden_notice[data-key="bad"]').show();
37
+ });
38
+
39
+
40
/**
41
clone a field dropdown
42
**/
240
jQuery(this).parents('.um-nav-edit').find('.um-nav-roles').hide();
241
}
242
});
243
});
includes/admin/assets/js/um-admin-settings.js CHANGED
@@ -1,42 +1,4 @@
1
jQuery( document ).ready( function() {
2
- /**
3
- * Email templates
4
- */
5
- /*jQuery( 'body' ).on( 'click', '.copy_email_template', function() {
6
- var obj = jQuery(this);
7
-
8
- jQuery.ajax({
9
- url: php_data.copy_email_template,
10
- type: 'POST',
11
- data: { email_key : obj.parents('.email_template_wrapper').data('key') },
12
- success: function(data){
13
- obj.parents('.email_template_wrapper').addClass('in_theme');
14
- },
15
- error: function(data){
16
- alert('Something went wrong');
17
- }
18
- });
19
- });*/
20
-
21
- jQuery( 'body' ).on( 'click', '.reset_email_template', function() {
22
- var obj = jQuery(this);
23
-
24
- jQuery.ajax({
25
- url: php_data.delete_email_template,
26
- type: 'POST',
27
- data: { email_key : obj.parents('.email_template_wrapper').data('key') },
28
- success: function(data){
29
- obj.parents('.email_template_wrapper').removeClass('in_theme');
30
- },
31
- error: function(data){
32
- alert('Something went wrong');
33
- }
34
- });
35
- });
36
-
37
-
38
-
39
-
40
/**
41
* Licenses
42
*/
1
jQuery( document ).ready( function() {
2
/**
3
* Licenses
4
*/
includes/admin/core/class-admin-builder.php CHANGED
@@ -167,27 +167,27 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
167
function um_admin_pre_save_field_to_form( $array ){
168
unset( $array['conditions'] );
169
if ( isset($array['conditional_field']) && !empty( $array['conditional_action'] ) && !empty( $array['conditional_operator'] ) ) {
170
- $array['conditional_value'] = ! empty( $array['conditional_value'] ) ? $array['conditional_value'] : '';
171
$array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'] );
172
}
173
174
if ( isset($array['conditional_field1']) && !empty( $array['conditional_action1'] ) && !empty( $array['conditional_operator1'] ) ) {
175
- $array['conditional_value1'] = ! empty( $array['conditional_value1'] ) ? $array['conditional_value1'] : '';
176
$array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] );
177
}
178
179
if ( isset($array['conditional_field2']) && !empty( $array['conditional_action2'] ) && !empty( $array['conditional_operator2'] ) ) {
180
- $array['conditional_value2'] = ! empty( $array['conditional_value2'] ) ? $array['conditional_value2'] : '';
181
$array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] );
182
}
183
184
if ( isset($array['conditional_field3']) && !empty( $array['conditional_action3'] ) && !empty( $array['conditional_operator3'] ) ) {
185
- $array['conditional_value3'] = ! empty( $array['conditional_value3'] ) ? $array['conditional_value3'] : '';
186
$array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] );
187
}
188
189
if ( isset($array['conditional_field4']) && !empty( $array['conditional_action4'] ) && !empty( $array['conditional_operator4'] ) ) {
190
- $array['conditional_value4'] = ! empty( $array['conditional_value4'] ) ? $array['conditional_value4'] : '';
191
$array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] );
192
}
193
@@ -230,11 +230,22 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
230
<?php } ?>
231
232
<div class="um-admin-btn-content">
233
234
- <p class="um-admin-reset-conditions"><a href="#" class="button button-primary"><?php _e( 'Reset all rules', 'ultimate-member' ); ?></a></p>
235
<div class="um-admin-clear"></div>
236
237
- <?php if ( isset( $edit_array['conditions'] ) ) {
238
239
foreach ( $edit_array['conditions'] as $k => $arr ) {
240
@@ -247,11 +258,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
247
<?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?>
248
<?php $metabox->field_input( '_conditional_value' . $k, $form_id ); ?>
249
250
- <?php if ( $k == '' ) { ?>
251
- <p><a href="#" class="um-admin-new-condition button um-admin-tipsy-n" title="Add new condition"><i class="um-icon-plus" style="margin-right:0!important"></i></a></p>
252
- <?php } else { ?>
253
- <p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
254
- <?php } ?>
255
256
<div class="um-admin-clear"></div>
257
</div>
@@ -268,15 +275,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
268
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
269
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
270
271
- <p><a href="#" class="um-admin-new-condition button um-admin-tipsy-n" title="Add new condition"><i class="um-icon-plus" style="margin-right:0!important"></i></a></p>
272
273
<div class="um-admin-clear"></div>
274
</div>
275
276
<?php } ?>
277
-
278
</div>
279
-
280
</div>
281
282
<?php
@@ -659,6 +664,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
659
$output['error'] = apply_filters( 'um_admin_field_update_error_handling', $output['error'], $array );
660
661
extract( $array['post'] );
662
if ( empty( $output['error'] ) ){
663
664
$save = array();
167
function um_admin_pre_save_field_to_form( $array ){
168
unset( $array['conditions'] );
169
if ( isset($array['conditional_field']) && !empty( $array['conditional_action'] ) && !empty( $array['conditional_operator'] ) ) {
170
+ $array['conditional_value'] = isset( $array['conditional_value'] ) ? $array['conditional_value'] : '';
171
$array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'] );
172
}
173
174
if ( isset($array['conditional_field1']) && !empty( $array['conditional_action1'] ) && !empty( $array['conditional_operator1'] ) ) {
175
+ $array['conditional_value1'] = isset( $array['conditional_value1'] ) ? $array['conditional_value1'] : '';
176
$array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] );
177
}
178
179
if ( isset($array['conditional_field2']) && !empty( $array['conditional_action2'] ) && !empty( $array['conditional_operator2'] ) ) {
180
+ $array['conditional_value2'] = isset( $array['conditional_value2'] ) ? $array['conditional_value2'] : '';
181
$array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] );
182
}
183
184
if ( isset($array['conditional_field3']) && !empty( $array['conditional_action3'] ) && !empty( $array['conditional_operator3'] ) ) {
185
+ $array['conditional_value3'] = isset( $array['conditional_value3'] ) ? $array['conditional_value3'] : '';
186
$array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] );
187
}
188
189
if ( isset($array['conditional_field4']) && !empty( $array['conditional_action4'] ) && !empty( $array['conditional_operator4'] ) ) {
190
+ $array['conditional_value4'] = isset( $array['conditional_value4'] ) ? $array['conditional_value4'] : '';
191
$array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] );
192
}
193
230
<?php } ?>
231
232
<div class="um-admin-btn-content">
233
+ <div class="um-admin-cur-condition-template">
234
235
+ <?php $metabox->field_input( '_conditional_action', $form_id ); ?>
236
+ <?php $metabox->field_input( '_conditional_field', $form_id ); ?>
237
+ <?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
238
+ <?php $metabox->field_input( '_conditional_value', $form_id ); ?>
239
+
240
+ <p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
241
+
242
+ <div class="um-admin-clear"></div>
243
+ </div>
244
+ <p><a href="#" class="um-admin-new-condition button button-primary um-admin-tipsy-n" title="Add new condition"><?php _e( 'Add new rule', 'ultimate-member' ); ?></a></p>
245
+ <p class="um-admin-reset-conditions"><a href="#" class="button"><?php _e( 'Reset all rules', 'ultimate-member' ); ?></a></p>
246
<div class="um-admin-clear"></div>
247
248
+ <?php if ( isset( $edit_array['conditions'] ) && count( $edit_array['conditions'] ) != 0 ) {
249
250
foreach ( $edit_array['conditions'] as $k => $arr ) {
251
258
<?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?>
259
<?php $metabox->field_input( '_conditional_value' . $k, $form_id ); ?>
260
261
+ <p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
262
263
<div class="um-admin-clear"></div>
264
</div>
275
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
276
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
277
278
+ <p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
279
280
<div class="um-admin-clear"></div>
281
</div>
282
283
<?php } ?>
284
</div>
285
</div>
286
287
<?php
664
$output['error'] = apply_filters( 'um_admin_field_update_error_handling', $output['error'], $array );
665
666
extract( $array['post'] );
667
+
668
if ( empty( $output['error'] ) ){
669
670
$save = array();
includes/admin/core/class-admin-enqueue.php CHANGED
@@ -156,7 +156,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
156
wp_enqueue_script( 'um_admin_settings' );
157
158
$localize_data = array(
159
- 'delete_email_template' => UM()->get_ajax_route( 'um\core\Mail', 'delete_email_template' ),
160
'onbeforeunload_text' => __( 'Are sure, maybe some settings not saved', 'ultimate-member' ),
161
'texts' => array(
162
'remove' => __( 'Remove', 'ultimate-member' ),
@@ -293,7 +292,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
293
/**
294
* Load global css
295
*/
296
- function load_global_css() {
297
wp_register_style( 'um_admin_global', $this->css_url . 'um-admin-global.css' );
298
wp_enqueue_style( 'um_admin_global' );
299
}
@@ -303,7 +305,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
303
* Load jQuery custom code
304
*/
305
function load_custom_scripts() {
306
- wp_register_script( 'um_admin_scripts', $this->js_url . 'um-admin-scripts.js', '', '', true );
307
wp_enqueue_script( 'um_admin_scripts' );
308
}
309
@@ -357,11 +359,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
357
* ?>
358
*/
359
$localize_data = apply_filters('um_admin_enqueue_localize_data', array(
360
- 'ajaxurl' => admin_url( 'admin-ajax.php' )
361
)
362
);
363
364
- wp_localize_script( 'um_admin_scripts', 'um_admin_scripts', $localize_data );
365
}
366
367
@@ -391,7 +394,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
391
}*/
392
393
$this->load_functions();
394
- $this->load_global_css();
395
$this->load_form();
396
$this->load_forms();
397
$this->load_modal();
@@ -424,7 +427,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
424
425
} else {
426
427
- $this->load_global_css();
428
429
}
430
156
wp_enqueue_script( 'um_admin_settings' );
157
158
$localize_data = array(
159
'onbeforeunload_text' => __( 'Are sure, maybe some settings not saved', 'ultimate-member' ),
160
'texts' => array(
161
'remove' => __( 'Remove', 'ultimate-member' ),
292
/**
293
* Load global css
294
*/
295
+ function load_global_scripts() {
296
+ wp_register_script( 'um_admin_global', $this->js_url . 'um-admin-global.js', array('jquery'), ultimatemember_version, true );
297
+ wp_enqueue_script( 'um_admin_global' );
298
+
299
wp_register_style( 'um_admin_global', $this->css_url . 'um-admin-global.css' );
300
wp_enqueue_style( 'um_admin_global' );
301
}
305
* Load jQuery custom code
306
*/
307
function load_custom_scripts() {
308
+ wp_register_script( 'um_admin_scripts', $this->js_url . 'um-admin-scripts.js', array('jquery','wp-util'), '', true );
309
wp_enqueue_script( 'um_admin_scripts' );
310
}
311
359
* ?>
360
*/
361
$localize_data = apply_filters('um_admin_enqueue_localize_data', array(
362
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
363
+ 'nonce' => wp_create_nonce( "um-admin-nonce" )
364
)
365
);
366
367
+ wp_localize_script( 'um_admin_global', 'um_admin_scripts', $localize_data );
368
}
369
370
394
}*/
395
396
$this->load_functions();
397
+ $this->load_global_scripts();
398
$this->load_form();
399
$this->load_forms();
400
$this->load_modal();
427
428
} else {
429
430
+ $this->load_global_scripts();
431
+ $this->load_localize_scripts();
432
433
}
434
includes/admin/core/class-admin-forms.php CHANGED
@@ -285,7 +285,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
285
* }
286
* ?>
287
*/
288
- return apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data );
289
}
290
291
@@ -731,15 +731,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
731
$value = $this->get_field_value( $field_data );
732
733
$options = '';
734
- foreach ( $field_data['options'] as $key=>$option ) {
735
if ( ! empty( $field_data['multi'] ) ) {
736
737
if ( ! is_array( $value ) || empty( $value ) )
738
$value = array();
739
740
- $options .= '<option value="' . $key . '" ' . selected( in_array( $key, $value ), true, false ) . '>' . $option . '</option>';
741
} else {
742
- $options .= '<option value="' . $key . '" ' . selected( (string)$key == $value, true, false ) . '>' . $option . '</option>';
743
}
744
}
745
@@ -1040,11 +1040,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
1040
ob_start(); ?>
1041
1042
<div class="email_template_wrapper <?php echo $field_data['in_theme'] ? 'in_theme' : '' ?>" data-key="<?php echo $field_data['id'] ?>" style="position: relative;">
1043
- <!-- <input type="button" class="reset_email_template button" value="--><?php //_e( 'Reset Template to Default', 'ultimate-member' ) ?><!--" />-->
1044
- <!--<div class="copy_button_overlay">
1045
- <span><?php /*_e( 'Currently UM use default Email Template, you can edit this template after then you copy in to theme', 'ultimate-member' ) */?></span>
1046
- <input type="button" class="copy_email_template button" value="<?php /*_e( 'Copy Template to Theme', 'ultimate-member' ) */?>" />
1047
- </div>-->
1048
1049
<?php wp_editor( $value,
1050
$id,
@@ -1057,7 +1052,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
1057
'editor_class' => $class
1058
)
1059
); ?>
1060
-
1061
</div>
1062
1063
<?php $html = ob_get_clean();
285
* }
286
* ?>
287
*/
288
+ return apply_filters( 'um_render_field_type_' . $data['type'], '', $data, $this->form_data, $this );
289
}
290
291
731
$value = $this->get_field_value( $field_data );
732
733
$options = '';
734
+ foreach ( $field_data['options'] as $key => $option ) {
735
if ( ! empty( $field_data['multi'] ) ) {
736
737
if ( ! is_array( $value ) || empty( $value ) )
738
$value = array();
739
740
+ $options .= '<option value="' . $key . '" ' . selected( in_array( $key, $value ), true, false ) . '>' . esc_html( $option ) . '</option>';
741
} else {
742
+ $options .= '<option value="' . $key . '" ' . selected( (string)$key == $value, true, false ) . '>' . esc_html( $option ) . '</option>';
743
}
744
}
745
1040
ob_start(); ?>
1041
1042
<div class="email_template_wrapper <?php echo $field_data['in_theme'] ? 'in_theme' : '' ?>" data-key="<?php echo $field_data['id'] ?>" style="position: relative;">
1043
1044
<?php wp_editor( $value,
1045
$id,
1052
'editor_class' => $class
1053
)
1054
); ?>
1055
+ <span class="description">For default text for plain-text emails please see this <a href="https://docs.ultimatemember.com/article/1342-plain-text-email-default-templates#<?php echo $field_data['id'] ?>" target="_blank">doc</a></span>
1056
</div>
1057
1058
<?php $html = ob_get_clean();
includes/admin/core/class-admin-metabox.php CHANGED
@@ -1313,7 +1313,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
1313
?>
1314
1315
<p>
1316
- <input type="text" name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" placeholder="<?php _e( 'Value', 'ultimate-member' ); ?>" style="width: 150px!important;position: relative;top: -1px;" />
1317
</p>
1318
1319
<?php
1313
?>
1314
1315
<p>
1316
+ <input type="text" name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" value="<?php echo isset( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" placeholder="<?php _e( 'Value', 'ultimate-member' ); ?>" style="width: 150px!important;position: relative;top: -1px;" />
1317
</p>
1318
1319
<?php
includes/admin/core/class-admin-notices.php CHANGED
@@ -29,6 +29,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
29
30
add_action( 'admin_init', array( &$this, 'create_list' ), 10 );
31
add_action( 'admin_notices', array( &$this, 'render_notices' ), 1 );
32
}
33
34
@@ -38,10 +41,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
38
$this->localize_note();
39
$this->show_update_messages();
40
$this->check_wrong_install_folder();
41
- //$this->admin_notice_tracking();
42
$this->need_upgrade();
43
$this->check_wrong_licenses();
44
45
/**
46
* UM hook
47
*
@@ -135,8 +143,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
135
136
$admin_notices = $this->get_admin_notices();
137
138
- $hidden = get_user_meta( get_current_user_id(), 'um_hidden_admin_notices' );
139
- $hidden = empty( $hidden ) ? array() : $hidden;
140
141
uasort( $admin_notices, array( &$this, 'notice_priority_sort' ) );
142
@@ -186,9 +193,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
186
187
$class = ! empty( $notice_data['class'] ) ? $notice_data['class'] : 'updated';
188
189
ob_start(); ?>
190
191
- <div class="<?php echo esc_attr( $class ) ?> um-admin-notice">
192
<?php echo ! empty( $notice_data['message'] ) ? $notice_data['message'] : '' ?>
193
</div>
194
@@ -492,36 +501,43 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
492
/**
493
* Show admin notices
494
*/
495
- public function admin_notice_tracking() {
496
497
- if ( ! current_user_can( 'manage_options' ) )
498
return;
499
500
$hide_notice = get_option( 'um_tracking_notice' );
501
502
- if ( $hide_notice )
503
return;
504
505
- $optin_url = esc_url( add_query_arg( 'um_adm_action', 'opt_into_tracking' ) );
506
- $optout_url = esc_url( add_query_arg( 'um_adm_action', 'opt_out_of_tracking' ) );
507
508
ob_start(); ?>
509
510
<p>
511
- <?php printf( __( 'Thanks for installing <strong>%s</strong>! 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 <a href="%s" target="_blank">extensions bundle</a>.', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>
512
</p>
513
514
<p>
515
- <a href="<?php echo esc_url( $optin_url ) ?>" class="button button-primary"><?php _e( 'Subscribe to mailing list', 'ultimate-member' ) ?></a>
516
&nbsp;
517
- <a href="<?php echo esc_url( $optout_url ) ?>" class="button-secondary"><?php _e( 'No thanks', 'ultimate-member' ) ?></a>
518
</p>
519
520
<?php $message = ob_get_clean();
521
522
- $this->add_notice( 'invalid_dir', array(
523
'class' => 'updated',
524
'message' => $message,
525
), 2 );
526
}
527
@@ -595,5 +611,158 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
595
}
596
}
597
598
}
599
}
29
30
add_action( 'admin_init', array( &$this, 'create_list' ), 10 );
31
add_action( 'admin_notices', array( &$this, 'render_notices' ), 1 );
32
+
33
+ add_action( 'wp_ajax_um_dismiss_notice', array( &$this, 'dismiss_notice' ) );
34
+ add_action( 'wp_ajax_um_opt_in_notice', array( &$this, 'opt_in_notice' ) );
35
}
36
37
41
$this->localize_note();
42
$this->show_update_messages();
43
$this->check_wrong_install_folder();
44
+ $this->admin_notice_opt_in();
45
$this->need_upgrade();
46
$this->check_wrong_licenses();
47
48
+ $this->reviews_notice();
49
+
50
+
51
+ //$this->future_changed();
52
+
53
/**
54
* UM hook
55
*
143
144
$admin_notices = $this->get_admin_notices();
145
146
+ $hidden = get_option( 'um_hidden_admin_notices', array() );
147
148
uasort( $admin_notices, array( &$this, 'notice_priority_sort' ) );
149
193
194
$class = ! empty( $notice_data['class'] ) ? $notice_data['class'] : 'updated';
195
196
+ $dismissible = ! empty( $admin_notices[ $key ]['dismissible'] );
197
+
198
ob_start(); ?>
199
200
+ <div class="<?php echo esc_attr( $class ) ?> um-admin-notice notice <?php echo $dismissible ? 'is-dismissible' : '' ?>" data-key="<?php echo $key ?>">
201
<?php echo ! empty( $notice_data['message'] ) ? $notice_data['message'] : '' ?>
202
</div>
203
501
/**
502
* Show admin notices
503
*/
504
+ public function admin_notice_opt_in() {
505
506
+ if ( ! current_user_can( 'manage_options' ) ) {
507
return;
508
+ }
509
510
+ //backward compatibility
511
$hide_notice = get_option( 'um_tracking_notice' );
512
513
+ if ( $hide_notice ) {
514
return;
515
+ }
516
517
+ $optin_url = esc_url( add_query_arg( 'um_adm_action', 'opt_in' ) );
518
519
ob_start(); ?>
520
521
<p>
522
+ <?php printf( __( 'Thanks for installing <strong>%s</strong>! 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 email you a 20%% discount code for our <a href="%s" target="_blank">extensions bundle</a> (you\'ll need to confirm your opt-in via email before the discount code can be sent).', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>
523
</p>
524
525
<p>
526
+ <a href="javascript:void(0);" id="um_opt_in_start" class="button button-primary"><?php _e( 'Subscribe to mailing list', 'ultimate-member' ) ?></a>
527
&nbsp;
528
+ <a href="javascript:void(0);" class="button-secondary um_opt_in_link"><?php _e( 'No thanks', 'ultimate-member' ) ?></a>
529
+ </p>
530
+
531
+ <p class="description" style="font-size: 11px;">
532
+ <?php printf( __( 'By clicking the subscribe button you are agree to join our mailing list. See our <a href="%s" target="_blank">privacy policy</a>', 'ultimate-member' ), 'https://ultimatemember.com/privacy-policy/' ); ?>
533
</p>
534
535
<?php $message = ob_get_clean();
536
537
+ $this->add_notice( 'opt_in_notice', array(
538
'class' => 'updated',
539
'message' => $message,
540
+ 'dismissible' => true
541
), 2 );
542
}
543
611
}
612
}
613
614
+
615
+ /**
616
+ *
617
+ */
618
+ function reviews_notice() {
619
+
620
+ $first_activation_date = get_option( 'um_first_activation_date', false );
621
+
622
+ if ( empty( $first_activation_date ) ) {
623
+ return;
624
+ }
625
+
626
+ if ( $first_activation_date + MONTH_IN_SECONDS > time() ) {
627
+ return;
628
+ }
629
+
630
+ ob_start(); ?>
631
+
632
+ <div id="um_start_review_notice">
633
+ <p>
634
+ <?php printf( __( 'Hey there! It\'s been one month since you installed %s. How have you found the plugin so far?', 'ultimate-member' ), ultimatemember_plugin_name ) ?>
635
+ </p>
636
+ <p>
637
+ <a href="javascript:void(0);" id="um_add_review_love"><?php _e( 'I love it!', 'ultimate-member' ) ?></a>&nbsp;|&nbsp;
638
+ <a href="javascript:void(0);" id="um_add_review_good"><?php _e('It\'s good but could be better', 'ultimate-member' ) ?></a>&nbsp;|&nbsp;
639
+ <a href="javascript:void(0);" id="um_add_review_bad"><?php _e('I don\'t like the plugin', 'ultimate-member' ) ?></a>
640
+ </p>
641
+ </div>
642
+ <div class="um_hidden_notice" data-key="love">
643
+ <p>
644
+ <?php printf( __( 'Great! We\'re happy to hear that you love the plugin. It would be amazing if you could let others know why you like %s by leaving a review of the plugin. This will help %s to grow and become more popular and would be massively appreciated by us!' ), ultimatemember_plugin_name, ultimatemember_plugin_name ); ?>
645
+ </p>
646
+
647
+ <p>
648
+ <a href="https://wordpress.org/support/plugin/ultimate-member/reviews/?rate=5#new-post" target="_blank" class="button button-primary um_review_link"><?php _e( 'Leave Review', 'ultimate-member' ) ?></a>
649
+ </p>
650
+ </div>
651
+ <div class="um_hidden_notice" data-key="good">
652
+ <p>
653
+ <?php _e( 'We\'re glad to hear that you like the plugin but we would love to get your feedback so we can make the plugin better.' ); ?>
654
+ </p>
655
+
656
+ <p>
657
+ <a href="https://ultimatemember.com/feedback/" target="_blank" class="button button-primary um_review_link"><?php _e( 'Provide Feedback', 'ultimate-member' ) ?></a>
658
+ </p>
659
+ </div>
660
+ <div class="um_hidden_notice" data-key="bad">
661
+ <p>
662
+ <?php printf( __( 'We\'re sorry to hear that. If you\'re having the issue with the plugin you can create a topic on our <a href="%s" target="_blank">support forum</a> and we will try and help you out with the issue. Alternatively if you have an idea on how we can make the plugin better or want to tell us what you don\'t like about the plugin you can tell us know by giving us feedback.' ), 'https://wordpress.org/support/plugin/ultimate-member' ); ?>
663
+ </p>
664
+
665
+ <p>
666
+ <a href="https://ultimatemember.com/feedback/" target="_blank" class="button button-primary um_review_link"><?php _e( 'Provide Feedback', 'ultimate-member' ) ?></a>
667
+ </p>
668
+ </div>
669
+
670
+ <?php $message = ob_get_clean();
671
+
672
+ $this->add_notice( 'reviews_notice', array(
673
+ 'class' => 'updated',
674
+ 'message' => $message,
675
+ 'dismissible' => true
676
+ ), 1 );
677
+ }
678
+
679
+
680
+ /**
681
+ * Check Future Changes notice
682
+ */
683
+ function future_changed() {
684
+
685
+ ob_start(); ?>
686
+
687
+ <p>
688
+ <?php printf( __( '<strong>%s</strong> future plans! Detailed future list is <a href="%s" target="_blank">here</a>', 'ultimate-member' ), ultimatemember_plugin_name, '#' ); ?>
689
+ </p>
690
+
691
+ <?php $message = ob_get_clean();
692
+
693
+ $this->add_notice( 'future_changes', array(
694
+ 'class' => 'updated',
695
+ 'message' => $message,
696
+ ), 2 );
697
+ }
698
+
699
+
700
+ function dismiss_notice() {
701
+ $nonce = isset( $_POST["nonce"] ) ? $_POST["nonce"] : "";
702
+ if ( ! wp_verify_nonce( $nonce, "um-admin-nonce" ) ) {
703
+ wp_send_json_error( esc_js( __( "Wrong Nonce", 'ultimate-member' ) ) );
704
+ }
705
+
706
+
707
+ if ( empty( $_POST['key'] ) ) {
708
+ wp_send_json_error( __( 'Wrong Data', 'ultimate-member' ) );
709
+ }
710
+
711
+ $hidden_notices = get_option( 'um_hidden_admin_notices', array() );
712
+ $hidden_notices[] = $_POST['key'];
713
+
714
+ update_option( 'um_hidden_admin_notices', $hidden_notices );
715
+
716
+ wp_send_json_success();
717
+ }
718
+
719
+
720
+ function opt_in_notice() {
721
+ $nonce = isset( $_POST["nonce"] ) ? $_POST["nonce"] : "";
722
+ if ( ! wp_verify_nonce( $nonce, "um-admin-nonce" ) ) {
723
+ wp_send_json_error( esc_js( __( "Wrong Nonce", 'ultimate-member' ) ) );
724
+ }
725
+
726
+ // Send a maximum of once per period
727
+ $last_send = get_option( 'um_opt_in_last_send', false );
728
+ if ( $last_send && $last_send > strtotime( '-1 day' ) ) {
729
+ return;
730
+ }
731
+
732
+ $data = array();
733
+
734
+ UM()->setup()->install_basics();
735
+
736
+ $data['email'] = get_option( 'admin_email' );
737
+ $data['send_discount'] = ! get_option( '__ultimatemember_coupon_sent' ) ? 1 : 0;
738
+ $data['unique_sitekey'] = get_option( '__ultimatemember_sitekey' );
739
+
740
+ $request = wp_remote_post( 'https://ultimatemember.com/?um_action=checkin', array(
741
+ 'method' => 'POST',
742
+ 'timeout' => 45,
743
+ 'redirection' => 5,
744
+ 'httpversion' => '1.0',
745
+ 'blocking' => true,
746
+ 'body' => $data,
747
+ 'user-agent' => 'UM/' . ultimatemember_version . '; ' . get_bloginfo( 'url' ),
748
+ ) );
749
+
750
+ if ( ! is_wp_error( $request ) ) {
751
+ $request = json_decode( wp_remote_retrieve_body( $request ), true );
752
+ }
753
+
754
+ $request = ( $request ) ? maybe_unserialize( $request ) : false;
755
+
756
+ if ( ! empty( $request['id'] ) && ! empty( $request['list_id'] ) ) {
757
+ update_option( 'um_opt_in_last_send', time() );
758
+
759
+ if ( $request['discount_ready'] ) {
760
+ update_option( '__ultimatemember_coupon_sent', 1 );
761
+ }
762
+ }
763
+
764
+ wp_send_json_success();
765
+ }
766
+
767
}
768
}
includes/admin/core/class-admin-settings.php CHANGED
@@ -617,7 +617,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
617
'id' => 'email_html',
618
'type' => 'checkbox',
619
'label' => __( 'Use HTML for E-mails?','ultimate-member' ),
620
- 'tooltip' => __('If you enable HTML for e-mails, you can customize the HTML e-mail templates found in <strong>templates/email</strong> folder.','ultimate-member'),
621
)
622
)
623
),
@@ -1033,11 +1033,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
1033
'textarea_rows' => 6
1034
)
1035
),
1036
- array(
1037
- 'id' => 'um_allow_tracking',
1038
- 'type' => 'checkbox',
1039
- 'label' => __( 'Allow Tracking','ultimate-member' ),
1040
- ),
1041
array(
1042
'id' => 'uninstall_on_delete',
1043
'type' => 'checkbox',
@@ -1692,8 +1687,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
1692
$email_key = empty( $_GET['email'] ) ? '' : urldecode( $_GET['email'] );
1693
$emails = UM()->config()->email_notifications;
1694
1695
- if ( empty( $email_key ) || empty( $emails[$email_key] ) )
1696
return $section;
1697
1698
$in_theme = UM()->mail()->template_in_theme( $email_key );
1699
@@ -1722,7 +1718,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
1722
array(
1723
'id' => 'um_email_template',
1724
'type' => 'hidden',
1725
- 'value' => $email_key,
1726
),
1727
array(
1728
'id' => $email_key . '_on',
@@ -2526,18 +2522,16 @@ Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ?
2526
*/
2527
function save_email_templates( $settings ) {
2528
2529
- if ( empty( $settings['um_email_template'] ) )
2530
return $settings;
2531
2532
$template = $settings['um_email_template'];
2533
- $content = stripslashes( $settings[$template] );
2534
2535
$theme_template_path = UM()->mail()->get_template_file( 'theme', $template );
2536
2537
- $in_theme = UM()->mail()->template_in_theme( $template );
2538
- if ( ! $in_theme ) {
2539
- UM()->mail()->copy_email_template( $template );
2540
- }
2541
2542
$fp = fopen( $theme_template_path, "w" );
2543
$result = fputs( $fp, $content );
@@ -2545,7 +2539,7 @@ Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ?
2545
2546
if ( $result !== false ) {
2547
unset( $settings['um_email_template'] );
2548
- unset( $settings[$template] );
2549
}
2550
2551
return $settings;
617
'id' => 'email_html',
618
'type' => 'checkbox',
619
'label' => __( 'Use HTML for E-mails?','ultimate-member' ),
620
+ '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'),
621
)
622
)
623
),
1033
'textarea_rows' => 6
1034
)
1035
),
1036
array(
1037
'id' => 'uninstall_on_delete',
1038
'type' => 'checkbox',
1687
$email_key = empty( $_GET['email'] ) ? '' : urldecode( $_GET['email'] );
1688
$emails = UM()->config()->email_notifications;
1689
1690
+ if ( empty( $email_key ) || empty( $emails[ $email_key ] ) ) {
1691
return $section;
1692
+ }
1693
1694
$in_theme = UM()->mail()->template_in_theme( $email_key );
1695
1718
array(
1719
'id' => 'um_email_template',
1720
'type' => 'hidden',
1721
+ 'value' => $email_key,
1722
),
1723
array(
1724
'id' => $email_key . '_on',
2522
*/
2523
function save_email_templates( $settings ) {
2524
2525
+ if ( empty( $settings['um_email_template'] ) ) {
2526
return $settings;
2527
+ }
2528
2529
$template = $settings['um_email_template'];
2530
+ $content = stripslashes( $settings[ $template ] );
2531
2532
$theme_template_path = UM()->mail()->get_template_file( 'theme', $template );
2533
2534
+ UM()->mail()->copy_email_template( $template );
2535
2536
$fp = fopen( $theme_template_path, "w" );
2537
$result = fputs( $fp, $content );
2539
2540
if ( $result !== false ) {
2541
unset( $settings['um_email_template'] );
2542
+ unset( $settings[ $template ] );
2543
}
2544
2545
return $settings;
includes/admin/core/class-admin-upgrade.php CHANGED
@@ -74,44 +74,64 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
74
}
75
}
76
77
- //add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
78
}
79
80
/**
81
* Function for major updates
82
*
83
*/
84
- /*function in_plugin_update_message( $args ) {
85
-
86
- $lastversion = get_option( '%UNIQUE_ID%_last_version', false );
87
- if ( $lastversion && version_compare( $lastversion, %UNIQUE_ID%_current_version, '>' ) ) {
88
- $upgrade_notice = get_option( '%UNIQUE_ID%_major_update' . $lastversion );
89
-
90
- echo '<style type="text/css">
91
- .%UNIQUE_ID%_plugin_upgrade_notice {
92
- font-weight: 400;
93
- color: #fff;
94
- background: #d53221;
95
- padding: 1em;
96
- margin: 9px 0;
97
- display: block;
98
- box-sizing: border-box;
99
- -webkit-box-sizing: border-box;
100
- -moz-box-sizing: border-box;
101
- }
102
- .%UNIQUE_ID%_plugin_upgrade_notice:before {
103
- content: "\f348";
104
- display: inline-block;
105
- font: 400 18px/1 dashicons;
106
- speak: none;
107
- margin: 0 8px 0 -2px;
108
- -webkit-font-smoothing: antialiased;
109
- -moz-osx-font-smoothing: grayscale;
110
- vertical-align: top;
111
- }
112
- </style>' . wp_kses_post( $upgrade_notice );
113
}
114
- }*/
115
116
117
/**
74
}
75
}
76
77
+ add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
78
}
79
80
/**
81
* Function for major updates
82
*
83
*/
84
+ function in_plugin_update_message( $args ) {
85
+ $show_additional_notice = false;
86
+ if ( isset( $args['new_version'] ) ) {
87
+ $old_version_array = explode( '.', ultimatemember_version );
88
+ $new_version_array = explode( '.', $args['new_version'] );
89
+
90
+ if ( $old_version_array[0] < $new_version_array[0] ) {
91
+ $show_additional_notice = true;
92
+ } else {
93
+ if ( $old_version_array[1] < $new_version_array[1] ) {
94
+ $show_additional_notice = true;
95
+ }
96
+ }
97
+
98
}
99
+
100
+ if ( $show_additional_notice ) {
101
+ ob_start(); ?>
102
+
103
+ <style type="text/css">
104
+ .um_plugin_upgrade_notice {
105
+ font-weight: 400;
106
+ color: #fff;
107
+ background: #d53221;
108
+ padding: 1em;
109
+ margin: 9px 0;
110
+ display: block;
111
+ box-sizing: border-box;
112
+ -webkit-box-sizing: border-box;
113
+ -moz-box-sizing: border-box;
114
+ }
115
+
116
+ .um_plugin_upgrade_notice:before {
117
+ content: "\f348";
118
+ display: inline-block;
119
+ font: 400 18px/1 dashicons;
120
+ speak: none;
121
+ margin: 0 8px 0 -2px;
122
+ -webkit-font-smoothing: antialiased;
123
+ -moz-osx-font-smoothing: grayscale;
124
+ vertical-align: top;
125
+ }
126
+ </style>
127
+
128
+ <span class="um_plugin_upgrade_notice">
129
+ <?php printf( __( '%s is a major update, and we highly recommend creating a full backup of your site before updating.', 'ultimate-member' ), $args['new_version'] ); ?>
130
+ </span>
131
+
132
+ <?php ob_get_flush();
133
+ }
134
+ }
135
136
137
/**
includes/admin/core/packages/2.0-beta1/email_templates.php CHANGED
@@ -1,53 +1,255 @@
1
<?php
2
/**
3
* Transferring email templates to new logic
4
*/
5
- $templates_in_theme = 0;
6
$emails = UM()->config()->email_notifications;
7
foreach ( $emails as $email_key => $value ) {
8
9
- $in_theme = UM()->mail()->template_in_theme( $email_key, true );
10
- $theme_template_path = UM()->mail()->get_template_file( 'theme', $email_key );
11
12
if ( ! $in_theme ) {
13
- $html_email = UM()->options()->get( 'email_html' );
14
15
if ( $html_email ) {
16
- if ( ! UM()->mail()->copy_email_template( $email_key ) ) {
17
- $setting_value = UM()->options()->get( $email_key );
18
19
- $fp = fopen( $theme_template_path, "w" );
20
- $result = fputs( $fp, $setting_value );
21
- fclose( $fp );
22
} else {
23
$templates_in_theme++;
24
}
25
} else {
26
- $setting_value = UM()->options()->get( $email_key );
27
28
- $fp = @fopen( $theme_template_path, "w" );
29
- $result = @fputs( $fp, $setting_value );
30
- fclose( $fp );
31
}
32
} else {
33
- $theme_template_path_html = UM()->mail()->get_template_file( 'theme', $email_key, true );
34
35
$setting_value = preg_replace( '/<\/body>|<\/head>|<html>|<\/html>|<body.*?>|<head.*?>/' , '', file_get_contents( $theme_template_path_html ) );
36
37
if ( file_exists( $theme_template_path_html ) ) {
38
if ( copy( $theme_template_path_html, $theme_template_path ) ) {
39
- $fp = fopen( $theme_template_path, "w" );
40
- $result = fputs( $fp, $setting_value );
41
- fclose( $fp );
42
43
$templates_in_theme++;
44
}
45
}
46
}
47
}
48
49
- if ( $templates_in_theme > 0 ) {
50
- UM()->options()->update( 'email_html', true );
51
- } else {
52
- UM()->options()->update( 'email_html', false );
53
- }
1
<?php
2
+
3
+ /**
4
+ * Locate a template and return the path for inclusion.
5
+ *
6
+ * @access public
7
+ * @param string $template_name
8
+ * @param bool $html
9
+ * @return string
10
+ */
11
+ function um_upgrade20beta1_template_in_theme( $template_name, $html = false ) {
12
+ $template_name_file = UM()->mail()->get_template_filename( $template_name );
13
+ $ext = ! $html ? '.php' : '.html';
14
+
15
+ $blog_id = '';
16
+ if ( ! $html ) {
17
+ $blog_id = UM()->mail()->get_blog_id();
18
+ }
19
+
20
+ // check if there is template at theme folder
21
+ $template = locate_template( array(
22
+ trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . $ext
23
+ ) );
24
+ // Return what we found.
25
+ return ! $template ? false : true;
26
+ }
27
+
28
+
29
+ /**
30
+ * Method returns expected path for template
31
+ *
32
+ * @access public
33
+ * @param string $location
34
+ * @param string $template_name
35
+ * @param bool $html
36
+ * @return string
37
+ */
38
+ function um_upgrade20beta1_get_template_file( $location, $template_name, $html = false ) {
39
+ $template_path = '';
40
+ $template_name_file = UM()->mail()->get_template_filename( $template_name );
41
+ $ext = ! $html ? '.php' : '.html';
42
+ switch( $location ) {
43
+ case 'theme':
44
+
45
+ $blog_id = '';
46
+ if ( ! $html ) {
47
+ $blog_id = UM()->mail()->get_blog_id();
48
+ }
49
+
50
+ $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' . $blog_id ). $template_name_file . $ext;
51
+ break;
52
+ case 'plugin':
53
+ $path = ! empty( UM()->mail()->path_by_slug[ $template_name ] ) ? UM()->mail()->path_by_slug[ $template_name ] : um_path . 'templates/email';
54
+ $template_path = trailingslashit( $path ) . $template_name . $ext;
55
+ break;
56
+ }
57
+ return $template_path;
58
+ }
59
+
60
+
61
+ /**
62
+ * Ajax copy template to the theme
63
+ *
64
+ * @param string $template
65
+ * @return bool
66
+ */
67
+ function um_upgrade20beta1_copy_email_template( $template ) {
68
+ $in_theme = um_upgrade20beta1_template_in_theme( $template );
69
+ if ( $in_theme ) {
70
+ return false;
71
+ }
72
+ $plugin_template_path = um_upgrade20beta1_get_template_file( 'plugin', $template );
73
+ $theme_template_path = um_upgrade20beta1_get_template_file( 'theme', $template );
74
+ $temp_path = str_replace( trailingslashit( get_stylesheet_directory() ), '', $theme_template_path );
75
+ $temp_path = str_replace( '/', DIRECTORY_SEPARATOR, $temp_path );
76
+ $folders = explode( DIRECTORY_SEPARATOR, $temp_path );
77
+ $folders = array_splice( $folders, 0, count( $folders ) - 1 );
78
+ $cur_folder = '';
79
+ $theme_dir = trailingslashit( get_stylesheet_directory() );
80
+ foreach ( $folders as $folder ) {
81
+ $prev_dir = $cur_folder;
82
+ $cur_folder .= $folder . DIRECTORY_SEPARATOR;
83
+ if ( ! is_dir( $theme_dir . $cur_folder ) && wp_is_writable( $theme_dir . $prev_dir ) ) {
84
+ mkdir( $theme_dir . $cur_folder, 0777 );
85
+ }
86
+ }
87
+ if ( file_exists( $plugin_template_path ) && copy( $plugin_template_path, $theme_template_path ) ) {
88
+ return true;
89
+ } else {
90
+ return false;
91
+ }
92
+ }
93
+
94
+
95
+ /**
96
+ * Insert email template content to file
97
+ *
98
+ * @param string $path Filepath
99
+ * @param string $content Email template content
100
+ */
101
+ function um_upgrade20beta1_insert_content( $path, $content ) {
102
+ $fp = @fopen( $path, "w" );
103
+ @fputs( $fp, $content );
104
+ @fclose( $fp );
105
+ }
106
+
107
+
108
+ /**
109
+ * Transferring email templates to new logic
110
+ */
111
+ function um_upgrade20beta1_email_templates_process() {
112
+ $templates_in_theme = 0;
113
+ $emails = UM()->config()->email_notifications;
114
+ foreach ( $emails as $email_key => $value ) {
115
+
116
+ $in_theme = um_upgrade20beta1_template_in_theme( $email_key, true );
117
+ $theme_template_path = um_upgrade20beta1_get_template_file( 'theme', $email_key );
118
+
119
+ if ( ! $in_theme ) {
120
+ //there isn't HTML email template's file in theme, get from option
121
+ //this value is correct for each multisite's subsites
122
+ $setting_value = UM()->options()->get( $email_key );
123
+
124
+ $html_email = UM()->options()->get( 'email_html' );
125
+ if ( $html_email ) {
126
+
127
+ if ( ! um_upgrade20beta1_copy_email_template( $email_key ) ) {
128
+
129
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
130
+
131
+ } else {
132
+
133
+ $templates_in_theme++;
134
+
135
+ }
136
+ } else {
137
+
138
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
139
+
140
+ }
141
+
142
+ } else {
143
+ //there is HTML email template in a theme's folder
144
+ $theme_template_path_html = um_upgrade20beta1_get_template_file( 'theme', $email_key, true );
145
+
146
+ $setting_value = preg_replace( '/<\/body>|<\/head>|<html>|<\/html>|<body.*?>|<head.*?>/' , '', file_get_contents( $theme_template_path_html ) );
147
+
148
+ if ( file_exists( $theme_template_path_html ) ) {
149
+
150
+ $temp_path = str_replace( trailingslashit( get_stylesheet_directory() ), '', $theme_template_path );
151
+ $temp_path = str_replace( '/', DIRECTORY_SEPARATOR, $temp_path );
152
+ $folders = explode( DIRECTORY_SEPARATOR, $temp_path );
153
+ $folders = array_splice( $folders, 0, count( $folders ) - 1 );
154
+ $cur_folder = '';
155
+ $theme_dir = trailingslashit( get_stylesheet_directory() );
156
+ foreach ( $folders as $folder ) {
157
+ $prev_dir = $cur_folder;
158
+ $cur_folder .= $folder . DIRECTORY_SEPARATOR;
159
+ if ( ! is_dir( $theme_dir . $cur_folder ) && wp_is_writable( $theme_dir . $prev_dir ) ) {
160
+ mkdir( $theme_dir . $cur_folder, 0777 );
161
+ }
162
+ }
163
+
164
+ if ( copy( $theme_template_path_html, $theme_template_path ) ) {
165
+
166
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
167
+
168
+ $templates_in_theme++;
169
+
170
+ }
171
+
172
+ }
173
+
174
+ }
175
+ }
176
+
177
+ $email_html = ( $templates_in_theme > 0 ) ? true : false;
178
+ UM()->options()->update( 'email_html', $email_html );
179
+ }
180
+
181
+
182
+ if ( is_multisite() ) {
183
+ $start_blog_id = get_current_blog_id();
184
+
185
+ $blog_ids = get_sites( array(
186
+ 'fields' => 'ids',
187
+ ) );
188
+
189
+ foreach ( $blog_ids as $blog_id ) {
190
+ switch_to_blog( $blog_id );
191
+ um_upgrade20beta1_email_templates_process();
192
+ }
193
+
194
+ restore_current_blog();
195
+ } else {
196
+ um_upgrade20beta1_email_templates_process();
197
+ }
198
+
199
+
200
/**
201
* Transferring email templates to new logic
202
*/
203
+ /*$templates_in_theme = 0;
204
$emails = UM()->config()->email_notifications;
205
foreach ( $emails as $email_key => $value ) {
206
207
+ $in_theme = um_upgrade20beta1_template_in_theme( $email_key, true );
208
+ $theme_template_path = um_upgrade20beta1_get_template_file( 'theme', $email_key );
209
210
if ( ! $in_theme ) {
211
+ //there isn't HTML email template's file in theme, get from option
212
+ //this value is correct for each multisite's subsites
213
+ $setting_value = UM()->options()->get( $email_key );
214
215
+ $html_email = UM()->options()->get( 'email_html' );
216
if ( $html_email ) {
217
218
+ if ( ! um_upgrade20beta1_copy_email_template( $email_key ) ) {
219
+
220
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
221
+
222
} else {
223
+
224
$templates_in_theme++;
225
+
226
}
227
} else {
228
229
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
230
+
231
}
232
+
233
} else {
234
+ //there is HTML email template in a theme's folder
235
+ $theme_template_path_html = um_upgrade20beta1_get_template_file( 'theme', $email_key, true );
236
237
$setting_value = preg_replace( '/<\/body>|<\/head>|<html>|<\/html>|<body.*?>|<head.*?>/' , '', file_get_contents( $theme_template_path_html ) );
238
239
if ( file_exists( $theme_template_path_html ) ) {
240
+
241
if ( copy( $theme_template_path_html, $theme_template_path ) ) {
242
+
243
+ um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
244
245
$templates_in_theme++;
246
+
247
}
248
+
249
}
250
+
251
}
252
}
253
254
+ $email_html = ( $templates_in_theme > 0 ) ? true : false;
255
+ UM()->options()->update( 'email_html', $email_html );*/
includes/admin/core/packages/2.0-beta1/functions.php CHANGED
@@ -136,6 +136,8 @@ function um_upgrade_cpt20beta1() {
136
function um_upgrade_get_forums20beta1() {
137
um_maybe_unset_time_limit();
138
139
$bb_forums = get_posts( array(
140
'post_type' => 'forum',
141
'numberposts' => -1,
136
function um_upgrade_get_forums20beta1() {
137
um_maybe_unset_time_limit();
138
139
+ remove_all_actions( 'pre_get_posts' );
140
+
141
$bb_forums = get_posts( array(
142
'post_type' => 'forum',
143
'numberposts' => -1,
includes/admin/templates/form/profile_customize.php CHANGED
@@ -1,10 +1,11 @@
1
<div class="um-admin-metabox">
2
3
- <?php
4
- foreach ( UM()->roles()->get_roles( __( 'All roles', 'ultimate-member' ) ) as $key => $value ) {
5
- $_um_profile_role = UM()->query()->get_meta_value( '_um_profile_role', $key );
6
- if ( ! empty( $_um_profile_role ) )
7
- $profile_role = $_um_profile_role;
8
}
9
10
UM()->admin_forms( array(
@@ -14,8 +15,8 @@
14
array(
15
'id' => '_um_profile_use_custom_settings',
16
'type' => 'select',
17
- 'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
18
- 'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling &amp; appearance', 'ultimate-member' ),
19
'value' => UM()->query()->get_meta_value( '_um_profile_use_custom_settings', null, 0 ),
20
'options' => array(
21
0 => __( 'No', 'ultimate-member' ),
@@ -23,13 +24,14 @@
23
),
24
),
25
array(
26
- 'id' => '_um_profile_role',
27
- 'type' => 'select',
28
- 'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
29
- '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' ),
30
- 'value' => ! empty( $profile_role ) ? $profile_role : 0,
31
- 'options' => UM()->roles()->get_roles( __( 'All roles', 'ultimate-member' ) ),
32
- 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
33
),
34
array(
35
'id' => '_um_profile_template',
1
<div class="um-admin-metabox">
2
3
+ <?php $profile_role_array = array();
4
+ foreach ( UM()->roles()->get_roles() as $key => $value ) {
5
+ $_um_profile_role = UM()->query()->get_meta_value( '_um_profile_role', $key );
6
+ if ( ! empty( $_um_profile_role ) ) {
7
+ $profile_role_array[] = $_um_profile_role;
8
+ }
9
}
10
11
UM()->admin_forms( array(
15
array(
16
'id' => '_um_profile_use_custom_settings',
17
'type' => 'select',
18
+ 'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
19
+ 'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling &amp; appearance', 'ultimate-member' ),
20
'value' => UM()->query()->get_meta_value( '_um_profile_use_custom_settings', null, 0 ),
21
'options' => array(
22
0 => __( 'No', 'ultimate-member' ),
24
),
25
),
26
array(
27
+ 'id' => '_um_profile_role',
28
+ 'type' => 'select',
29
+ 'multi' => true,
30
+ 'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
31
+ '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' ),
32
+ 'value' => $profile_role_array,
33
+ 'options' => UM()->roles()->get_roles(),
34
+ 'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
35
),
36
array(
37
'id' => '_um_profile_template',
includes/class-config.php CHANGED
@@ -210,7 +210,7 @@ if ( ! class_exists( 'um\Config' ) ) {
210
'_um_profile_header_menu' => 'bc',
211
'_um_profile_empty_text' => 1,
212
'_um_profile_empty_text_emo' => 1,
213
- '_um_profile_role' => '0',
214
'_um_profile_template' => 'profile',
215
'_um_profile_max_width' => '1000px',
216
'_um_profile_area_max_width' => '600px',
@@ -519,7 +519,6 @@ if ( ! class_exists( 'um\Config' ) ) {
519
'form_asterisk' => 0,
520
'profile_title' => '{display_name} | {site_name}',
521
'profile_desc' => '{display_name} is on {site_name}. Join {site_name} to view {display_name}\'s profile',
522
- 'allow_tracking' => 0,
523
'admin_email' => get_bloginfo('admin_email'),
524
'mail_from' => get_bloginfo('name'),
525
'mail_from_addr' => get_bloginfo('admin_email'),
210
'_um_profile_header_menu' => 'bc',
211
'_um_profile_empty_text' => 1,
212
'_um_profile_empty_text_emo' => 1,
213
+ '_um_profile_role' => array(),
214
'_um_profile_template' => 'profile',
215
'_um_profile_max_width' => '1000px',
216
'_um_profile_area_max_width' => '600px',
519
'form_asterisk' => 0,
520
'profile_title' => '{display_name} | {site_name}',
521
'profile_desc' => '{display_name} is on {site_name}. Join {site_name} to view {display_name}\'s profile',
522
'admin_email' => get_bloginfo('admin_email'),
523
'mail_from' => get_bloginfo('name'),
524
'mail_from_addr' => get_bloginfo('admin_email'),
includes/class-dependencies.php CHANGED
@@ -39,14 +39,14 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
39
'instagram' => '2.0',
40
'invitations' => '2.0',
41
'mailchimp' => '2.0.1',
42
- 'messaging' => '2.0.1',
43
'mycred' => '2.0',
44
'notices' => '2.0.1',
45
'notifications' => '2.0.1',
46
'online' => '2.0',
47
'private-content' => '2.0',
48
'profile-completeness' => '2.0.1',
49
- 'recaptcha' => '2.0',
50
'reviews' => '2.0.3',
51
'social-activity' => '2.0.1',
52
'social-login' => '2.0.1',
@@ -57,7 +57,7 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
57
'woocommerce' => '2.0.1',
58
'restrict-content' => '2.0',
59
'beaver-builder' => '2.0',
60
- 'gdpr' => '1.0.0',
61
);
62
63
39
'instagram' => '2.0',
40
'invitations' => '2.0',
41
'mailchimp' => '2.0.1',
42
+ 'messaging' => '2.0.5',
43
'mycred' => '2.0',
44
'notices' => '2.0.1',
45
'notifications' => '2.0.1',
46
'online' => '2.0',
47
'private-content' => '2.0',
48
'profile-completeness' => '2.0.1',
49
+ 'recaptcha' => '2.0.2',
50
'reviews' => '2.0.3',
51
'social-activity' => '2.0.1',
52
'social-login' => '2.0.1',
57
'woocommerce' => '2.0.1',
58
'restrict-content' => '2.0',
59
'beaver-builder' => '2.0',
60
+ 'photos' => '1.1',
61
);
62
63
includes/class-init.php CHANGED
@@ -73,6 +73,7 @@ if ( ! class_exists( 'UM' ) ) {
73
static public function instance() {
74
if ( is_null( self::$instance ) ) {
75
self::$instance = new self();
76
}
77
78
return self::$instance;
@@ -163,7 +164,15 @@ if ( ! class_exists( 'UM' ) ) {
163
*/
164
function __construct() {
165
parent::__construct();
166
167
//register autoloader for include UM classes
168
spl_autoload_register( array( $this, 'um__autoloader' ) );
169
@@ -453,6 +462,8 @@ if ( ! class_exists( 'UM' ) ) {
453
if ( ! $version ) {
454
update_option( 'um_last_version_upgrade', ultimatemember_version );
455
456
//show avatars on first install
457
if ( ! get_option( 'show_avatars' ) ) {
458
update_option( 'show_avatars', 1 );
@@ -486,6 +497,8 @@ if ( ! class_exists( 'UM' ) ) {
486
$this->metabox();
487
$this->admin_upgrade()->init_packages_ajax_handlers();
488
$this->admin_gdpr();
489
} elseif ( $this->is_request( 'admin' ) ) {
490
$this->admin();
491
$this->admin_menu();
@@ -524,7 +537,6 @@ if ( ! class_exists( 'UM' ) ) {
524
$this->permalinks();
525
$this->modal();
526
$this->cron();
527
- //$this->tracking();
528
$this->mobile();
529
$this->external_integrations();
530
$this->gdpr();
@@ -1240,20 +1252,6 @@ if ( ! class_exists( 'UM' ) ) {
1240
}
1241
1242
1243
- /**
1244
- * @since 2.0
1245
- *
1246
- * @return um\core\Tracking
1247
- */
1248
- function tracking() {
1249
- if ( empty( $this->classes['tracking'] ) ) {
1250
- $this->classes['tracking'] = new um\core\Tracking();
1251
- }
1252
-
1253
- return $this->classes['tracking'];
1254
- }
1255
-
1256
-
1257
/**
1258
* @since 2.0
1259
*
73
static public function instance() {
74
if ( is_null( self::$instance ) ) {
75
self::$instance = new self();
76
+ self::$instance->_um_construct();
77
}
78
79
return self::$instance;
164
*/
165
function __construct() {
166
parent::__construct();
167
+ }
168
+
169
170
+ /**
171
+ * UM pseudo-constructor.
172
+ *
173
+ * @since 2.0.18
174
+ */
175
+ function _um_construct() {
176
//register autoloader for include UM classes
177
spl_autoload_register( array( $this, 'um__autoloader' ) );
178
462
if ( ! $version ) {
463
update_option( 'um_last_version_upgrade', ultimatemember_version );
464
465
+ add_option( 'um_first_activation_date', time() );
466
+
467
//show avatars on first install
468
if ( ! get_option( 'show_avatars' ) ) {
469
update_option( 'show_avatars', 1 );
497
$this->metabox();
498
$this->admin_upgrade()->init_packages_ajax_handlers();
499
$this->admin_gdpr();
500
+ $this->columns();
501
+ $this->notices();
502
} elseif ( $this->is_request( 'admin' ) ) {
503
$this->admin();
504
$this->admin_menu();
537
$this->permalinks();
538
$this->modal();
539
$this->cron();
540
$this->mobile();
541
$this->external_integrations();
542
$this->gdpr();
1252
}
1253
1254
1255
/**
1256
* @since 2.0
1257
*
includes/core/class-access.php CHANGED
@@ -244,9 +244,10 @@ if ( ! class_exists( 'um\core\Access' ) ) {
244
global $post;
245
246
$curr = UM()->permalinks()->get_current_url();
247
248
if ( is_front_page() ) {
249
- if ( is_user_logged_in() ) {
250
251
$user_default_homepage = um_user( 'default_homepage' );
252
if ( ! empty( $user_default_homepage ) )
@@ -300,7 +301,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
300
}
301
}
302
} elseif ( is_category() ) {
303
- if ( ! is_user_logged_in() ) {
304
305
$access = UM()->options()->get( 'accessible' );
306
@@ -324,7 +325,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
324
325
$access = UM()->options()->get( 'accessible' );
326
327
- if ( $access == 2 && ! is_user_logged_in() ) {
328
329
//build exclude URLs pages
330
$redirects = array();
@@ -1021,19 +1022,22 @@ if ( ! class_exists( 'um\core\Access' ) ) {
1021
}
1022
1023
//post is private
1024
- if ( '1' == $restriction['_um_accessible'] ) {
1025
//if post for not logged in users and user is not logged in
1026
if ( ! is_user_logged_in() ) {
1027
$filtered_items[] = $menu_item;
1028
continue;
1029
} else {
1030
1031
- if ( current_user_can( 'administrator' ) ) {
1032
- $filtered_items[] = $menu_item;
1033
- continue;
1034
- }
1035
1036
- //if not single query when exclude if set _um_access_hide_from_queries
1037
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
1038
$filtered_items[] = $menu_item;
1039
continue;
@@ -1043,10 +1047,10 @@ if ( ! class_exists( 'um\core\Access' ) ) {
1043
//if post for logged in users and user is not logged in
1044
if ( is_user_logged_in() ) {
1045
1046
- if ( current_user_can( 'administrator' ) ) {
1047
- $filtered_items[] = $menu_item;
1048
- continue;
1049
- }
1050
1051
$custom_restrict = $this->um_custom_restriction( $restriction );
1052
@@ -1077,8 +1081,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
1077
}
1078
}
1079
}
1080
-
1081
- continue;
1082
}
1083
1084
//add all other posts
244
global $post;
245
246
$curr = UM()->permalinks()->get_current_url();
247
+ $ms_empty_role_access = is_multisite() && is_user_logged_in() && !UM()->roles()->get_priority_user_role( um_user('ID') );
248
249
if ( is_front_page() ) {
250
+ if ( is_user_logged_in() && !$ms_empty_role_access ) {
251
252
$user_default_homepage = um_user( 'default_homepage' );
253
if ( ! empty( $user_default_homepage ) )
301
}
302
}
303
} elseif ( is_category() ) {
304
+ if ( ! is_user_logged_in() || $ms_empty_role_access ) {
305
306
$access = UM()->options()->get( 'accessible' );
307
325
326
$access = UM()->options()->get( 'accessible' );
327
328
+ if ( $access == 2 && ( !is_user_logged_in() || $ms_empty_role_access ) ) {
329
330
//build exclude URLs pages
331
$redirects = array();
1022
}
1023
1024
//post is private
1025
+ if ( '0' == $restriction['_um_accessible'] ) {
1026
+ $filtered_items[] = $menu_item;
1027
+ continue;
1028
+ } elseif ( '1' == $restriction['_um_accessible'] ) {
1029
//if post for not logged in users and user is not logged in
1030
if ( ! is_user_logged_in() ) {
1031
$filtered_items[] = $menu_item;
1032
continue;
1033
} else {
1034
1035
+ if ( current_user_can( 'administrator' ) ) {
1036
+ $filtered_items[] = $menu_item;
1037
+ continue;
1038
+ }
1039
1040
+ //if not single query when exclude if set _um_access_hide_from_queries
1041
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
1042
$filtered_items[] = $menu_item;
1043
continue;
1047
//if post for logged in users and user is not logged in
1048
if ( is_user_logged_in() ) {
1049
1050
+ if ( current_user_can( 'administrator' ) ) {
1051
+ $filtered_items[] = $menu_item;
1052
+ continue;
1053
+ }
1054
1055
$custom_restrict = $this->um_custom_restriction( $restriction );
1056
1081
}
1082
}
1083
}