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
  }
 
 
1084
  }
1085
 
1086
  //add all other posts
includes/core/class-account.php CHANGED
@@ -756,7 +756,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
756
 
757
  <div class="um-col-alt um-col-alt-b">
758
  <div class="um-left">
759
- <input type="submit" name="um_account_submit" id="um_account_submit" class="um-button" value="<?php echo ! empty( $tab_data['submit_title'] ) ? $tab_data['submit_title'] : $tab_data['title']; ?>" />
760
  </div>
761
 
762
  <?php
756
 
757
  <div class="um-col-alt um-col-alt-b">
758
  <div class="um-left">
759
+ <input type="submit" name="um_account_submit" id="um_account_submit_<?php echo $tab_id ?>" class="um-button" value="<?php echo ! empty( $tab_data['submit_title'] ) ? $tab_data['submit_title'] : $tab_data['title']; ?>" />
760
  </div>
761
 
762
  <?php
includes/core/class-builtin.php CHANGED
@@ -925,7 +925,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
925
  'validate' => 'instagram_url',
926
  'url_text' => 'Instagram',
927
  'advanced' => 'social',
928
- 'color' => '#3f729b',
929
  'match' => 'https://instagram.com/',
930
  ),
931
 
925
  'validate' => 'instagram_url',
926
  'url_text' => 'Instagram',
927
  'advanced' => 'social',
928
+ 'color' => 'radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%,#d6249f 60%,#285AEB 90%)',
929
  'match' => 'https://instagram.com/',
930
  ),
931
 
includes/core/class-enqueue.php CHANGED
@@ -263,7 +263,9 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
263
  */
264
  function load_selectjs() {
265
 
266
- if ( class_exists( 'WooCommerce' ) ) {
 
 
267
  wp_dequeue_style( 'select2' );
268
  wp_deregister_style( 'select2' );
269
 
263
  */
264
  function load_selectjs() {
265
 
266
+ $dequeue_select2 = apply_filters( 'um_dequeue_select2_scripts', false );
267
+
268
+ if ( class_exists( 'WooCommerce' ) || $dequeue_select2 ) {
269
  wp_dequeue_style( 'select2' );
270
  wp_deregister_style( 'select2' );
271
 
includes/core/class-fields.php CHANGED
@@ -182,8 +182,38 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
182
  */
183
  function delete_field_from_form( $id, $form_id ) {
184
  $fields = UM()->query()->get_attr( 'custom_fields', $form_id );
185
- if (isset( $fields[$id] )) {
186
- unset( $fields[$id] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
188
  }
189
  }
@@ -628,9 +658,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
628
 
629
  } elseif ( ( um_user( $key ) || isset( $data['show_anyway'] ) ) && $this->viewing == true ) {
630
 
631
- $value = um_filtered_value( $key, $data );
632
-
633
- return $value;
634
 
635
  } elseif ( isset( UM()->user()->profile[ $key ] ) ) {
636
 
@@ -1106,10 +1134,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
1106
  */
1107
  function get_label( $key ) {
1108
  $fields = UM()->builtin()->all_user_fields;
1109
- if (isset( $fields[$key]['label'] ))
1110
- return $fields[$key]['label'];
1111
- if (isset( $fields[$key]['title'] ))
1112
- return $fields[$key]['title'];
1113
 
1114
  return '';
1115
  }
@@ -1690,7 +1718,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
1690
 
1691
  case 'select':
1692
  case 'radio':
1693
- $form_key = str_replace( 'role_select', 'role', $key );
1694
  $field_id = $form_key;
1695
  break;
1696
  default:
@@ -2571,9 +2599,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
2571
  }
2572
  }
2573
 
2574
- $options = $this->get_available_roles( $form_key, $options );
2575
-
2576
- // add an empty option!
2577
  $output .= '<option value=""></option>';
2578
 
2579
  $field_value = '';
@@ -2583,6 +2608,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
2583
  $options_pair = true;
2584
  }
2585
 
 
 
2586
  // add options
2587
  if ( ! empty( $options ) ) {
2588
  foreach ( $options as $k => $v ) {
@@ -2890,7 +2917,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
2890
  $um_field_checkbox_item_title = $v;
2891
  $option_value = $v;
2892
 
2893
- if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role', 'role_radio' ) ) ) {
2894
  $um_field_checkbox_item_title = $v;
2895
  $option_value = $k;
2896
  }
@@ -2910,6 +2937,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
2910
  $class = "um-icon-android-radio-button-off";
2911
  }
2912
 
 
2913
  if (isset( $data['editable'] ) && $data['editable'] == 0) {
2914
  $col_class .= " um-field-radio-state-disabled";
2915
  }
@@ -4010,23 +4038,23 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
4010
  switch ($act_id) {
4011
 
4012
  case 'um_admin_duplicate_field':
4013
- UM()->fields()->duplicate_field( $arg1, $arg2 );
4014
  break;
4015
 
4016
  case 'um_admin_remove_field_global':
4017
- UM()->fields()->delete_field_from_db( $arg1 );
4018
  break;
4019
 
4020
  case 'um_admin_remove_field':
4021
- UM()->fields()->delete_field_from_form( $arg1, $arg2 );
4022
  break;
4023
 
4024
  case 'um_admin_add_field_from_predefined':
4025
- UM()->fields()->add_field_from_predefined( $arg1, $arg2, $position );
4026
  break;
4027
 
4028
  case 'um_admin_add_field_from_list':
4029
- UM()->fields()->add_field_from_list( $arg1, $arg2, $position );
4030
  break;
4031
 
4032
  }
182
  */
183
  function delete_field_from_form( $id, $form_id ) {
184
  $fields = UM()->query()->get_attr( 'custom_fields', $form_id );
185
+
186
+ if ( isset( $fields[ $id ] ) ) {
187
+ $condition_fields = get_option( 'um_fields' );
188
+
189
+ foreach ( $condition_fields as $key => $value ) {
190
+ $deleted_field = array_search( $id, $value );
191
+
192
+ if ( $key != $id && $deleted_field != false ) {
193
+ $deleted_field_id = str_replace( 'conditional_field', '', $deleted_field );
194
+
195
+ if ( $deleted_field_id == '' ) {
196
+ $arr_id = 0;
197
+ } else {
198
+ $arr_id = $deleted_field_id;
199
+ }
200
+
201
+ unset( $condition_fields[ $key ][ 'conditional_action' . $deleted_field_id ] );
202
+ unset( $condition_fields[ $key ][ $deleted_field ] );
203
+ unset( $condition_fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
204
+ unset( $condition_fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
205
+ unset( $condition_fields[ $key ]['conditions'][ $arr_id ] );
206
+
207
+ unset( $fields[ $key ][ 'conditional_action' . $deleted_field_id ] );
208
+ unset( $fields[ $key ][ $deleted_field ] );
209
+ unset( $fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
210
+ unset( $fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
211
+ unset( $fields[ $key ]['conditions'][ $arr_id ] );
212
+ }
213
+ }
214
+
215
+ update_option( 'um_fields' , $condition_fields );
216
+ unset( $fields[ $id ] );
217
  UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
218
  }
219
  }
658
 
659
  } elseif ( ( um_user( $key ) || isset( $data['show_anyway'] ) ) && $this->viewing == true ) {
660
 
661
+ return um_filtered_value( $key, $data );
 
 
662
 
663
  } elseif ( isset( UM()->user()->profile[ $key ] ) ) {
664
 
1134
  */
1135
  function get_label( $key ) {
1136
  $fields = UM()->builtin()->all_user_fields;
1137
+ if ( isset( $fields[$key]['label'] ) )
1138
+ return stripslashes( $fields[$key]['label'] );
1139
+ if ( isset( $fields[$key]['title'] ) )
1140
+ return stripslashes( $fields[$key]['title'] );
1141
 
1142
  return '';
1143
  }
1718
 
1719
  case 'select':
1720
  case 'radio':
1721
+ $form_key = str_replace( array( 'role_select', 'role_radio' ), 'role', $key );
1722
  $field_id = $form_key;
1723
  break;
1724
  default:
2599
  }
2600
  }
2601
 
 
 
 
2602
  $output .= '<option value=""></option>';
2603
 
2604
  $field_value = '';
2608
  $options_pair = true;
2609
  }
2610
 
2611
+ $options = $this->get_available_roles( $form_key, $options );
2612
+
2613
  // add options
2614
  if ( ! empty( $options ) ) {
2615
  foreach ( $options as $k => $v ) {
2917
  $um_field_checkbox_item_title = $v;
2918
  $option_value = $v;
2919
 
2920
+ if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role' ) ) ) {
2921
  $um_field_checkbox_item_title = $v;
2922
  $option_value = $k;
2923
  }
2937
  $class = "um-icon-android-radio-button-off";
2938
  }
2939
 
2940
+
2941
  if (isset( $data['editable'] ) && $data['editable'] == 0) {
2942
  $col_class .= " um-field-radio-state-disabled";
2943
  }
4038
  switch ($act_id) {
4039
 
4040
  case 'um_admin_duplicate_field':
4041
+ $this->duplicate_field( $arg1, $arg2 );
4042
  break;
4043
 
4044
  case 'um_admin_remove_field_global':
4045
+ $this->delete_field_from_db( $arg1 );
4046
  break;
4047
 
4048
  case 'um_admin_remove_field':
4049
+ $this->delete_field_from_form( $arg1, $arg2 );
4050
  break;
4051
 
4052
  case 'um_admin_add_field_from_predefined':
4053
+ $this->add_field_from_predefined( $arg1, $arg2, $position );
4054
  break;
4055
 
4056
  case 'um_admin_add_field_from_list':
4057
+ $this->add_field_from_list( $arg1, $arg2, $position );
4058
  break;
4059
 
4060
  }
includes/core/class-files.php CHANGED
@@ -1133,14 +1133,16 @@ if ( ! class_exists( 'um\core\Files' ) ) {
1133
  * @return string
1134
  */
1135
  function format_bytes( $size , $precision = 1 ) {
 
 
 
 
 
1136
 
1137
- $base = log($size, 1024);
1138
- $suffixes = array('', 'kb', 'MB', 'GB', 'TB');
1139
- $computed_size = round(pow(1024, $base - floor($base)), $precision);
1140
- $unit = $suffixes[ floor($base) ];
1141
-
1142
- return $computed_size.' '.$unit;
1143
 
 
1144
  }
1145
 
1146
 
1133
  * @return string
1134
  */
1135
  function format_bytes( $size , $precision = 1 ) {
1136
+ if ( is_numeric( $size ) ) {
1137
+ $base = log( $size, 1024 );
1138
+ $suffixes = array( '', 'kb', 'MB', 'GB', 'TB' );
1139
+ $computed_size = round( pow( 1024, $base - floor( $base ) ), $precision );
1140
+ $unit = $suffixes[ floor( $base ) ];
1141
 
1142
+ return $computed_size.' '.$unit;
1143
+ }
 
 
 
 
1144
 
1145
+ return '';
1146
  }
1147
 
1148
 
includes/core/class-form.php CHANGED
@@ -308,7 +308,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
308
  global $wp_roles;
309
  $role_keys = array_map( function( $item ) {
310
  return 'um_' . $item;
311
- }, get_option( 'um_roles' ) );
312
  $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
313
 
314
  if ( ! empty( $role ) &&
308
  global $wp_roles;
309
  $role_keys = array_map( function( $item ) {
310
  return 'um_' . $item;
311
+ }, get_option( 'um_roles', array() ) );
312
  $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
313
 
314
  if ( ! empty( $role ) &&
includes/core/class-mail.php CHANGED
@@ -36,6 +36,23 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
36
  }
37
 
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * Init paths for email notifications
41
  */
@@ -66,72 +83,73 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
66
 
67
 
68
  /**
69
- * Mandrill compatibility
70
  *
71
- * @param $nl2br
72
- * @param string $message
73
- * @return bool
74
  */
75
- function mandrill_nl2br( $nl2br, $message = '' ) {
76
- // text emails
77
- if ( ! UM()->options()->get( 'email_html' ) ) {
78
- $nl2br = true;
79
  }
80
 
81
- return $nl2br;
82
  }
83
 
84
 
85
  /**
86
- * Send Email function
87
  *
88
- * @param string $email
89
- * @param null $template
90
- * @param array $args
91
  */
92
- function send( $email, $template, $args = array() ) {
 
 
93
 
94
- if ( ! is_email( $email ) ) return;
95
- if ( UM()->options()->get( $template . '_on' ) != 1 ) return;
 
 
96
 
97
- $this->attachments = null;
98
- $this->headers = 'From: '. UM()->options()->get('mail_from') .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
 
 
 
 
 
 
 
 
 
 
99
 
 
100
  /**
101
  * UM hook
102
  *
103
  * @type filter
104
- * @title um_email_send_subject
105
- * @description Change email notification subject
106
  * @input_vars
107
- * [{"var":"$subject","type":"string","desc":"Subject"},
108
- * {"var":"$key","type":"string","desc":"Template Key"}]
109
  * @change_log
110
  * ["Since: 2.0"]
111
  * @usage
112
- * <?php add_filter( 'um_email_send_subject', 'function_name', 10, 2 ); ?>
113
  * @example
114
  * <?php
115
- * add_filter( 'um_email_send_subject', 'my_email_send_subject', 10, 2 );
116
- * function my_email_send_subject( $subject, $key ) {
117
  * // your code here
118
- * return $paths;
119
  * }
120
  * ?>
121
  */
122
- $subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template );
123
- $this->subject = um_convert_tags( $subject , $args );
124
-
125
- $this->message = $this->prepare_template( $template, $args );
126
-
127
- if ( UM()->options()->get( 'email_html' ) ) {
128
- $this->headers .= "Content-Type: text/html\r\n";
129
- } else {
130
- $this->headers .= "Content-Type: text/plain\r\n";
131
- }
132
-
133
- // Send mail
134
- wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
135
  }
136
 
137
 
@@ -313,7 +331,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
313
 
314
  <body <?php echo $body_attrs ?>>
315
 
316
- <?php echo $this->get_email_template( $slug, $args ); ?>
317
 
318
  </body>
319
  </html>
@@ -358,48 +376,55 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
358
 
359
 
360
  /**
361
- * Locate a template and return the path for inclusion.
362
  *
363
- * @access public
364
- * @param string $template_name
365
- * @return string
366
  */
367
- function locate_template( $template_name ) {
368
- // check if there is template at theme folder
369
- $template = locate_template( array(
370
- trailingslashit( 'ultimate-member/email' ) . $template_name . '.php'
371
- ) );
372
 
373
- //if there isn't template at theme folder get template file from plugin dir
374
- if ( ! $template ) {
375
- $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
376
- $template = trailingslashit( $path ) . $template_name . '.php';
377
- }
378
 
379
- // Return what we found.
380
  /**
381
  * UM hook
382
  *
383
  * @type filter
384
- * @title um_locate_email_template
385
- * @description Change email notification template path
386
  * @input_vars
387
- * [{"var":"$template","type":"string","desc":"Template Path"},
388
- * {"var":"$template_name","type":"string","desc":"Template Name"}]
389
  * @change_log
390
  * ["Since: 2.0"]
391
  * @usage
392
- * <?php add_filter( 'um_locate_email_template', 'function_name', 10, 2 ); ?>
393
  * @example
394
  * <?php
395
- * add_filter( 'um_locate_email_template', 'my_locate_email_template', 10, 2 );
396
- * function my_email_template_body_attrs( $template, $template_name ) {
397
  * // your code here
398
- * return $template;
399
  * }
400
  * ?>
401
  */
402
- return apply_filters( 'um_locate_email_template', $template, $template_name );
 
 
 
 
 
 
 
 
 
 
 
 
403
  }
404
 
405
 
@@ -439,16 +464,16 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
439
  *
440
  * @access public
441
  * @param string $template_name
442
- * @param bool $html
443
  * @return string
444
  */
445
- function template_in_theme( $template_name, $html = false ) {
446
  $template_name_file = $this->get_template_filename( $template_name );
447
- $ext = ! $html ? '.php' : '.html';
448
 
449
- // check if there is template at theme folder
 
 
450
  $template = locate_template( array(
451
- trailingslashit( 'ultimate-member/email' ) . $template_name_file . $ext
452
  ) );
453
 
454
  // Return what we found.
@@ -460,24 +485,26 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
460
  * Method returns expected path for template
461
  *
462
  * @access public
 
463
  * @param string $location
464
  * @param string $template_name
465
- * @param bool $html
466
  * @return string
467
  */
468
- function get_template_file( $location, $template_name, $html = false ) {
469
  $template_path = '';
470
  $template_name_file = $this->get_template_filename( $template_name );
471
 
472
- $ext = ! $html ? '.php' : '.html';
473
-
474
  switch( $location ) {
475
  case 'theme':
476
- $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' ). $template_name_file . $ext;
 
 
 
477
  break;
478
  case 'plugin':
479
  $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
480
- $template_path = trailingslashit( $path ) . $template_name . $ext;
481
  break;
482
  }
483
 
@@ -488,10 +515,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
488
  /**
489
  * Ajax copy template to the theme
490
  *
491
- * @param bool $template
492
  * @return bool
493
  */
494
- function copy_email_template( $template = false ) {
495
 
496
  $in_theme = $this->template_in_theme( $template );
497
  if ( $in_theme ) {
@@ -522,26 +549,5 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
522
  return false;
523
  }
524
  }
525
-
526
-
527
- /**
528
- * Delete Email Notification Template
529
- */
530
- function delete_email_template() {
531
- $template = $_POST['email_key'];
532
-
533
- $in_theme = $this->template_in_theme( $template );
534
- if ( ! $in_theme ) {
535
- wp_send_json_error( new \WP_Error( 'template_in_theme', __( 'Template does not exists in theme', 'ultimate-member' ) ) );
536
- }
537
-
538
- $theme_template_path = $this->get_template_file( 'theme', $template );
539
-
540
- if ( unlink( $theme_template_path ) ) {
541
- wp_send_json_success();
542
- } else {
543
- wp_send_json_error( new \WP_Error( 'template_not_exists', __( 'Can not remove template from theme', 'ultimate-member' ) ) );
544
- }
545
- }
546
  }
547
  }
36
  }
37
 
38
 
39
+ /**
40
+ * Mandrill compatibility
41
+ *
42
+ * @param $nl2br
43
+ * @param string $message
44
+ * @return bool
45
+ */
46
+ function mandrill_nl2br( $nl2br, $message = '' ) {
47
+ // text emails
48
+ if ( ! UM()->options()->get( 'email_html' ) ) {
49
+ $nl2br = true;
50
+ }
51
+
52
+ return $nl2br;
53
+ }
54
+
55
+
56
  /**
57
  * Init paths for email notifications
58
  */
83
 
84
 
85
  /**
86
+ * Check blog ID on multisite, return '' if single site
87
  *
88
+ * @return string
 
 
89
  */
90
+ function get_blog_id() {
91
+ $blog_id = '';
92
+ if ( is_multisite() ) {
93
+ $blog_id = '/' . get_current_blog_id();
94
  }
95
 
96
+ return $blog_id;
97
  }
98
 
99
 
100
  /**
101
+ * Locate a template and return the path for inclusion.
102
  *
103
+ * @access public
104
+ * @param string $template_name
105
+ * @return string
106
  */
107
+ function locate_template( $template_name ) {
108
+ // check if there is template at theme folder
109
+ $blog_id = $this->get_blog_id();
110
 
111
+ //get template file from current blog ID folder
112
+ $template = locate_template( array(
113
+ trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name . '.php'
114
+ ) );
115
 
116
+ //if there isn't template at theme folder for current blog ID get template file from theme folder
117
+ if ( is_multisite() && ! $template ) {
118
+ $template = locate_template( array(
119
+ trailingslashit( 'ultimate-member/email' ) . $template_name . '.php'
120
+ ) );
121
+ }
122
+
123
+ //if there isn't template at theme folder get template file from plugin dir
124
+ if ( ! $template ) {
125
+ $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
126
+ $template = trailingslashit( $path ) . $template_name . '.php';
127
+ }
128
 
129
+ // Return what we found.
130
  /**
131
  * UM hook
132
  *
133
  * @type filter
134
+ * @title um_locate_email_template
135
+ * @description Change email notification template path
136
  * @input_vars
137
+ * [{"var":"$template","type":"string","desc":"Template Path"},
138
+ * {"var":"$template_name","type":"string","desc":"Template Name"}]
139
  * @change_log
140
  * ["Since: 2.0"]
141
  * @usage
142
+ * <?php add_filter( 'um_locate_email_template', 'function_name', 10, 2 ); ?>
143
  * @example
144
  * <?php
145
+ * add_filter( 'um_locate_email_template', 'my_locate_email_template', 10, 2 );
146
+ * function my_email_template_body_attrs( $template, $template_name ) {
147
  * // your code here
148
+ * return $template;
149
  * }
150
  * ?>
151
  */
152
+ return apply_filters( 'um_locate_email_template', $template, $template_name );
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
154
 
155
 
331
 
332
  <body <?php echo $body_attrs ?>>
333
 
334
+ <?php echo $this->get_email_template( $slug, $args ); ?>
335
 
336
  </body>
337
  </html>
376
 
377
 
378
  /**
379
+ * Send Email function
380
  *
381
+ * @param string $email
382
+ * @param null $template
383
+ * @param array $args
384
  */
385
+ function send( $email, $template, $args = array() ) {
 
 
 
 
386
 
387
+ if ( ! is_email( $email ) ) return;
388
+ if ( UM()->options()->get( $template . '_on' ) != 1 ) return;
389
+
390
+ $this->attachments = null;
391
+ $this->headers = 'From: '. UM()->options()->get('mail_from') .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
392
 
 
393
  /**
394
  * UM hook
395
  *
396
  * @type filter
397
+ * @title um_email_send_subject
398
+ * @description Change email notification subject
399
  * @input_vars
400
+ * [{"var":"$subject","type":"string","desc":"Subject"},
401
+ * {"var":"$key","type":"string","desc":"Template Key"}]
402
  * @change_log
403
  * ["Since: 2.0"]
404
  * @usage
405
+ * <?php add_filter( 'um_email_send_subject', 'function_name', 10, 2 ); ?>
406
  * @example
407
  * <?php
408
+ * add_filter( 'um_email_send_subject', 'my_email_send_subject', 10, 2 );
409
+ * function my_email_send_subject( $subject, $key ) {
410
  * // your code here
411
+ * return $paths;
412
  * }
413
  * ?>
414
  */
415
+ $subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template );
416
+ $this->subject = um_convert_tags( $subject , $args );
417
+
418
+ $this->message = $this->prepare_template( $template, $args );
419
+
420
+ if ( UM()->options()->get( 'email_html' ) ) {
421
+ $this->headers .= "Content-Type: text/html\r\n";
422
+ } else {
423
+ $this->headers .= "Content-Type: text/plain\r\n";
424
+ }
425
+
426
+ // Send mail
427
+ wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
428
  }
429
 
430
 
464
  *
465
  * @access public
466
  * @param string $template_name
 
467
  * @return string
468
  */
469
+ function template_in_theme( $template_name ) {
470
  $template_name_file = $this->get_template_filename( $template_name );
 
471
 
472
+ $blog_id = $this->get_blog_id();
473
+
474
+ // check if there is template at theme blog ID folder
475
  $template = locate_template( array(
476
+ trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . '.php'
477
  ) );
478
 
479
  // Return what we found.
485
  * Method returns expected path for template
486
  *
487
  * @access public
488
+ *
489
  * @param string $location
490
  * @param string $template_name
491
+ *
492
  * @return string
493
  */
494
+ function get_template_file( $location, $template_name ) {
495
  $template_path = '';
496
  $template_name_file = $this->get_template_filename( $template_name );
497
 
 
 
498
  switch( $location ) {
499
  case 'theme':
500
+ //save email template in blog ID folder if we use multisite
501
+ $blog_id = $this->get_blog_id();
502
+
503
+ $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' . $blog_id ). $template_name_file . '.php';
504
  break;
505
  case 'plugin':
506
  $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
507
+ $template_path = trailingslashit( $path ) . $template_name . '.php';
508
  break;
509
  }
510
 
515
  /**
516
  * Ajax copy template to the theme
517
  *
518
+ * @param string $template
519
  * @return bool
520
  */
521
+ function copy_email_template( $template ) {
522
 
523
  $in_theme = $this->template_in_theme( $template );
524
  if ( $in_theme ) {
549
  return false;
550
  }
551
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
552
  }
553
  }
includes/core/class-members.php CHANGED
@@ -88,14 +88,14 @@ if ( ! class_exists( 'um\core\Members' ) ) {
88
  return $string;
89
  }
90
 
91
-
92
- /**
93
- * Show filter
94
  *
95
  * @param $filter
 
96
  */
97
- function show_filter( $filter ) {
98
- $fields = UM()->builtin()->all_user_fields;
99
 
100
  if ( isset( $fields[ $filter ] ) ) {
101
  $attrs = $fields[ $filter ];
@@ -222,6 +222,21 @@ if ( ! class_exists( 'um\core\Members' ) ) {
222
  $attrs = apply_filters( 'um_search_select_fields', $attrs );
223
  }
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  switch ( $type ) {
226
 
227
  case 'select':
88
  return $string;
89
  }
90
 
91
+ /**
92
+ * Prepare filter data
 
93
  *
94
  * @param $filter
95
+ * @return array
96
  */
97
+ function prepare_filter( $filter ) {
98
+ $fields = UM()->builtin()->all_user_fields;
99
 
100
  if ( isset( $fields[ $filter ] ) ) {
101
  $attrs = $fields[ $filter ];
222
  $attrs = apply_filters( 'um_search_select_fields', $attrs );
223
  }
224
 
225
+ return compact( 'type', 'attrs' );
226
+ }
227
+
228
+ /**
229
+ * Show filter
230
+ *
231
+ * @param $filter
232
+ */
233
+ function show_filter( $filter ) {
234
+ /**
235
+ * @var $type
236
+ * @var $attrs
237
+ */
238
+ extract( $this->prepare_filter( $filter ) );
239
+
240
  switch ( $type ) {
241
 
242
  case 'select':
includes/core/class-password.php CHANGED
@@ -107,6 +107,10 @@ if ( ! class_exists( 'um\core\Password' ) ) {
107
 
108
  UM()->form()->post_form = $_POST;
109
 
 
 
 
 
110
  /**
111
  * UM hook
112
  *
107
 
108
  UM()->form()->post_form = $_POST;
109
 
110
+ if ( empty( UM()->form()->post_form['mode'] ) ) {
111
+ UM()->form()->post_form['mode'] = 'password';
112
+ }
113
+
114
  /**
115
  * UM hook
116
  *
includes/core/class-permalinks.php CHANGED
@@ -130,46 +130,10 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
130
  * @return mixed|void
131
  */
132
  function get_current_url( $no_query_params = false ) {
133
- $server_name_method = UM()->options()->get( 'current_url_method' );
134
- $server_name_method = ! empty( $server_name_method ) ? $server_name_method : 'SERVER_NAME';
135
 
136
- $um_port_forwarding_url = UM()->options()->get( 'um_port_forwarding_url' );
137
- $um_port_forwarding_url = ! empty( $um_port_forwarding_url ) ? $um_port_forwarding_url : '';
138
-
139
- $page_url = '';
140
- if ( is_multisite() ) {
141
- $blog_id = get_current_blog_id();
142
- $siteurl = get_site_url( $blog_id );
143
-
144
- $network_permalink_structure = UM()->options()->get( 'network_permalink_structure' );
145
-
146
- if( $network_permalink_structure == "sub-directory" ){
147
- $page_url .= "//";
148
- $page_url .= $_SERVER[ $server_name_method ];
149
- }else{
150
- $page_url .= $siteurl;
151
- }
152
-
153
- if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
154
- $page_url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
155
- } else {
156
- $page_url .= $_SERVER["REQUEST_URI"];
157
- }
158
-
159
- } else {
160
- if ( !isset( $_SERVER['SERVER_NAME'] ) )
161
- return '';
162
-
163
- $page_url .= "//";
164
-
165
- if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
166
- $page_url .= $_SERVER[ $server_name_method ].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
167
-
168
- } else {
169
- $page_url .= $_SERVER[ $server_name_method ].$_SERVER["REQUEST_URI"];
170
- }
171
-
172
- }
173
 
174
  if ( $no_query_params == true ) {
175
  $page_url = strtok( $page_url, '?' );
@@ -196,7 +160,7 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
196
  * }
197
  * ?>
198
  */
199
- return apply_filters( 'um_get_current_page_url', set_url_scheme( $page_url ) );
200
  }
201
 
202
 
130
  * @return mixed|void
131
  */
132
  function get_current_url( $no_query_params = false ) {
133
+ //use WP native function for fill $_SERVER variables by correct values
134
+ wp_fix_server_vars();
135
 
136
+ $page_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
  if ( $no_query_params == true ) {
139
  $page_url = strtok( $page_url, '?' );
160
  * }
161
  * ?>
162
  */
163
+ return apply_filters( 'um_get_current_page_url', $page_url );
164
  }
165
 
166
 
includes/core/class-plugin-updater.php CHANGED
@@ -115,6 +115,14 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
115
  'key' => 'woocommerce',
116
  'title' => 'Woocommerce',
117
  ),
 
 
 
 
 
 
 
 
118
  );
119
 
120
  $the_plugs = get_option( 'active_plugins' );
@@ -163,7 +171,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
163
 
164
  $api_params['active_extensions'] = array();
165
  foreach ( $exts as $slug => $data ) {
166
- $plugin_data = get_plugin_data( ABSPATH . "wp-content/plugins/{$slug}" );
167
 
168
  $api_params['active_extensions'][$slug] = array(
169
  'slug' => $slug,
@@ -176,7 +184,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
176
  $request = wp_remote_post(
177
  'https://ultimatemember.com/',
178
  array(
179
- 'timeout' => 15,
180
  'sslverify' => false,
181
  'body' => $api_params
182
  )
@@ -244,7 +252,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
244
  $exts = $this->um_get_active_plugins();
245
  foreach ( $exts as $slug => $data ) {
246
 
247
- $plugin_data = get_plugin_data( ABSPATH . "wp-content/plugins/{$slug}" );
248
 
249
  //if response for current product isn't empty check for override
250
  if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $slug ] ) )
@@ -331,7 +339,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
331
  $url = get_site_url( get_current_blog_id() );
332
  $domain = strtolower( urlencode( rtrim( $url, '/' ) ) );
333
 
334
- $plugin_data = get_plugin_data( ABSPATH . "wp-content/plugins/{$slug}" );
335
 
336
  $api_params = array(
337
  'action' => 'get_last_version',
115
  'key' => 'woocommerce',
116
  'title' => 'Woocommerce',
117
  ),
118
+ 'um-user-photos/um-user-photos.php' => array(
119
+ 'key' => 'user_photos',
120
+ 'title' => 'User Photos',
121
+ ),
122
+ 'um-private-content/um-private-content.php' => array(
123
+ 'key' => 'private_content',
124
+ 'title' => 'Private Content',
125
+ ),
126
  );
127
 
128
  $the_plugs = get_option( 'active_plugins' );
171
 
172
  $api_params['active_extensions'] = array();
173
  foreach ( $exts as $slug => $data ) {
174
+ $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug );
175
 
176
  $api_params['active_extensions'][$slug] = array(
177
  'slug' => $slug,
184
  $request = wp_remote_post(
185
  'https://ultimatemember.com/',
186
  array(
187
+ 'timeout' => 45,
188
  'sslverify' => false,
189
  'body' => $api_params
190
  )
252
  $exts = $this->um_get_active_plugins();
253
  foreach ( $exts as $slug => $data ) {
254
 
255
+ $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug );
256
 
257
  //if response for current product isn't empty check for override
258
  if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $slug ] ) )
339
  $url = get_site_url( get_current_blog_id() );
340
  $domain = strtolower( urlencode( rtrim( $url, '/' ) ) );
341
 
342
+ $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug );
343
 
344
  $api_params = array(
345
  'action' => 'get_last_version',
includes/core/class-profile.php CHANGED
@@ -118,18 +118,20 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
118
 
119
  // disable private tabs
120
  if ( ! is_admin() ) {
121
- if( is_user_logged_in() ) {
122
- $user_id = um_user('ID');
123
- um_fetch_user( get_current_user_id() );
124
- }
 
125
  foreach ( $tabs as $id => $tab ) {
126
  if ( ! $this->can_view_tab( $id ) ) {
127
- unset( $tabs[$id] );
128
  }
129
  }
130
- if( is_user_logged_in() ) {
131
- um_fetch_user( $user_id );
132
- }
 
133
  }
134
 
135
  return $tabs;
@@ -143,10 +145,13 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
143
  */
144
  function tabs_active() {
145
  $tabs = $this->tabs();
146
- foreach( $tabs as $id => $info ) {
147
- if ( ! UM()->options()->get('profile_tab_'.$id) && !isset( $info['_builtin'] ) && !isset( $info['custom'] ) )
 
148
  unset( $tabs[ $id ] );
 
149
  }
 
150
  return $tabs;
151
  }
152
 
@@ -212,28 +217,38 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
212
  * @return bool
213
  */
214
  function can_view_tab( $tab ) {
215
- $privacy = intval( UM()->options()->get( 'profile_tab_' . $tab . '_privacy' ) );
 
 
 
 
 
216
  $can_view = false;
217
 
218
- switch( $privacy ) {
 
 
 
 
 
219
  case 1:
220
- $can_view = is_user_logged_in() ? false : true;
221
  break;
222
 
223
  case 2:
224
- $can_view = is_user_logged_in() ? true : false;
225
  break;
226
 
227
  case 3:
228
- $can_view = get_current_user_id() == um_user( 'ID' ) ? true : false;
229
  break;
230
 
231
  case 4:
232
- $can_view = false;
233
- if( is_user_logged_in() ) {
234
- $roles = UM()->options()->get( 'profile_tab_' . $tab . '_roles' );
235
- if( is_array( $roles )
236
- && in_array( UM()->user()->get_role(), $roles ) ) {
237
  $can_view = true;
238
  }
239
  }
118
 
119
  // disable private tabs
120
  if ( ! is_admin() ) {
121
+ if ( is_user_logged_in() ) {
122
+ $user_id = um_user('ID');
123
+ um_fetch_user( get_current_user_id() );
124
+ }
125
+
126
  foreach ( $tabs as $id => $tab ) {
127
  if ( ! $this->can_view_tab( $id ) ) {
128
+ unset( $tabs[ $id ] );
129
  }
130
  }
131
+
132
+ if ( is_user_logged_in() ) {
133
+ um_fetch_user( $user_id );
134
+ }
135
  }
136
 
137
  return $tabs;
145
  */
146
  function tabs_active() {
147
  $tabs = $this->tabs();
148
+
149
+ foreach ( $tabs as $id => $info ) {
150
+ if ( ! UM()->options()->get( 'profile_tab_' . $id ) && ! isset( $info['_builtin'] ) && ! isset( $info['custom'] ) ) {
151
  unset( $tabs[ $id ] );
152
+ }
153
  }
154
+
155
  return $tabs;
156
  }
157
 
217
  * @return bool
218
  */
219
  function can_view_tab( $tab ) {
220
+
221
+ $target_id = UM()->user()->target_id;
222
+ if ( empty( $target_id ) ) {
223
+ return true;
224
+ }
225
+
226
  $can_view = false;
227
 
228
+ $privacy = intval( UM()->options()->get( 'profile_tab_' . $tab . '_privacy' ) );
229
+ switch ( $privacy ) {
230
+ case 0:
231
+ $can_view = true;
232
+ break;
233
+
234
  case 1:
235
+ $can_view = ! is_user_logged_in();
236
  break;
237
 
238
  case 2:
239
+ $can_view = is_user_logged_in();
240
  break;
241
 
242
  case 3:
243
+ $can_view = is_user_logged_in() && get_current_user_id() === $target_id;
244
  break;
245
 
246
  case 4:
247
+ if ( is_user_logged_in() ) {
248
+ $roles = (array) UM()->options()->get( 'profile_tab_' . $tab . '_roles' );
249
+
250
+ $current_user_roles = um_user( 'roles' );
251
+ if ( ! empty( $current_user_roles ) && count( array_intersect( $current_user_roles, $roles ) ) > 0 ) {
252
  $can_view = true;
253
  }
254
  }
includes/core/class-rest-api.php CHANGED
@@ -70,10 +70,10 @@ if ( ! class_exists( 'um\core\REST_API' ) ) {
70
  add_action( 'template_redirect', array( $this, 'process_query' ), -1 );
71
  add_filter( 'query_vars', array( $this, 'query_vars' ) );
72
 
73
- add_filter( 'um_user_profile_additional_fields', array( $this, 'user_key_field' ), 3, 2 );
74
 
75
- add_action( 'personal_options_update', array( $this, 'update_key' ) );
76
- add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
77
 
78
  // Determine if JSON_PRETTY_PRINT is available
79
  $this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
70
  add_action( 'template_redirect', array( $this, 'process_query' ), -1 );
71
  add_filter( 'query_vars', array( $this, 'query_vars' ) );
72
 
73
+ //add_filter( 'um_user_profile_additional_fields', array( $this, 'user_key_field' ), 3, 2 );
74
 
75
+ //add_action( 'personal_options_update', array( $this, 'update_key' ) );
76
+ //add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
77
 
78
  // Determine if JSON_PRETTY_PRINT is available
79
  $this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
includes/core/class-rewrite.php CHANGED
@@ -205,6 +205,30 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
205
 
206
  $user_id = username_exists( um_queried_user() );
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  // Try nice name
209
  if ( !$user_id ) {
210
  $slug = um_queried_user();
205
 
206
  $user_id = username_exists( um_queried_user() );
207
 
208
+ //Try
209
+ if ( ! $user_id ) {
210
+ $permalink_base = UM()->options()->get( 'permalink_base' );
211
+
212
+ // Search by Profile Slug
213
+ $args = array(
214
+ "fields" => 'ids',
215
+ 'meta_query' => array(
216
+ array(
217
+ 'key' => 'um_user_profile_url_slug_'.$permalink_base,
218
+ 'value' => strtolower( um_queried_user() ),
219
+ 'compare' => '='
220
+ )
221
+ ),
222
+ 'number' => 1
223
+ );
224
+
225
+
226
+ $ids = new \WP_User_Query( $args );
227
+ if ( $ids->total_users > 0 ) {
228
+ $user_id = current( $ids->get_results() );
229
+ }
230
+ }
231
+
232
  // Try nice name
233
  if ( !$user_id ) {
234
  $slug = um_queried_user();
includes/core/class-roles-capabilities.php CHANGED
@@ -418,6 +418,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
418
  $um_roles_keys = array_map( function( $item ) {
419
  return 'um_' . $item;
420
  }, $um_roles_keys );
 
421
  }
422
 
423
  $orders = array();
@@ -571,21 +572,25 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
571
  * @return bool|int
572
  */
573
  function um_current_user_can( $cap, $user_id ) {
574
- if ( ! is_user_logged_in() )
575
  return false;
 
576
 
577
  $return = 1;
578
 
579
  um_fetch_user( get_current_user_id() );
580
 
581
  $current_user_roles = UM()->roles()->get_all_user_roles( $user_id );
 
582
  switch( $cap ) {
583
  case 'edit':
584
  if ( get_current_user_id() == $user_id && um_user( 'can_edit_profile' ) )
585
  $return = 1;
586
- elseif ( ! um_user( 'can_edit_everyone' ) )
587
  $return = 0;
588
- elseif ( get_current_user_id() == $user_id && ! um_user( 'can_edit_profile') )
 
 
589
  $return = 0;
590
  elseif ( um_user( 'can_edit_roles' ) && ( empty( $current_user_roles ) || count( array_intersect( $current_user_roles, um_user( 'can_edit_roles' ) ) ) <= 0 ) )
591
  $return = 0;
@@ -618,6 +623,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
618
 
619
  $user_id = get_current_user_id();
620
  $role = UM()->roles()->get_priority_user_role( $user_id );
 
621
  $permissions = $this->role_data( $role );
622
 
623
  /**
@@ -647,6 +653,9 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
647
  if ( isset( $permissions[ $permission ] ) && is_serialized( $permissions[ $permission ] ) )
648
  return unserialize( $permissions[ $permission ] );
649
 
 
 
 
650
  if ( isset( $permissions[ $permission ] ) && $permissions[ $permission ] == 1 )
651
  return true;
652
 
418
  $um_roles_keys = array_map( function( $item ) {
419
  return 'um_' . $item;
420
  }, $um_roles_keys );
421
+
422
  }
423
 
424
  $orders = array();
572
  * @return bool|int
573
  */
574
  function um_current_user_can( $cap, $user_id ) {
575
+ if ( ! is_user_logged_in() ) {
576
  return false;
577
+ }
578
 
579
  $return = 1;
580
 
581
  um_fetch_user( get_current_user_id() );
582
 
583
  $current_user_roles = UM()->roles()->get_all_user_roles( $user_id );
584
+
585
  switch( $cap ) {
586
  case 'edit':
587
  if ( get_current_user_id() == $user_id && um_user( 'can_edit_profile' ) )
588
  $return = 1;
589
+ elseif ( get_current_user_id() == $user_id && ! um_user( 'can_edit_profile' ) )
590
  $return = 0;
591
+ elseif ( um_user( 'can_edit_everyone' ) )
592
+ $return = 1;
593
+ elseif ( ! um_user( 'can_edit_everyone' ) )
594
  $return = 0;
595
  elseif ( um_user( 'can_edit_roles' ) && ( empty( $current_user_roles ) || count( array_intersect( $current_user_roles, um_user( 'can_edit_roles' ) ) ) <= 0 ) )
596
  $return = 0;
623
 
624
  $user_id = get_current_user_id();
625
  $role = UM()->roles()->get_priority_user_role( $user_id );
626
+
627
  $permissions = $this->role_data( $role );
628
 
629
  /**
653
  if ( isset( $permissions[ $permission ] ) && is_serialized( $permissions[ $permission ] ) )
654
  return unserialize( $permissions[ $permission ] );
655
 
656
+ if ( isset( $permissions[ $permission ] ) && is_array( $permissions[ $permission ] ) )
657
+ return $permissions[ $permission ];
658
+
659
  if ( isset( $permissions[ $permission ] ) && $permissions[ $permission ] == 1 )
660
  return true;
661
 
includes/core/class-setup.php CHANGED
@@ -220,8 +220,8 @@ if ( ! class_exists( 'um\core\Setup' ) ) {
220
 
221
  foreach ( UM()->config()->settings_defaults as $key => $value ) {
222
  //set new options to default
223
- if ( ! isset( $options[$key] ) )
224
- $options[$key] = $value;
225
  }
226
 
227
  update_option( 'um_options', $options );
@@ -236,7 +236,7 @@ if ( ! class_exists( 'um\core\Setup' ) ) {
236
  UM()->query()->count_users_by_status( 'unassigned' );
237
 
238
  foreach ( UM()->config()->default_roles_metadata as $role => $meta ) {
239
- update_option( "um_role_{$role}_meta", $meta );
240
  }
241
  }
242
  }
220
 
221
  foreach ( UM()->config()->settings_defaults as $key => $value ) {
222
  //set new options to default
223
+ if ( ! isset( $options[ $key ] ) )
224
+ $options[ $key ] = $value;
225
  }
226
 
227
  update_option( 'um_options', $options );
236
  UM()->query()->count_users_by_status( 'unassigned' );
237
 
238
  foreach ( UM()->config()->default_roles_metadata as $role => $meta ) {
239
+ add_option( "um_role_{$role}_meta", $meta );
240
  }
241
  }
242
  }
includes/core/class-shortcodes.php CHANGED
@@ -522,8 +522,18 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
522
  $use_custom = get_post_meta( $this->form_id, "_um_{$mode}_use_custom_settings", true );
523
  if ( $use_custom ) { // Custom Form settings
524
  $current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() );
525
- if ( ! empty( $args['role'] ) && ! in_array( $args['role'], $current_user_roles ) ) {
526
- return '';
 
 
 
 
 
 
 
 
 
 
527
  }
528
  }
529
  }
522
  $use_custom = get_post_meta( $this->form_id, "_um_{$mode}_use_custom_settings", true );
523
  if ( $use_custom ) { // Custom Form settings
524
  $current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() );
525
+
526
+ //backward compatibility between single/multi role form's setting
527
+ if ( ! empty( $args['role'] ) ) {
528
+ if ( is_array( $args['role'] ) ) {
529
+ if ( ! count( array_intersect( $args['role'], $current_user_roles ) ) ) {
530
+ return '';
531
+ }
532
+ } else {
533
+ if ( ! in_array( $args['role'], $current_user_roles ) ) {
534
+ return '';
535
+ }
536
+ }
537
  }
538
  }
539
  }
includes/core/class-tracking.php DELETED
@@ -1,185 +0,0 @@
1
- <?php
2
- namespace um\core;
3
-
4
- // Exit if accessed directly
5
- if ( ! defined( 'ABSPATH' ) ) exit;
6
-
7
- if ( ! class_exists( 'um\core\Tracking' ) ) {
8
-
9
-
10
- /**
11
- * Class Tracking
12
- * @package um\core
13
- */
14
- class Tracking {
15
-
16
-
17
- /**
18
- * @var
19
- */
20
- private $data;
21
-
22
-
23
- /**
24
- * Tracking constructor.
25
- */
26
- public function __construct() {
27
-
28
- $this->schedule_send();
29
-
30
- add_action( 'um_admin_do_action__opt_into_tracking', array( $this, 'um_admin_do_action__opt_into_tracking' ) );
31
- add_action( 'um_admin_do_action__opt_out_of_tracking', array( $this, 'um_admin_do_action__opt_out_of_tracking' ) );
32
- }
33
-
34
-
35
- /**
36
- * Opt-in tracking
37
- *
38
- * @param $action
39
- */
40
- function um_admin_do_action__opt_into_tracking( $action ) {
41
- UM()->options()->update( 'um_allow_tracking', 1 );
42
- update_option( 'um_tracking_notice', 1 );
43
-
44
- $this->send_checkin(true);
45
-
46
- exit( wp_redirect( remove_query_arg('um_adm_action') ) );
47
- }
48
-
49
-
50
- /**
51
- * Opt-out of tracking
52
- *
53
- * @param $action
54
- */
55
- function um_admin_do_action__opt_out_of_tracking( $action ) {
56
- UM()->options()->update( 'um_allow_tracking', 0 );
57
- update_option('um_tracking_notice', 1 );
58
-
59
- exit( wp_redirect( remove_query_arg('um_adm_action') ) );
60
- }
61
-
62
-
63
- /**
64
- * Setup info array
65
- *
66
- */
67
- private function setup_data() {
68
- $data = array();
69
-
70
- // Retrieve current theme info
71
- if ( get_bloginfo( 'version' ) < '3.4' ) {
72
- $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
73
- $theme = $theme_data['Name'];
74
- $theme_ver = $theme_data['Version'];
75
- } else {
76
- $theme_data = wp_get_theme();
77
- $theme = $theme_data->Name;
78
- $theme_ver = $theme_data->Version;
79
- }
80
-
81
- $data['url'] = home_url();
82
- $data['theme'] = $theme;
83
- $data['theme_version'] = $theme_ver;
84
- $data['wp_version'] = get_bloginfo( 'version' );
85
- $data['version'] = ultimatemember_version;
86
-
87
- // Retrieve current plugin information
88
- if( ! function_exists( 'get_plugins' ) ) {
89
- include ABSPATH . '/wp-admin/includes/plugin.php';
90
- }
91
-
92
- $plugins = array_keys( get_plugins() );
93
- $active_plugins = get_option( 'active_plugins', array() );
94
-
95
- foreach ( $plugins as $key => $plugin ) {
96
- if ( in_array( $plugin, $active_plugins ) ) {
97
- // Remove active plugins from list so we can show active and inactive separately
98
- unset( $plugins[ $key ] );
99
- }
100
- }
101
-
102
- $data['active_plugins'] = $active_plugins;
103
- $data['inactive_plugins'] = $plugins;
104
- $data['language'] = get_bloginfo('language');
105
- $data['multisite'] = ( is_multisite() ) ? 1 : 0;
106
-
107
- UM()->setup()->install_basics();
108
-
109
- $data['email'] = get_option( 'admin_email' );
110
- $data['unique_sitekey'] = get_option( '__ultimatemember_sitekey' );
111
-
112
- $this->data = $data;
113
-
114
- }
115
-
116
-
117
- /**
118
- * Check if tracking is allowed
119
- *
120
- * @return int
121
- */
122
- private function tracking_allowed() {
123
- if ( ! UM()->options()->get( 'allow_tracking' ) )
124
- return 0;
125
- return 1;
126
- }
127
-
128
-
129
- /**
130
- * Get last send time
131
- *
132
- * @return mixed|void
133
- */
134
- private function get_last_send() {
135
- return get_option( 'um_tracking_last_send' );
136
- }
137
-
138
-
139
- /**
140
- * Send a report
141
- *
142
- * @param bool $override
143
- */
144
- public function send_checkin( $override = false ) {
145
-
146
- if( ! $this->tracking_allowed() && ! $override )
147
- return;
148
-
149
- // Send a maximum of once per period
150
- $last_send = $this->get_last_send();
151
- if( $last_send && $last_send > strtotime( '-1 day' ) )
152
- return;
153
-
154
- $this->setup_data();
155
-
156
- if ( !get_option('__ultimatemember_coupon_sent') ) {
157
- $this->data['send_discount'] = 1;
158
- } else {
159
- $this->data['send_discount'] = 0;
160
- }
161
-
162
- $request = wp_remote_post( 'https://ultimatemember.com/?um_action=checkin', array(
163
- 'method' => 'POST',
164
- 'timeout' => 20,
165
- 'redirection' => 5,
166
- 'httpversion' => '1.0',
167
- 'blocking' => true,
168
- 'body' => $this->data,
169
- 'user-agent' => 'UM/' . ultimatemember_version . '; ' . get_bloginfo( 'url' ),
170
- ) );
171
-
172
- update_option( 'um_tracking_last_send', time() );
173
- update_option( '__ultimatemember_coupon_sent', 1 );
174
- }
175
-
176
-
177
- /**
178
- * Run a scheduled report
179
- */
180
- private function schedule_send() {
181
- add_action( 'um_daily_scheduled_events', array( $this, 'send_checkin' ) );
182
- }
183
-
184
- }
185
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/core/class-user.php CHANGED
@@ -1360,6 +1360,10 @@ if ( ! class_exists( 'um\core\User' ) ) {
1360
  function delete( $send_mail = true ) {
1361
 
1362
  $this->send_mail_on_delete = $send_mail;
 
 
 
 
1363
 
1364
  $this->delete_user_handler( um_user( 'ID' ) );
1365
 
@@ -1463,6 +1467,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
1463
  function get_admin_actions() {
1464
  $items = array();
1465
  $actions = array();
 
1466
  /**
1467
  * UM hook
1468
  *
@@ -1484,12 +1489,16 @@ if ( ! class_exists( 'um\core\User' ) ) {
1484
  * }
1485
  * ?>
1486
  */
1487
- $actions = apply_filters('um_admin_user_actions_hook', $actions );
1488
- if ( !isset( $actions ) || empty( $actions ) ) return false;
1489
- foreach($actions as $id => $arr ) {
1490
- $url = add_query_arg('um_action', $id );
1491
- $url = add_query_arg('uid', um_profile_id(), $url );
1492
- $items[] = '<a href="' . $url .'" class="real_url '.$id.'-item">' . $arr['label'] . '</a>';
 
 
 
 
1493
  }
1494
  return $items;
1495
  }
@@ -1648,18 +1657,12 @@ if ( ! class_exists( 'um\core\User' ) ) {
1648
  */
1649
  $changes = apply_filters('um_before_update_profile', $changes, $this->id );
1650
 
1651
- // save or update profile meta
1652
  foreach ( $changes as $key => $value ) {
1653
  if ( ! in_array( $key, $this->update_user_keys ) ) {
1654
-
1655
  update_user_meta( $this->id, $key, $value );
1656
-
1657
  } else {
1658
-
1659
- $args[$key] = esc_attr( $changes[$key] );
1660
-
1661
  }
1662
-
1663
  }
1664
 
1665
 
1360
  function delete( $send_mail = true ) {
1361
 
1362
  $this->send_mail_on_delete = $send_mail;
1363
+ //don't send email notification to not approved user
1364
+ if ( 'approved' != um_user( 'account_status' ) ) {
1365
+ $this->send_mail_on_delete = false;
1366
+ }
1367
 
1368
  $this->delete_user_handler( um_user( 'ID' ) );
1369
 
1467
  function get_admin_actions() {
1468
  $items = array();
1469
  $actions = array();
1470
+
1471
  /**
1472
  * UM hook
1473
  *
1489
  * }
1490
  * ?>
1491
  */
1492
+ $actions = apply_filters( 'um_admin_user_actions_hook', $actions );
1493
+ if ( ! isset( $actions ) || empty( $actions ) ) {
1494
+ return false;
1495
+ }
1496
+
1497
+ foreach ( $actions as $id => $arr ) {
1498
+ $url = add_query_arg( array( 'um_action' => $id, 'uid' => um_profile_id() ) );
1499
+ /*$url = add_query_arg( 'um_action', $id );
1500
+ $url = add_query_arg( 'uid', um_profile_id(), $url );*/
1501
+ $items[] = '<a href="' . $url .'" class="real_url ' . esc_attr( $id ) . '-item">' . $arr['label'] . '</a>';
1502
  }
1503
  return $items;
1504
  }
1657
  */
1658
  $changes = apply_filters('um_before_update_profile', $changes, $this->id );
1659
 
 
1660
  foreach ( $changes as $key => $value ) {
1661
  if ( ! in_array( $key, $this->update_user_keys ) ) {
 
1662
  update_user_meta( $this->id, $key, $value );
 
1663
  } else {
1664
+ $args[ $key ] = esc_attr( $changes[ $key ] );
 
 
1665
  }
 
1666
  }
1667
 
1668
 
includes/core/um-actions-core.php CHANGED
@@ -9,32 +9,34 @@ function um_action_request_process() {
9
  if ( is_admin() ) {
10
  return;
11
  }
 
12
  if ( ! is_user_logged_in() ) {
13
  return;
14
  }
 
15
  if ( ! isset( $_REQUEST['um_action'] ) ) {
16
  return;
17
  }
 
18
  if ( isset( $_REQUEST['uid'] ) && ! UM()->user()->user_exists_by_id( $_REQUEST['uid'] ) ) {
19
  return;
20
  }
21
-
22
  if ( isset( $_REQUEST['uid'] ) ) {
23
  if ( is_super_admin( $_REQUEST['uid'] ) ) {
24
- wp_die( __( 'Super administrators can not be modified.','ultimate-member' ) );
25
  }
26
  }
27
 
28
- if ( isset( $_REQUEST['um_action'] ) && $_REQUEST['um_action'] != "edit" && ! current_user_can( 'edit_users' ) ) {
29
- wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
30
- }
31
 
32
  if ( isset( $_REQUEST['uid'] ) ) {
33
  $uid = $_REQUEST['uid'];
34
  }
35
-
36
  switch ( $_REQUEST['um_action'] ) {
37
-
38
  default:
39
  $uid = isset( $_REQUEST['uid'] ) ? $_REQUEST['uid'] : 0;
40
  /**
@@ -59,63 +61,90 @@ function um_action_request_process() {
59
  */
60
  do_action( 'um_action_user_request_hook', $_REQUEST['um_action'], $uid );
61
  break;
62
-
63
  case 'edit':
64
  UM()->fields()->editing = true;
65
- if ( !um_can_edit_my_profile() ) {
66
- $url = um_edit_my_profile_cancel_uri();
67
- exit( wp_redirect( $url ) );
 
 
 
 
 
 
68
  }
69
  break;
70
-
71
  case 'um_switch_user':
72
- if ( !current_user_can('delete_users') ) {
73
  return;
74
  }
75
  UM()->user()->auto_login( $_REQUEST['uid'] );
76
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
77
  break;
78
-
79
  case 'um_reject_membership':
 
 
 
 
80
  um_fetch_user( $uid );
81
  UM()->user()->reject();
82
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
83
  break;
84
-
85
  case 'um_approve_membership':
86
  case 'um_reenable':
87
- um_fetch_user( $uid );
88
- UM()->user()->approve();
89
- exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
90
- break;
91
-
 
 
 
 
92
  case 'um_put_as_pending':
 
 
 
 
93
  um_fetch_user( $uid );
94
  UM()->user()->pending();
95
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
96
  break;
97
-
98
  case 'um_resend_activation':
 
 
 
 
99
  um_fetch_user( $uid );
100
  UM()->user()->email_pending();
101
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
102
  break;
103
-
104
  case 'um_deactivate':
 
 
 
 
105
  um_fetch_user( $uid );
106
  UM()->user()->deactivate();
107
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
108
  break;
109
-
110
  case 'um_delete':
111
  if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) {
112
- wp_die( __('You do not have permission to delete this user.','ultimate-member') );
113
  }
 
114
  um_fetch_user( $uid );
115
  UM()->user()->delete();
116
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
117
  break;
118
-
119
  }
120
  }
121
- add_action( 'init', 'um_action_request_process', 10 );
9
  if ( is_admin() ) {
10
  return;
11
  }
12
+
13
  if ( ! is_user_logged_in() ) {
14
  return;
15
  }
16
+
17
  if ( ! isset( $_REQUEST['um_action'] ) ) {
18
  return;
19
  }
20
+
21
  if ( isset( $_REQUEST['uid'] ) && ! UM()->user()->user_exists_by_id( $_REQUEST['uid'] ) ) {
22
  return;
23
  }
24
+
25
  if ( isset( $_REQUEST['uid'] ) ) {
26
  if ( is_super_admin( $_REQUEST['uid'] ) ) {
27
+ wp_die( __( 'Super administrators can not be modified.', 'ultimate-member' ) );
28
  }
29
  }
30
 
31
+ // if ( isset( $_REQUEST['um_action'] ) && $_REQUEST['um_action'] != "edit" && ! current_user_can( 'edit_users' ) ) {
32
+ // wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
33
+ // }
34
 
35
  if ( isset( $_REQUEST['uid'] ) ) {
36
  $uid = $_REQUEST['uid'];
37
  }
38
+
39
  switch ( $_REQUEST['um_action'] ) {
 
40
  default:
41
  $uid = isset( $_REQUEST['uid'] ) ? $_REQUEST['uid'] : 0;
42
  /**
61
  */
62
  do_action( 'um_action_user_request_hook', $_REQUEST['um_action'], $uid );
63
  break;
64
+
65
  case 'edit':
66
  UM()->fields()->editing = true;
67
+ if ( ! um_is_myprofile() ) {
68
+ if ( ! UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
69
+ exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
70
+ }
71
+ } else {
72
+ if ( ! um_can_edit_my_profile() ) {
73
+ $url = um_edit_my_profile_cancel_uri();
74
+ exit( wp_redirect( $url ) );
75
+ }
76
  }
77
  break;
78
+
79
  case 'um_switch_user':
80
+ if ( ! current_user_can( 'delete_users' ) ) {
81
  return;
82
  }
83
  UM()->user()->auto_login( $_REQUEST['uid'] );
84
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
85
  break;
86
+
87
  case 'um_reject_membership':
88
+ if ( ! current_user_can( 'manage_options' ) ) {
89
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
90
+ }
91
+
92
  um_fetch_user( $uid );
93
  UM()->user()->reject();
94
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
95
  break;
96
+
97
  case 'um_approve_membership':
98
  case 'um_reenable':
99
+ if ( ! current_user_can( 'manage_options' ) ) {
100
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
101
+ }
102
+
103
+ um_fetch_user( $uid );
104
+ UM()->user()->approve();
105
+ exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
106
+ break;
107
+
108
  case 'um_put_as_pending':
109
+ if ( ! current_user_can( 'manage_options' ) ) {
110
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
111
+ }
112
+
113
  um_fetch_user( $uid );
114
  UM()->user()->pending();
115
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
116
  break;
117
+
118
  case 'um_resend_activation':
119
+ if ( ! current_user_can( 'manage_options' ) ) {
120
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
121
+ }
122
+
123
  um_fetch_user( $uid );
124
  UM()->user()->email_pending();
125
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
126
  break;
127
+
128
  case 'um_deactivate':
129
+ if ( ! current_user_can( 'manage_options' ) ) {
130
+ wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
131
+ }
132
+
133
  um_fetch_user( $uid );
134
  UM()->user()->deactivate();
135
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
136
  break;
137
+
138
  case 'um_delete':
139
  if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) {
140
+ wp_die( __( 'You do not have permission to delete this user.', 'ultimate-member' ) );
141
  }
142
+
143
  um_fetch_user( $uid );
144
  UM()->user()->delete();
145
  exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
146
  break;
147
+
148
  }
149
  }
150
+ add_action( 'template_redirect', 'um_action_request_process', 10000 );
includes/core/um-actions-profile.php CHANGED
@@ -1064,113 +1064,104 @@ add_action( 'um_pre_profile_shortcode', 'um_pre_profile_shortcode' );
1064
  * @param $args
1065
  */
1066
  function um_add_edit_icon( $args ) {
1067
- $output = '';
1068
-
1069
- if (!is_user_logged_in()) return; // not allowed for guests
1070
-
1071
- if (isset( UM()->user()->cannot_edit ) && UM()->user()->cannot_edit == 1) return; // do not proceed if user cannot edit
1072
 
1073
- if (UM()->fields()->editing == true) {
1074
 
1075
- ?>
1076
 
1077
  <div class="um-profile-edit um-profile-headericon">
1078
-
1079
  <a href="#" class="um-profile-edit-a um-profile-save"><i class="um-faicon-check"></i></a>
1080
-
1081
  </div>
1082
 
1083
- <?php } else { ?>
1084
-
1085
- <div class="um-profile-edit um-profile-headericon">
1086
-
1087
- <a href="#" class="um-profile-edit-a"><i class="um-faicon-cog"></i></a>
1088
-
1089
- <?php
1090
-
1091
- $items = array(
1092
- 'editprofile' => '<a href="' . um_edit_profile_url() . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>',
1093
- 'myaccount' => '<a href="' . um_get_core_page( 'account' ) . '" class="real_url">' . __( 'My Account', 'ultimate-member' ) . '</a>',
1094
- 'logout' => '<a href="' . um_get_core_page( 'logout' ) . '" class="real_url">' . __( 'Logout', 'ultimate-member' ) . '</a>',
1095
- 'cancel' => '<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
1096
- );
1097
-
1098
- $cancel = $items['cancel'];
1099
-
1100
- if (!um_is_myprofile()) {
1101
-
1102
- $actions = UM()->user()->get_admin_actions();
1103
-
1104
- unset( $items['myaccount'] );
1105
- unset( $items['logout'] );
1106
- unset( $items['cancel'] );
1107
 
1108
- if (is_array( $actions )) {
1109
- $items = array_merge( $items, $actions );
1110
- }
1111
 
1112
- /**
1113
- * UM hook
1114
- *
1115
- * @type filter
1116
- * @title um_profile_edit_menu_items
1117
- * @description Edit menu items on profile page
1118
- * @input_vars
1119
- * [{"var":"$items","type":"array","desc":"User Menu"},
1120
- * {"var":"$user_id","type":"int","desc":"Profile ID"}]
1121
- * @change_log
1122
- * ["Since: 2.0"]
1123
- * @usage
1124
- * <?php add_filter( 'um_profile_edit_menu_items', 'function_name', 10, 2 ); ?>
1125
- * @example
1126
- * <?php
1127
- * add_filter( 'um_profile_edit_menu_items', 'my_profile_edit_menu_items', 10, 2 );
1128
- * function my_profile_edit_menu_items( $items, $user_id ) {
1129
- * // your code here
1130
- * return $items;
1131
- * }
1132
- * ?>
1133
- */
1134
- $items = apply_filters( 'um_profile_edit_menu_items', $items, um_profile_id() );
1135
 
1136
- $items['cancel'] = $cancel;
 
 
 
1137
 
1138
- } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1139
 
1140
- /**
1141
- * UM hook
1142
- *
1143
- * @type filter
1144
- * @title um_myprofile_edit_menu_items
1145
- * @description Edit menu items on my profile page
1146
- * @input_vars
1147
- * [{"var":"$items","type":"array","desc":"User Menu"}]
1148
- * @change_log
1149
- * ["Since: 2.0"]
1150
- * @usage
1151
- * <?php add_filter( 'um_myprofile_edit_menu_items', 'function_name', 10, 1 ); ?>
1152
- * @example
1153
- * <?php
1154
- * add_filter( 'um_myprofile_edit_menu_items', 'my_myprofile_edit_menu_items', 10, 1 );
1155
- * function my_myprofile_edit_menu_items( $items ) {
1156
- * // your code here
1157
- * return $items;
1158
- * }
1159
- * ?>
1160
- */
1161
- $items = apply_filters( 'um_myprofile_edit_menu_items', $items );
1162
 
1163
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1164
 
1165
- UM()->profile()->new_ui( $args['header_menu'], 'div.um-profile-edit', 'click', $items );
1166
 
1167
- ?>
1168
 
1169
- </div>
1170
 
1171
- <?php
1172
- }
1173
 
 
1174
  }
1175
  add_action( 'um_pre_header_editprofile', 'um_add_edit_icon' );
1176
 
@@ -1277,8 +1268,9 @@ add_action( 'um_after_profile_fields', 'um_add_submit_button_to_profile', 1000 )
1277
  * @param array $args
1278
  */
1279
  function um_profile_menu( $args ) {
1280
- if ( ! UM()->options()->get( 'profile_menu' ) )
1281
  return;
 
1282
 
1283
  // get active tabs
1284
  $tabs = UM()->profile()->tabs_active();
1064
  * @param $args
1065
  */
1066
  function um_add_edit_icon( $args ) {
1067
+ if ( ! is_user_logged_in() ) {
1068
+ // not allowed for guests
1069
+ return;
1070
+ }
 
1071
 
1072
+ // do not proceed if user cannot edit
1073
 
1074
+ if ( UM()->fields()->editing == true ) { ?>
1075
 
1076
  <div class="um-profile-edit um-profile-headericon">
 
1077
  <a href="#" class="um-profile-edit-a um-profile-save"><i class="um-faicon-check"></i></a>
 
1078
  </div>
1079
 
1080
+ <?php return;
1081
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1082
 
1083
+ if ( ! um_is_myprofile() ) {
 
 
1084
 
1085
+ if ( ! UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) && ! UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) {
1086
+ return;
1087
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1088
 
1089
+ $items = UM()->user()->get_admin_actions();
1090
+ if ( UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
1091
+ $items['editprofile'] = '<a href="' . um_edit_profile_url() . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>';
1092
+ }
1093
 
1094
+ /**
1095
+ * UM hook
1096
+ *
1097
+ * @type filter
1098
+ * @title um_profile_edit_menu_items
1099
+ * @description Edit menu items on profile page
1100
+ * @input_vars
1101
+ * [{"var":"$items","type":"array","desc":"User Menu"},
1102
+ * {"var":"$user_id","type":"int","desc":"Profile ID"}]
1103
+ * @change_log
1104
+ * ["Since: 2.0"]
1105
+ * @usage
1106
+ * <?php add_filter( 'um_profile_edit_menu_items', 'function_name', 10, 2 ); ?>
1107
+ * @example
1108
+ * <?php
1109
+ * add_filter( 'um_profile_edit_menu_items', 'my_profile_edit_menu_items', 10, 2 );
1110
+ * function my_profile_edit_menu_items( $items, $user_id ) {
1111
+ * // your code here
1112
+ * return $items;
1113
+ * }
1114
+ * ?>
1115
+ */
1116
+ $items = apply_filters( 'um_profile_edit_menu_items', $items, um_profile_id() );
1117
+
1118
+ $items['cancel'] = '<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>';
1119
 
1120
+ } else {
1121
+ $items = array(
1122
+ 'editprofile' => '<a href="' . um_edit_profile_url() . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>',
1123
+ 'myaccount' => '<a href="' . um_get_core_page( 'account' ) . '" class="real_url">' . __( 'My Account', 'ultimate-member' ) . '</a>',
1124
+ 'logout' => '<a href="' . um_get_core_page( 'logout' ) . '" class="real_url">' . __( 'Logout', 'ultimate-member' ) . '</a>',
1125
+ 'cancel' => '<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
1126
+ );
1127
+
1128
+ if ( ! empty( UM()->user()->cannot_edit ) ) {
1129
+ unset( $items['editprofile'] );
1130
+ }
 
 
 
 
 
 
 
 
 
 
 
1131
 
1132
+ /**
1133
+ * UM hook
1134
+ *
1135
+ * @type filter
1136
+ * @title um_myprofile_edit_menu_items
1137
+ * @description Edit menu items on my profile page
1138
+ * @input_vars
1139
+ * [{"var":"$items","type":"array","desc":"User Menu"}]
1140
+ * @change_log
1141
+ * ["Since: 2.0"]
1142
+ * @usage
1143
+ * <?php add_filter( 'um_myprofile_edit_menu_items', 'function_name', 10, 1 ); ?>
1144
+ * @example
1145
+ * <?php
1146
+ * add_filter( 'um_myprofile_edit_menu_items', 'my_myprofile_edit_menu_items', 10, 1 );
1147
+ * function my_myprofile_edit_menu_items( $items ) {
1148
+ * // your code here
1149
+ * return $items;
1150
+ * }
1151
+ * ?>
1152
+ */
1153
+ $items = apply_filters( 'um_myprofile_edit_menu_items', $items );
1154
+ } ?>
1155
 
1156
+ <div class="um-profile-edit um-profile-headericon">
1157
 
1158
+ <a href="#" class="um-profile-edit-a"><i class="um-faicon-cog"></i></a>
1159
 
1160
+ <?php UM()->profile()->new_ui( $args['header_menu'], 'div.um-profile-edit', 'click', $items ); ?>
1161
 
1162
+ </div>
 
1163
 
1164
+ <?php
1165
  }
1166
  add_action( 'um_pre_header_editprofile', 'um_add_edit_icon' );
1167
 
1268
  * @param array $args
1269
  */
1270
  function um_profile_menu( $args ) {
1271
+ if ( ! UM()->options()->get( 'profile_menu' ) ) {
1272
  return;
1273
+ }
1274
 
1275
  // get active tabs
1276
  $tabs = UM()->profile()->tabs_active();
includes/core/um-actions-wpadmin.php CHANGED
@@ -22,11 +22,8 @@ add_action( 'init', 'um_block_wpadmin_by_user_role', 99 );
22
  * @return bool
23
  */
24
  function um_control_admin_bar( $content ) {
25
- if ( is_user_logged_in() ) {
26
- if ( um_user( 'can_not_see_adminbar' ) ) {
27
- return false;
28
- }
29
- return true;
30
  }
31
 
32
  return $content;
22
  * @return bool
23
  */
24
  function um_control_admin_bar( $content ) {
25
+ if ( is_user_logged_in() && um_user( 'can_not_see_adminbar' ) ) {
26
+ return false;
 
 
 
27
  }
28
 
29
  return $content;
includes/core/um-filters-fields.php CHANGED
@@ -146,8 +146,9 @@ add_filter( 'um_profile_field_filter_hook___um_last_login', 'um_profile_field_fi
146
  * @return mixed|string|void
147
  */
148
  function um_profile_field_filter_hook__textarea( $value, $data ) {
149
- if ( isset( $data ) && isset( $data['html'] ) && $data['html'] == 1 )
150
  return $value;
 
151
 
152
  $value = esc_textarea( $value );
153
  $value = preg_replace('$(https?://[a-z0-9_./?=&#-]+)(?![^<>]*>)$i', ' <a href="$1" target="_blank">$1</a> ', $value." ");
@@ -612,10 +613,12 @@ function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) {
612
 
613
  if( 'text' == $type && ! in_array( $data['validate'], array( 'unique_email' ) ) || 'password' == $type ) {
614
  $value = esc_attr( $value );
615
- }elseif( $type == 'url' ) {
616
  $value = esc_url( $value );
617
- } elseif ( 'textarea' == $type ){
618
- $value = wp_kses_post( $value );
 
 
619
  }
620
  }
621
 
146
  * @return mixed|string|void
147
  */
148
  function um_profile_field_filter_hook__textarea( $value, $data ) {
149
+ if ( isset( $data['html'] ) && $data['html'] == 1 ) {
150
  return $value;
151
+ }
152
 
153
  $value = esc_textarea( $value );
154
  $value = preg_replace('$(https?://[a-z0-9_./?=&#-]+)(?![^<>]*>)$i', ' <a href="$1" target="_blank">$1</a> ', $value." ");
613
 
614
  if( 'text' == $type && ! in_array( $data['validate'], array( 'unique_email' ) ) || 'password' == $type ) {
615
  $value = esc_attr( $value );
616
+ } elseif( $type == 'url' ) {
617
  $value = esc_url( $value );
618
+ } elseif ( 'textarea' == $type ) {
619
+ if ( empty( $data['html'] ) ) {
620
+ $value = wp_kses_post( $value );
621
+ }
622
  }
623
  }
624
 
includes/core/um-filters-members.php CHANGED
@@ -124,7 +124,7 @@ function um_add_search_to_query( $query_args, $args ){
124
  if ( in_array( $field, array( 'members_page' ) ) ) continue;
125
 
126
  $serialize_value = serialize( strval( $value ) );
127
-
128
  if ( $value && $field != 'um_search' && $field != 'page_id' ) {
129
 
130
  if ( strstr( $field, 'role_' ) )
@@ -135,24 +135,58 @@ function um_add_search_to_query( $query_args, $args ){
135
  if ( 'role' == $field ) {
136
  $query_args['role__in'] = trim( $value );
137
  } else {
138
- $field_query = array(
139
- array(
140
- 'key' => $field,
141
- 'value' => trim( $value ),
142
- 'compare' => '=',
143
- ),
144
- array(
145
- 'key' => $field,
146
- 'value' => trim( $value ),
147
- 'compare' => 'LIKE',
148
- ),
149
- array(
150
- 'key' => $field,
151
- 'value' => trim( $serialize_value ),
152
- 'compare' => 'LIKE',
153
- ),
154
- 'relation' => 'OR',
155
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
  /**
158
  * UM hook
@@ -211,7 +245,7 @@ function um_add_search_to_query( $query_args, $args ){
211
  */
212
  $query_args = apply_filters( 'um_query_args_filter', $query_args );
213
 
214
- if ( count( $query_args['meta_query'] ) == 1 )
215
  unset( $query_args['meta_query'] );
216
 
217
  return $query_args;
@@ -472,17 +506,4 @@ function um_search_select_fields( $atts ) {
472
 
473
  return $atts;
474
  }
475
- add_filter( 'um_search_select_fields', 'um_search_select_fields' );
476
-
477
-
478
- /**
479
- * Filter gender query argument
480
- *
481
- * @param array $field_query
482
- * @return array
483
- */
484
- function um_query_args_gender__filter( $field_query ) {
485
- unset( $field_query[1] );
486
- return $field_query;
487
- }
488
- add_filter( 'um_query_args_gender__filter', 'um_query_args_gender__filter' );
124
  if ( in_array( $field, array( 'members_page' ) ) ) continue;
125
 
126
  $serialize_value = serialize( strval( $value ) );
127
+
128
  if ( $value && $field != 'um_search' && $field != 'page_id' ) {
129
 
130
  if ( strstr( $field, 'role_' ) )
135
  if ( 'role' == $field ) {
136
  $query_args['role__in'] = trim( $value );
137
  } else {
138
+ $filter_data = UM()->members()->prepare_filter( $field );
139
+ if ( $filter_data['type'] == 'select' ) {
140
+ $field_query = array(
141
+ array(
142
+ 'key' => $field,
143
+ 'value' => trim( $value ),
144
+ 'compare' => '=',
145
+ ),
146
+ 'relation' => 'OR',
147
+ );
148
+
149
+
150
+ $types = apply_filters( 'um_search_field_types', array(
151
+ 'multiselect',
152
+ 'radio',
153
+ 'checkbox'
154
+ ) );
155
+
156
+ if ( in_array( $filter_data['attrs']['type'], $types ) ) {
157
+ $field_query = array_merge( $field_query, array(
158
+ array(
159
+ 'key' => $field,
160
+ 'value' => serialize( strval( trim( $value ) ) ),
161
+ 'compare' => 'LIKE',
162
+ ),
163
+ array(
164
+ 'key' => $field,
165
+ 'value' => serialize( intval( trim( $value ) ) ),
166
+ 'compare' => 'LIKE',
167
+ )
168
+ ) );
169
+ }
170
+ } else {
171
+ $field_query = array(
172
+ array(
173
+ 'key' => $field,
174
+ 'value' => trim( $value ),
175
+ 'compare' => '=',
176
+ ),
177
+ array(
178
+ 'key' => $field,
179
+ 'value' => trim( $value ),
180
+ 'compare' => 'LIKE',
181
+ ),
182
+ array(
183
+ 'key' => $field,
184
+ 'value' => trim( $serialize_value ),
185
+ 'compare' => 'LIKE',
186
+ ),
187
+ 'relation' => 'OR',
188
+ );
189
+ }
190
 
191
  /**
192
  * UM hook
245
  */
246
  $query_args = apply_filters( 'um_query_args_filter', $query_args );
247
 
248
+ if ( isset( $query_args['meta_query'] ) && count( $query_args['meta_query'] ) == 1 )
249
  unset( $query_args['meta_query'] );
250
 
251
  return $query_args;
506
 
507
  return $atts;
508
  }
509
+ add_filter( 'um_search_select_fields', 'um_search_select_fields' );
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/core/um-filters-user.php CHANGED
@@ -9,49 +9,47 @@
9
  * @return null
10
  */
11
  function um_admin_user_actions_hook( $actions ) {
12
-
13
  $actions = null;
14
 
15
  um_fetch_user( um_profile_id() );
16
 
17
- if ( current_user_can('manage_options') ) {
18
-
19
- if ( um_user('account_status') == 'awaiting_admin_review' ){
20
- $actions['um_approve_membership'] = array( 'label' => __('Approve Membership','ultimate-member') );
21
- $actions['um_reject_membership'] = array( 'label' => __('Reject Membership','ultimate-member') );
22
- }
23
 
24
- if ( um_user('account_status') == 'rejected' ) {
25
- $actions['um_approve_membership'] = array( 'label' => __('Approve Membership','ultimate-member') );
 
26
  }
27
 
28
- if ( um_user('account_status') == 'approved' ) {
29
- $actions['um_put_as_pending'] = array( 'label' => __('Put as Pending Review','ultimate-member') );
30
  }
31
 
32
- if ( um_user('account_status') == 'awaiting_email_confirmation' ) {
33
- $actions['um_resend_activation'] = array( 'label' => __('Resend Activation E-mail','ultimate-member') );
34
  }
35
 
36
- if ( um_user('account_status') != 'inactive' ) {
37
- $actions['um_deactivate'] = array( 'label' => __('Deactivate this account','ultimate-member') );
38
  }
39
 
40
- if ( um_user('account_status') == 'inactive' ) {
41
- $actions['um_reenable'] = array( 'label' => __('Reactivate this account','ultimate-member') );
42
  }
43
 
44
- if ( UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) {
45
- $actions['um_delete'] = array( 'label' => __('Delete this user','ultimate-member') );
46
  }
47
 
48
  }
49
 
50
- if ( current_user_can('delete_users') ) {
51
- $actions['um_switch_user'] = array( 'label' => __('Login as this user','ultimate-member') );
52
  }
53
 
54
-
 
 
55
 
56
  return $actions;
57
  }
9
  * @return null
10
  */
11
  function um_admin_user_actions_hook( $actions ) {
 
12
  $actions = null;
13
 
14
  um_fetch_user( um_profile_id() );
15
 
16
+ //if ( UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
17
+ if ( current_user_can( 'manage_options' ) ) {
 
 
 
 
18
 
19
+ if ( um_user( 'account_status' ) == 'awaiting_admin_review' ) {
20
+ $actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
21
+ $actions['um_reject_membership'] = array( 'label' => __( 'Reject Membership', 'ultimate-member' ) );
22
  }
23
 
24
+ if ( um_user( 'account_status' ) == 'rejected' ) {
25
+ $actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
26
  }
27
 
28
+ if ( um_user( 'account_status' ) == 'approved' ) {
29
+ $actions['um_put_as_pending'] = array( 'label' => __( 'Put as Pending Review', 'ultimate-member' ) );
30
  }
31
 
32
+ if ( um_user( 'account_status' ) == 'awaiting_email_confirmation' ) {
33
+ $actions['um_resend_activation'] = array( 'label' => __( 'Resend Activation E-mail', 'ultimate-member' ) );
34
  }
35
 
36
+ if ( um_user( 'account_status' ) != 'inactive' ) {
37
+ $actions['um_deactivate'] = array( 'label' => __( 'Deactivate this account', 'ultimate-member' ) );
38
  }
39
 
40
+ if ( um_user( 'account_status' ) == 'inactive' ) {
41
+ $actions['um_reenable'] = array( 'label' => __( 'Reactivate this account', 'ultimate-member' ) );
42
  }
43
 
44
  }
45
 
46
+ if ( UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) {
47
+ $actions['um_delete'] = array( 'label' => __( 'Delete this user', 'ultimate-member' ) );
48
  }
49
 
50
+ if ( current_user_can( 'delete_users' ) ) {
51
+ $actions['um_switch_user'] = array( 'label' => __( 'Login as this user', 'ultimate-member' ) );
52
+ }
53
 
54
  return $actions;
55
  }
includes/um-short-functions.php CHANGED
@@ -705,10 +705,11 @@ function um_filtered_value( $key, $data = false ) {
705
  * @return bool|int|null
706
  */
707
  function um_profile_id() {
 
708
 
709
- if ( um_get_requested_user() ) {
710
  return um_get_requested_user();
711
- } else if (is_user_logged_in() && get_current_user_id()) {
712
  return get_current_user_id();
713
  }
714
 
@@ -1063,10 +1064,11 @@ function um_requesting_password_reset() {
1063
  * @return bool
1064
  */
1065
  function um_requesting_password_change() {
1066
- if (um_is_core_page( 'account' ) && isset( $_POST['_um_account'] ) == 1)
1067
  return true;
1068
- else if (isset( $_POST['_um_password_change'] ) && $_POST['_um_password_change'] == 1)
1069
  return true;
 
1070
 
1071
  return false;
1072
  }
@@ -1766,102 +1768,108 @@ function um_get_default_avatar_uri() {
1766
  * @return bool|string
1767
  */
1768
  function um_get_user_avatar_data( $user_id = '', $size = '96' ) {
1769
- if( empty( $user_id ) ) {
1770
- $user_id = um_user( 'ID' );
1771
- } else {
1772
- um_fetch_user( $user_id );
1773
- }
1774
 
1775
- $data = array(
1776
- 'user_id' => $user_id,
1777
- 'default' => um_get_default_avatar_uri(),
1778
- 'class' => 'gravatar avatar avatar-' . $size . ' um-avatar',
1779
- 'size' => $size
1780
- );
1781
 
1782
  if ( $profile_photo = um_profile( 'profile_photo' ) ) {
1783
  $data['url'] = um_get_avatar_uri( $profile_photo, $size );
1784
- $data['type'] = 'upload';
1785
- $data['class'] .= ' um-avatar-uploaded';
1786
- } else if( $synced_profile_photo = um_user( 'synced_profile_photo' ) ) {
1787
- $data['url'] = $synced_profile_photo;
1788
- $data['type'] = 'sync';
1789
- $data['class'] .= ' um-avatar-default';
1790
- } else if( UM()->options()->get( 'use_gravatars' ) ) {
1791
- $avatar_hash_id = get_user_meta( $user_id, 'synced_gravatar_hashed_id', true );
1792
- $data['url'] = set_url_scheme( '//gravatar.com/avatar/' . $avatar_hash_id );
1793
- $data['url'] = add_query_arg( 's', 400, $data['url'] );
1794
- $rating = get_option('avatar_rating');
1795
- if ( !empty( $rating ) ) {
1796
  $data['url'] = add_query_arg( 'r', $rating, $data['url'] );
1797
  }
1798
- $gravatar_type = UM()->options()->get( 'use_um_gravatar_default_builtin_image' );
1799
- if ( $gravatar_type == 'default' ) {
1800
- if ( UM()->options()->get( 'use_um_gravatar_default_image' ) ) {
1801
- $data['url'] = add_query_arg( 'd', $data['default'], $data['url'] );
1802
- }
1803
- } else {
1804
- $default = get_option( 'avatar_default', 'mystery' );
1805
- if ( $default == 'gravatar_default' ) {
1806
- $default = '';
1807
- }
1808
- $data['url'] = add_query_arg( 'd', $default, $data['url'] );
1809
- }
1810
- $data['type'] = 'gravatar';
1811
- $data['class'] .= ' um-avatar-gravatar';
1812
- } else {
1813
- $data['url'] = $data['default'];
1814
- $data['type'] = 'default';
1815
- $data['class'] .= ' um-avatar-default';
1816
- }
1817
 
1818
- /**
1819
- * UM hook
1820
- *
1821
- * @type filter
1822
- * @title um_user_avatar_url_filter
1823
- * @description Change user avatar URL
1824
- * @input_vars
1825
- * [{"var":"$avatar_uri","type":"string","desc":"Avatar URL"},
1826
- * {"var":"$user_id","type":"int","desc":"User ID"}]
1827
- * @change_log
1828
- * ["Since: 2.0"]
1829
- * @usage add_filter( 'um_user_avatar_url_filter', 'function_name', 10, 2 );
1830
- * @example
1831
- * <?php
1832
- * add_filter( 'um_user_avatar_url_filter', 'my_user_avatar_url', 10, 2 );
1833
- * function my_user_avatar_url( $avatar_uri ) {
1834
- * // your code here
1835
- * return $avatar_uri;
1836
- * }
1837
- * ?>
1838
- */
1839
- $data['url'] = apply_filters( 'um_user_avatar_url_filter', $data['url'], $user_id, $data );
1840
- /**
1841
- * UM hook
1842
- *
1843
- * @type filter
1844
- * @title um_avatar_image_alternate_text
1845
- * @description Change user display name on um_user function profile photo
1846
- * @input_vars
1847
- * [{"var":"$display_name","type":"string","desc":"User Display Name"}]
1848
- * @change_log
1849
- * ["Since: 2.0"]
1850
- * @usage add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 );
1851
- * @example
1852
- * <?php
1853
- * add_filter( 'um_avatar_image_alternate_text', 'my_avatar_image_alternate_text', 10, 1 );
1854
- * function my_avatar_image_alternate_text( $display_name ) {
1855
- * // your code here
1856
- * return $display_name;
1857
- * }
1858
- * ?>
1859
- */
1860
- $data['alt'] = apply_filters( "um_avatar_image_alternate_text", um_user( "display_name" ), $data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1861
 
1862
  return $data;
1863
  }
1864
 
 
1865
  /**
1866
  * get user avatar url
1867
  *
705
  * @return bool|int|null
706
  */
707
  function um_profile_id() {
708
+ $requested_user = um_get_requested_user();
709
 
710
+ if ( $requested_user ) {
711
  return um_get_requested_user();
712
+ } elseif ( is_user_logged_in() && get_current_user_id() ) {
713
  return get_current_user_id();
714
  }
715
 
1064
  * @return bool
1065
  */
1066
  function um_requesting_password_change() {
1067
+ if ( um_is_core_page( 'account' ) && isset( $_POST['_um_account'] ) == 1 & isset( $_POST['_um_account_tab'] ) == 'password' ) {
1068
  return true;
1069
+ } elseif ( isset( $_POST['_um_password_change'] ) && $_POST['_um_password_change'] == 1 ) {
1070
  return true;
1071
+ }
1072
 
1073
  return false;
1074
  }
1768
  * @return bool|string
1769
  */
1770
  function um_get_user_avatar_data( $user_id = '', $size = '96' ) {
1771
+ if( empty( $user_id ) ) {
1772
+ $user_id = um_user( 'ID' );
1773
+ } else {
1774
+ um_fetch_user( $user_id );
1775
+ }
1776
 
1777
+ $data = array(
1778
+ 'user_id' => $user_id,
1779
+ 'default' => um_get_default_avatar_uri(),
1780
+ 'class' => 'gravatar avatar avatar-' . $size . ' um-avatar',
1781
+ 'size' => $size
1782
+ );
1783
 
1784
  if ( $profile_photo = um_profile( 'profile_photo' ) ) {
1785
  $data['url'] = um_get_avatar_uri( $profile_photo, $size );
1786
+ $data['type'] = 'upload';
1787
+ $data['class'] .= ' um-avatar-uploaded';
1788
+ } elseif ( $synced_profile_photo = um_user( 'synced_profile_photo' ) ) {
1789
+ $data['url'] = $synced_profile_photo;
1790
+ $data['type'] = 'sync';
1791
+ $data['class'] .= ' um-avatar-default';
1792
+ } elseif ( UM()->options()->get( 'use_gravatars' ) ) {
1793
+ $avatar_hash_id = md5( um_user( 'user_email' ) );
1794
+ $data['url'] = set_url_scheme( '//gravatar.com/avatar/' . $avatar_hash_id );
1795
+ $data['url'] = add_query_arg( 's', 400, $data['url'] );
1796
+ $rating = get_option( 'avatar_rating' );
1797
+ if ( ! empty( $rating ) ) {
1798
  $data['url'] = add_query_arg( 'r', $rating, $data['url'] );
1799
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1800
 
1801
+ $gravatar_type = UM()->options()->get( 'use_um_gravatar_default_builtin_image' );
1802
+ if ( $gravatar_type == 'default' ) {
1803
+ if ( UM()->options()->get( 'use_um_gravatar_default_image' ) ) {
1804
+ $data['url'] = add_query_arg( 'd', $data['default'], $data['url'] );
1805
+ } else {
1806
+ $default = get_option( 'avatar_default', 'mystery' );
1807
+ if ( $default == 'gravatar_default' ) {
1808
+ $default = '';
1809
+ }
1810
+ $data['url'] = add_query_arg( 'd', $default, $data['url'] );
1811
+ }
1812
+ } else {
1813
+ $data['url'] = add_query_arg( 'd', $gravatar_type, $data['url'] );
1814
+ }
1815
+
1816
+ $data['type'] = 'gravatar';
1817
+ $data['class'] .= ' um-avatar-gravatar';
1818
+ } else {
1819
+ $data['url'] = $data['default'];
1820
+ $data['type'] = 'default';
1821
+ $data['class'] .= ' um-avatar-default';
1822
+ }
1823
+
1824
+
1825
+ /**
1826
+ * UM hook
1827
+ *
1828
+ * @type filter
1829
+ * @title um_user_avatar_url_filter
1830
+ * @description Change user avatar URL
1831
+ * @input_vars
1832
+ * [{"var":"$avatar_uri","type":"string","desc":"Avatar URL"},
1833
+ * {"var":"$user_id","type":"int","desc":"User ID"}]
1834
+ * @change_log
1835
+ * ["Since: 2.0"]
1836
+ * @usage add_filter( 'um_user_avatar_url_filter', 'function_name', 10, 2 );
1837
+ * @example
1838
+ * <?php
1839
+ * add_filter( 'um_user_avatar_url_filter', 'my_user_avatar_url', 10, 2 );
1840
+ * function my_user_avatar_url( $avatar_uri ) {
1841
+ * // your code here
1842
+ * return $avatar_uri;
1843
+ * }
1844
+ * ?>
1845
+ */
1846
+ $data['url'] = apply_filters( 'um_user_avatar_url_filter', $data['url'], $user_id, $data );
1847
+ /**
1848
+ * UM hook
1849
+ *
1850
+ * @type filter
1851
+ * @title um_avatar_image_alternate_text
1852
+ * @description Change user display name on um_user function profile photo
1853
+ * @input_vars
1854
+ * [{"var":"$display_name","type":"string","desc":"User Display Name"}]
1855
+ * @change_log
1856
+ * ["Since: 2.0"]
1857
+ * @usage add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 );
1858
+ * @example
1859
+ * <?php
1860
+ * add_filter( 'um_avatar_image_alternate_text', 'my_avatar_image_alternate_text', 10, 1 );
1861
+ * function my_avatar_image_alternate_text( $display_name ) {
1862
+ * // your code here
1863
+ * return $display_name;
1864
+ * }
1865
+ * ?>
1866
+ */
1867
+ $data['alt'] = apply_filters( "um_avatar_image_alternate_text", um_user( "display_name" ), $data );
1868
 
1869
  return $data;
1870
  }
1871
 
1872
+
1873
  /**
1874
  * get user avatar url
1875
  *
includes/widgets/class-um-search-widget.php CHANGED
@@ -26,7 +26,7 @@ class UM_Search_Widget extends \WP_Widget {
26
  __('Ultimate Member - Search', 'ultimate-member'),
27
 
28
  // Widget description
29
- array( 'description' => __( 'Shows users they follow in a widget.', 'ultimate-member' ), )
30
  );
31
 
32
  }
26
  __('Ultimate Member - Search', 'ultimate-member'),
27
 
28
  // Widget description
29
+ array( 'description' => __( 'Shows the search member form.', 'ultimate-member' ), )
30
  );
31
 
32
  }
readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link:
6
  Tags: community, member, membership, user-profile, user-registration
7
  Requires at least: 4.1
8
  Tested up to: 4.9
9
- Stable tag: 2.0.17
10
  License: GNU Version 2 or Any Later Version
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.txt
12
 
@@ -131,6 +131,51 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
131
 
132
  = Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin =
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  = 2.0.17: May 30, 2018 =
135
 
136
  * Enhancements:
6
  Tags: community, member, membership, user-profile, user-registration
7
  Requires at least: 4.1
8
  Tested up to: 4.9
9
+ Stable tag: 2.0.21
10
  License: GNU Version 2 or Any Later Version
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.txt
12
 
131
 
132
  = Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin =
133
 
134
+ = 2.0.21: July 9, 2018 =
135
+
136
+ * Bugfixes:
137
+ - Fixed search in members directory by User Tags field (other case)
138
+
139
+ = 2.0.20: July 6, 2018 =
140
+
141
+ * Bugfixes:
142
+ - Fixed search in members directory by User Tags field
143
+
144
+ = 2.0.19: July 5, 2018 =
145
+
146
+ * Bugfixes:
147
+ - Fixed few JS file's full versions
148
+ - Fixed search in members directory by multiselect/radio/checkbox field
149
+ - Fixed first activation role metadata reset
150
+
151
+ = 2.0.18: July 4, 2018 =
152
+
153
+ * Enhancements:
154
+ - Added an ability to create different email templates for each site on multisites installs
155
+ - Added major version notice
156
+ - Added an ability to make Profile Form visible for 2 or more roles
157
+ - Added ability to dismiss some UM notices
158
+ - Redesign some parts of field's conditional logic settings
159
+
160
+ * Bugfixes:
161
+ - Fixed PHP memory limit issue on some installs. Created pseudo-constructor
162
+ - Disabled email notification to user, which wasn't approved about delete their account
163
+ - Fixed profile tabs privacy
164
+ - Fixed default avatars and Gravatar displaying
165
+ - Fixed get current URL function
166
+ - Fixed admin bar displaying
167
+ - Fixed members directory search
168
+ - Fixed nav-menu items restriction handlers
169
+ - Fixed user displaying on multisite (added 404 error in some cases)
170
+ - Fixed XSS at wp-admin settings screen
171
+ - Fixed user's "user_login" permalinks
172
+ - Fixed user's capabilities ("Edit", "Delete" user) and profile actions displaying
173
+ - Fixed field's conditional logic
174
+ - Fixed issue with account button ID's duplicates
175
+
176
+ * Deprecated:
177
+ - REST API user's key option;
178
+
179
  = 2.0.17: May 30, 2018 =
180
 
181
  * Enhancements:
ultimate-member.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ultimate Member
4
  Plugin URI: http://ultimatemember.com/
5
  Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
6
- Version: 2.0.17
7
  Author: Ultimate Member
8
  Author URI: http://ultimatemember.com/
9
  Text Domain: ultimate-member
3
  Plugin Name: Ultimate Member
4
  Plugin URI: http://ultimatemember.com/
5
  Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
6
+ Version: 2.0.21
7
  Author: Ultimate Member
8
  Author URI: http://ultimatemember.com/
9
  Text Domain: ultimate-member