Ultimate Member – User Profile & Membership Plugin - Version 2.1.3

Version Description

Download this release

Release Info

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

Code changes from version 2.1.2 to 2.1.3

Files changed (67) hide show
  1. assets/css/um-account.css +26 -0
  2. assets/css/um-members.css +1 -1
  3. assets/img/extensions/profile-tabs.png +0 -0
  4. assets/js/um-account.js +31 -0
  5. assets/js/um-account.min.js +1 -1
  6. assets/js/um-conditional.js +6 -2
  7. assets/js/um-conditional.min.js +1 -1
  8. assets/js/um-members.js +151 -69
  9. assets/js/um-members.min.js +1 -1
  10. assets/js/um-modal.js +21 -22
  11. assets/js/um-modal.min.js +1 -1
  12. assets/js/um-scripts.js +90 -66
  13. assets/js/um-scripts.min.js +1 -1
  14. includes/admin/assets/css/um-admin-forms.css +94 -1
  15. includes/admin/assets/js/um-admin-forms.js +225 -11
  16. includes/admin/assets/js/um-admin-modal.js +2 -2
  17. includes/admin/core/class-admin-ajax-hooks.php +2 -0
  18. includes/admin/core/class-admin-builder.php +9 -9
  19. includes/admin/core/class-admin-enqueue.php +5 -0
  20. includes/admin/core/class-admin-forms.php +173 -3
  21. includes/admin/core/class-admin-metabox.php +20 -2
  22. includes/admin/core/class-admin-notices.php +11 -4
  23. includes/admin/core/class-admin-settings.php +333 -65
  24. includes/admin/core/class-admin-upgrade.php +3 -8
  25. includes/admin/core/packages/2.1.3-beta3/functions.php +147 -0
  26. includes/admin/core/packages/2.1.3-beta3/hooks.php +7 -0
  27. includes/admin/core/packages/2.1.3-beta3/init.php +93 -0
  28. includes/admin/templates/directory/search.php +0 -30
  29. includes/admin/templates/directory/sorting.php +11 -3
  30. includes/admin/templates/extensions.php +6 -0
  31. includes/class-config.php +3 -0
  32. includes/class-dependencies.php +2 -1
  33. includes/class-init.php +9 -3
  34. includes/core/class-builtin.php +15 -12
  35. includes/core/class-date-time.php +5 -5
  36. includes/core/class-enqueue.php +19 -4
  37. includes/core/class-fields.php +107 -86
  38. includes/core/class-files.php +69 -13
  39. includes/core/class-gdpr.php +10 -1
  40. includes/core/class-member-directory-meta.php +755 -0
  41. includes/core/class-member-directory.php +323 -156
  42. includes/core/class-password.php +2 -0
  43. includes/core/class-permalinks.php +8 -3
  44. includes/core/class-plugin-updater.php +18 -1
  45. includes/core/class-profile.php +11 -0
  46. includes/core/class-rewrite.php +20 -38
  47. includes/core/class-roles-capabilities.php +2 -2
  48. includes/core/class-setup.php +25 -0
  49. includes/core/class-shortcodes.php +2 -1
  50. includes/core/class-uploader.php +24 -14
  51. includes/core/class-user-posts.php +7 -1
  52. includes/core/class-user.php +151 -1
  53. includes/core/um-actions-account.php +113 -4
  54. includes/core/um-actions-profile.php +11 -9
  55. includes/core/um-filters-fields.php +2 -2
  56. includes/core/um-filters-members.php +0 -73
  57. includes/um-short-functions.php +13 -7
  58. languages/ultimate-member-en_US.mo +0 -0
  59. languages/ultimate-member-en_US.po +1488 -1329
  60. readme.txt +32 -1
  61. templates/members-grid.php +1 -1
  62. templates/members-header.php +2 -2
  63. templates/members-list.php +1 -1
  64. templates/members.php +29 -11
  65. templates/profile.php +1 -1
  66. templates/register.php +1 -1
  67. ultimate-member.php +1 -1
assets/css/um-account.css CHANGED
@@ -205,4 +205,30 @@
205
  color: #444;
206
  font-weight: bold;
207
  text-decoration: none !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  }
205
  color: #444;
206
  font-weight: bold;
207
  text-decoration: none !important;
208
+ }
209
+
210
+ .um-field-export_data .um-field-error {
211
+ display: none;
212
+ }
213
+
214
+ .um-field-export_data .um-field-area-response {
215
+ display: none;
216
+ line-height: 1.5;
217
+ padding: 10px 0;
218
+ }
219
+
220
+ .um-request-button {
221
+ display: inline-block;
222
+ background-color: #3ba1da;
223
+ border-radius: 5px;
224
+ color: #fff;
225
+ margin: 10px 0 0;
226
+ padding: 5px 10px;
227
+ text-decoration: none;
228
+ }
229
+
230
+ .um-request-button:hover {
231
+ background-color: #44b0ec;
232
+ color: #fff;
233
+ text-decoration: none;
234
  }
assets/css/um-members.css CHANGED
@@ -161,7 +161,7 @@ body #content .um-directory a {
161
  display: flex;
162
  flex-direction: row;
163
  justify-content: flex-start;
164
- align-items: baseline;
165
  flex-wrap: nowrap;
166
  width: 60%; }
167
  .um-directory .um-member-directory-header .um-member-directory-header-row .um-member-directory-search-line label {
161
  display: flex;
162
  flex-direction: row;
163
  justify-content: flex-start;
164
+ align-items: center;
165
  flex-wrap: nowrap;
166
  width: 60%; }
167
  .um-directory .um-member-directory-header .um-member-directory-header-row .um-member-directory-search-line label {
assets/img/extensions/profile-tabs.png ADDED
Binary file
assets/js/um-account.js CHANGED
@@ -64,4 +64,35 @@ jQuery(document).ready(function() {
64
 
65
  return false;
66
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  });
64
 
65
  return false;
66
  });
67
+
68
+
69
+ jQuery(document.body).on( 'click', '.um-request-button', function(e) {
70
+ e.preventDefault();
71
+
72
+ var request_action = jQuery(this).data('action');
73
+ var password = jQuery('#' + request_action).val();
74
+ jQuery('.um-field-area-response.' + request_action).hide();
75
+
76
+ if ( password === '' ) {
77
+ jQuery('.um-field-error.' + request_action).show();
78
+ } else {
79
+ jQuery('.um-field-error.' + request_action).hide();
80
+ var request = {
81
+ request_action: request_action,
82
+ password: password,
83
+ nonce: um_scripts.nonce
84
+ };
85
+ wp.ajax.send( 'um_request_user_data', {
86
+ data: request,
87
+ success: function (data) {
88
+ jQuery('.um-field-area-response.' + request_action).text( data.answer ).show();
89
+ },
90
+ error: function (data) {
91
+ console.log(data);
92
+ }
93
+ });
94
+ }
95
+
96
+ });
97
+
98
  });
assets/js/um-account.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){var a=jQuery(".um-account-main").attr("data-current_tab");a&&(jQuery('.um-account-tab[data-tab="'+a+'"]').show(),jQuery(".um-account-tab:not(:visible)").find("input:not(:disabled)").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0)),jQuery(document.body).on("click",".um-account-side li a",function(a){a.preventDefault();var t=jQuery(this);t.parents("ul").find("li a").removeClass("current"),t.addClass("current");var u=jQuery(this).attr("href"),e=jQuery(this).attr("data-tab");return jQuery('input[id="_um_account_tab"]:hidden').val(e),window.history.pushState("","",u),jQuery(".um-account-tab").hide(),jQuery('.um-account-tab[data-tab="'+e+'"]').fadeIn(),jQuery(".um-account-tab:visible").find("input.um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input:not(:disabled)").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-nav a").removeClass("current"),jQuery('.um-account-nav a[data-tab="'+e+'"]').addClass("current"),!1}),jQuery(document.body).on("click",".um-account-nav a",function(a){a.preventDefault();var t=jQuery(this).attr("data-tab"),u=jQuery(this).parents("div"),e=jQuery(this);return jQuery('input[id="_um_account_tab"]:hidden').val(t),jQuery(".um-account-tab").hide(),e.hasClass("current")?(u.next(".um-account-tab").slideUp(),e.removeClass("current")):(u.next(".um-account-tab").slideDown(),e.parents("div").find("a").removeClass("current"),e.addClass("current")),jQuery(".um-account-tab:visible").find("input.um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input:not(:disabled)").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-side li a").removeClass("current"),jQuery('.um-account-side li a[data-tab="'+t+'"]').addClass("current"),!1})});
1
+ jQuery(document).ready(function(){var a=jQuery(".um-account-main").attr("data-current_tab");a&&(jQuery('.um-account-tab[data-tab="'+a+'"]').show(),jQuery(".um-account-tab:not(:visible)").find("input:not(:disabled)").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0)),jQuery(document.body).on("click",".um-account-side li a",function(a){a.preventDefault();var t=jQuery(this);t.parents("ul").find("li a").removeClass("current"),t.addClass("current");var e=jQuery(this).attr("href"),u=jQuery(this).attr("data-tab");return jQuery('input[id="_um_account_tab"]:hidden').val(u),window.history.pushState("","",e),jQuery(".um-account-tab").hide(),jQuery('.um-account-tab[data-tab="'+u+'"]').fadeIn(),jQuery(".um-account-tab:visible").find("input.um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input:not(:disabled)").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-nav a").removeClass("current"),jQuery('.um-account-nav a[data-tab="'+u+'"]').addClass("current"),!1}),jQuery(document.body).on("click",".um-account-nav a",function(a){a.preventDefault();var t=jQuery(this).attr("data-tab"),e=jQuery(this).parents("div"),u=jQuery(this);return jQuery('input[id="_um_account_tab"]:hidden').val(t),jQuery(".um-account-tab").hide(),u.hasClass("current")?(e.next(".um-account-tab").slideUp(),u.removeClass("current")):(e.next(".um-account-tab").slideDown(),u.parents("div").find("a").removeClass("current"),u.addClass("current")),jQuery(".um-account-tab:visible").find("input.um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input:not(:disabled)").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-side li a").removeClass("current"),jQuery('.um-account-side li a[data-tab="'+t+'"]').addClass("current"),!1}),jQuery(document.body).on("click",".um-request-button",function(a){a.preventDefault();var t=jQuery(this).data("action"),e=jQuery("#"+t).val();if(jQuery(".um-field-area-response."+t).hide(),""===e)jQuery(".um-field-error."+t).show();else{jQuery(".um-field-error."+t).hide();var u={request_action:t,password:e,nonce:um_scripts.nonce};wp.ajax.send("um_request_user_data",{data:u,success:function(a){jQuery(".um-field-area-response."+t).text(a.answer).show()},error:function(a){console.log(a)}})}})});
assets/js/um-conditional.js CHANGED
@@ -35,9 +35,12 @@ function um_get_field_default_value( $dom ) {
35
  if ($dom.find('input[type=checkbox]:checked').length >= 1) {
36
 
37
  if ($dom.find('input[type=checkbox]:checked').length > 1) {
 
 
38
  $dom.find('input[type=checkbox]:checked').each(function () {
39
- default_value = default_value + jQuery(this).val() + ' ';
40
  });
 
41
  } else {
42
  default_value = $dom.find('input[type=checkbox]:checked').val();
43
  }
@@ -387,6 +390,7 @@ function um_field_restore_default_value( $dom ) {
387
 
388
  case 'checkbox':
389
 
 
390
  if ( $dom.find('input[type=checkbox]:checked').length >= 1 ) {
391
 
392
  $dom.find('input[type=checkbox]:checked').removeAttr('checked');
@@ -408,7 +412,7 @@ function um_field_restore_default_value( $dom ) {
408
  cbox_elem.closest('.um-field-checkbox').find('i').removeClass('um-icon-android-checkbox-outline-blank');
409
  cbox_elem.closest('.um-field-checkbox').find('i').addClass('um-icon-android-checkbox-outline');
410
  cbox_elem.closest('.um-field-checkbox').addClass('active');
411
- }
412
 
413
  }
414
 
35
  if ($dom.find('input[type=checkbox]:checked').length >= 1) {
36
 
37
  if ($dom.find('input[type=checkbox]:checked').length > 1) {
38
+ var arr_values = [];
39
+ arr_values.push( default_value );
40
  $dom.find('input[type=checkbox]:checked').each(function () {
41
+ arr_values.push( jQuery(this).val() );
42
  });
43
+ default_value = arr_values;
44
  } else {
45
  default_value = $dom.find('input[type=checkbox]:checked').val();
46
  }
390
 
391
  case 'checkbox':
392
 
393
+
394
  if ( $dom.find('input[type=checkbox]:checked').length >= 1 ) {
395
 
396
  $dom.find('input[type=checkbox]:checked').removeAttr('checked');
412
  cbox_elem.closest('.um-field-checkbox').find('i').removeClass('um-icon-android-checkbox-outline-blank');
413
  cbox_elem.closest('.um-field-checkbox').find('i').addClass('um-icon-android-checkbox-outline');
414
  cbox_elem.closest('.um-field-checkbox').addClass('active');
415
+ }
416
 
417
  }
418
 
assets/js/um-conditional.min.js CHANGED
@@ -1 +1 @@
1
- var arr_all_conditions=[],um_field_conditions={},um_field_default_values={};function um_get_field_default_value(e){var i="",n=um_get_field_type(e);switch(n){case"text":case"number":case"date":case"textarea":case"select":i=e.find("input:text,input[type=number],textarea,select").val();break;case"multiselect":i=e.find("select").val();break;case"radio":1<=e.find("input[type=radio]:checked").length&&(i=e.find("input[type=radio]:checked").val());break;case"checkbox":1<=e.find("input[type=checkbox]:checked").length&&(1<e.find("input[type=checkbox]:checked").length?e.find("input[type=checkbox]:checked").each(function(){i=i+jQuery(this).val()+" "}):i=e.find("input[type=checkbox]:checked").val())}return{type:n,value:i}}function um_get_field_element(e){switch(um_get_field_type(e)){case"text":case"number":case"date":case"textarea":case"select":case"multiselect":case"radio":case"checkbox":return e.find("input,textarea,select")}return""}function um_get_field_type(e){var n="",i=e.attr("class");return jQuery.each(i.split(" "),function(e,i){-1!=i.indexOf("um-field-type")&&(n=i.split("_")[1])}),n}function um_get_field_children(n){var t=[];return jQuery.each(arr_all_conditions,function(e,i){i.field.parent==n&&t.push(i.field.condition)}),t}function um_splitup_array(e,i){for(var n=e.length%i,t=n,a=Math.floor(e.length/i),u=[],o=0;o<e.length;o+=a){var r=a+o,d=!1;0!==n&&t&&(r++,t--,d=!0),u.push(e.slice(o,r)),d&&o++}var c=[];return jQuery.each(u,function(e,i){c.push({action:i[0],if_field:i[1],operator:i[2],value:i[3]})}),c}function um_get_field_data(e){return um_live_field=e.parents(".um-field").data("key"),um_live_value=e.val(),e.is(":checkbox")&&(um_live_value="",1<e.parents(".um-field").find("input:checked").length?e.parents(".um-field").find("input:checked").each(function(){um_live_value=um_live_value+jQuery(this).val()+" "}):1<=e.parents(".um-field").find("input:checked").length&&(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 um_in_array(e,i,n){var t,a=!1;n=!!n;for(t in i)if(n&&i[t]===e||!n&&i[t]==e){a=!0;break}return a}function um_apply_conditions(n,e){if(n.parents(".um-field[data-key]").length){var i=n.parents(".um-field[data-key]").data("key"),t=um_field_conditions[i];if(void 0!==t){var a=um_get_field_data(n),u={},o={},r={};jQuery.each(t,function(e,i){void 0===o[i.owner]&&(o[i.owner]=[],r[i.owner]={}),o[i.owner].push(i.value),r[i.owner]=i}),jQuery.each(t,function(e,i){void 0===u[i.owner]&&(u[i.owner]={}),"empty"==i.operator&&(!a||""==a&&um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"not empty"==i.operator&&(a&&""!=a&&!um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"equals to"==i.operator&&(i.value==a&&um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"not equals"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(a)!=parseInt(i.value)&&a&&!um_in_array(a,o[i.owner])?u[i.owner][e]=!0:i.value==a||um_in_array(a,o[i.owner])?u[i.owner][e]=!1:u[i.owner][e]=!0),"greater than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(a)>parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"less than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(a)<parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"contains"==i.operator&&("multiselect"==um_get_field_type(n.parents(".um-field[data-key]"))?a&&0<=a.indexOf(i.value)&&um_in_array(i.value,a)?u[i.owner][e]=!0:u[i.owner][e]=!1:"checkbox"==um_get_field_type(n.parents(".um-field[data-key]"))?a&&0<=a.indexOf(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1:a&&0<=a.indexOf(i.value)&&um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1)}),jQuery.each(u,function(e,i){um_in_array(!0,i)?um_field_apply_action(n,r[e],!0):um_field_apply_action(n,r[e],!1)}),n.trigger("um_fields_change")}}}function um_field_apply_action(e,i,n){var t=jQuery('div.um-field[data-key="'+i.owner+'"]');"show"==i.action&&n&&(t.show(),_show_in_ie(t),um_field_restore_default_value(t)),"show"!=i.action||n||(t.hide(),_hide_in_ie(t)),"hide"==i.action&&n&&(t.hide(),_hide_in_ie(t)),"hide"!=i.action||n||(t.show(),_show_in_ie(t),um_field_restore_default_value(t)),e.removeClass("um-field-has-changed")}function um_field_restore_default_value(t){var e=um_get_field_type(t),i=t.data("key"),n=um_field_default_values[i];switch(e){case"text":case"number":case"date":case"textarea":t.find("input:text,input[type=number],textareas").val(n.value);break;case"select":t.find("select").find("option").prop("selected",!1),t.find("select").val(n.value),t.find("select").trigger("change");break;case"multiselect":t.find("select").find("option").prop("selected",!1),jQuery.each(n.value,function(e,i){t.find("select").find('option[value="'+i+'"]').attr("selected",!0)}),t.find("select").trigger("change");break;case"checkbox":if(1<=t.find("input[type=checkbox]:checked").length)if(t.find("input[type=checkbox]:checked").removeAttr("checked"),t.find("span.um-field-checkbox-state i").removeClass("um-icon-android-checkbox-outline"),t.find("span.um-field-checkbox-state i").addClass("um-icon-android-checkbox-outline-blank"),t.find(".um-field-checkbox.active").removeClass("active"),jQuery.isArray(n.value))jQuery.each(n.value,function(e,i){var n=t.find('input[type=checkbox][value="'+i+'"]');n.attr("checked",!0),n.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),n.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),n.closest(".um-field-checkbox").addClass("active")});else{var a=t.find('input[type=checkbox][value="'+n.value+'"]');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")}break;case"radio":1<=t.find("input[type=radio]:checked").length&&setTimeout(function(){t.find("input[type=radio]:checked").removeAttr("checked"),t.find("span.um-field-radio-state i").removeClass("um-icon-android-radio-button-on"),t.find("span.um-field-radio-state i").addClass("um-icon-android-radio-button-off"),t.find(".um-field-radio.active").removeClass("active");var e=t.find("input[type=radio][value='"+n.value+"']");e.attr("checked",!0),e.closest(".um-field-radio").find("i").removeClass("um-icon-android-radio-button-off"),e.closest(".um-field-radio").find("i").addClass("um-icon-android-radio-button-on"),e.closest(".um-field-radio").addClass("active")},100)}if(!t.hasClass("um-field-has-changed")){var u=um_get_field_element(t);"radio"!=e&&"checkbox"!=e||(u=u.find(":checked")),u&&(u.trigger("change"),t.addClass("um-field-has-changed"))}}function um_field_hide_siblings(){jQuery.each(um_field_conditions,function(e,i){(1<=jQuery('.um-field[data-key="'+e+'"]:hidden').length||"none"==jQuery('.um-field[data-key="'+e+'"]').css("display"))&&jQuery.each(i,function(e,i){jQuery('.um-field[data-key="'+i.owner+'"]').hide()})})}function _hide_in_ie(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"hidden"})}function _show_in_ie(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"visible"})}function um_init_field_conditions(){var e=[];jQuery(".um-field[data-key]").each(function(){var t=jQuery(this).data("key");e.push(t);var u={};jQuery.each(jQuery(this)[0].attributes,function(e,i){if(-1!=i.name.indexOf("data-cond")){var n=i.name.slice(10),t=n.substring(1,0),a=n.slice(2);void 0===u[t]&&(u[t]={}),u[t][a]=i.value}}),jQuery.each(u,function(e,i){var n={field:{owner:t,action:i.action,parent:i.field,operator:i.operator,value:i.value,condition:{owner:t,action:i.action,operator:i.operator,value:i.value}}};arr_all_conditions.push(n)}),um_field_default_values[jQuery(this).data("key")]=um_get_field_default_value(jQuery(this))}),jQuery.each(e,function(e,i){um_field_conditions[i]=um_get_field_children(i)}),jQuery(".um-field[data-key]:visible").each(function(){var e=um_get_field_element(jQuery(this));void 0!==e.trigger&&e.trigger("change")})}jQuery(document).ready(function(){jQuery(document).on("change",'.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="text"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="number"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="password"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("um_fields_change",function(){um_field_hide_siblings(),um_field_hide_siblings()}),um_init_field_conditions()});
1
+ var arr_all_conditions=[],um_field_conditions={},um_field_default_values={};function um_get_field_default_value(e){var i="",n=um_get_field_type(e);switch(n){case"text":case"number":case"date":case"textarea":case"select":i=e.find("input:text,input[type=number],textarea,select").val();break;case"multiselect":i=e.find("select").val();break;case"radio":1<=e.find("input[type=radio]:checked").length&&(i=e.find("input[type=radio]:checked").val());break;case"checkbox":if(1<=e.find("input[type=checkbox]:checked").length)if(1<e.find("input[type=checkbox]:checked").length){var a=[];a.push(i),e.find("input[type=checkbox]:checked").each(function(){a.push(jQuery(this).val())}),i=a}else i=e.find("input[type=checkbox]:checked").val()}return{type:n,value:i}}function um_get_field_element(e){switch(um_get_field_type(e)){case"text":case"number":case"date":case"textarea":case"select":case"multiselect":case"radio":case"checkbox":return e.find("input,textarea,select")}return""}function um_get_field_type(e){var n="",i=e.attr("class");return jQuery.each(i.split(" "),function(e,i){-1!=i.indexOf("um-field-type")&&(n=i.split("_")[1])}),n}function um_get_field_children(n){var a=[];return jQuery.each(arr_all_conditions,function(e,i){i.field.parent==n&&a.push(i.field.condition)}),a}function um_splitup_array(e,i){for(var n=e.length%i,a=n,t=Math.floor(e.length/i),u=[],r=0;r<e.length;r+=t){var o=t+r,d=!1;0!==n&&a&&(o++,a--,d=!0),u.push(e.slice(r,o)),d&&r++}var c=[];return jQuery.each(u,function(e,i){c.push({action:i[0],if_field:i[1],operator:i[2],value:i[3]})}),c}function um_get_field_data(e){return um_live_field=e.parents(".um-field").data("key"),um_live_value=e.val(),e.is(":checkbox")&&(um_live_value="",1<e.parents(".um-field").find("input:checked").length?e.parents(".um-field").find("input:checked").each(function(){um_live_value=um_live_value+jQuery(this).val()+" "}):1<=e.parents(".um-field").find("input:checked").length&&(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 um_in_array(e,i,n){var a,t=!1;n=!!n;for(a in i)if(n&&i[a]===e||!n&&i[a]==e){t=!0;break}return t}function um_apply_conditions(n,e){if(n.parents(".um-field[data-key]").length){var i=n.parents(".um-field[data-key]").data("key"),a=um_field_conditions[i];if(void 0!==a){var t=um_get_field_data(n),u={},r={},o={};jQuery.each(a,function(e,i){void 0===r[i.owner]&&(r[i.owner]=[],o[i.owner]={}),r[i.owner].push(i.value),o[i.owner]=i}),jQuery.each(a,function(e,i){void 0===u[i.owner]&&(u[i.owner]={}),"empty"==i.operator&&(!t||""==t&&um_in_array(t,r[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"not empty"==i.operator&&(t&&""!=t&&!um_in_array(t,r[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"equals to"==i.operator&&(i.value==t&&um_in_array(t,r[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1),"not equals"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(t)!=parseInt(i.value)&&t&&!um_in_array(t,r[i.owner])?u[i.owner][e]=!0:i.value==t||um_in_array(t,r[i.owner])?u[i.owner][e]=!1:u[i.owner][e]=!0),"greater than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(t)>parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"less than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(t)<parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"contains"==i.operator&&("multiselect"==um_get_field_type(n.parents(".um-field[data-key]"))?t&&0<=t.indexOf(i.value)&&um_in_array(i.value,t)?u[i.owner][e]=!0:u[i.owner][e]=!1:"checkbox"==um_get_field_type(n.parents(".um-field[data-key]"))?t&&0<=t.indexOf(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1:t&&0<=t.indexOf(i.value)&&um_in_array(t,r[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1)}),jQuery.each(u,function(e,i){um_in_array(!0,i)?um_field_apply_action(n,o[e],!0):um_field_apply_action(n,o[e],!1)}),n.trigger("um_fields_change")}}}function um_field_apply_action(e,i,n){var a=jQuery('div.um-field[data-key="'+i.owner+'"]');"show"==i.action&&n&&(a.show(),_show_in_ie(a),um_field_restore_default_value(a)),"show"!=i.action||n||(a.hide(),_hide_in_ie(a)),"hide"==i.action&&n&&(a.hide(),_hide_in_ie(a)),"hide"!=i.action||n||(a.show(),_show_in_ie(a),um_field_restore_default_value(a)),e.removeClass("um-field-has-changed")}function um_field_restore_default_value(a){var e=um_get_field_type(a),i=a.data("key"),n=um_field_default_values[i];switch(e){case"text":case"number":case"date":case"textarea":a.find("input:text,input[type=number],textareas").val(n.value);break;case"select":a.find("select").find("option").prop("selected",!1),a.find("select").val(n.value),a.find("select").trigger("change");break;case"multiselect":a.find("select").find("option").prop("selected",!1),jQuery.each(n.value,function(e,i){a.find("select").find('option[value="'+i+'"]').attr("selected",!0)}),a.find("select").trigger("change");break;case"checkbox":if(1<=a.find("input[type=checkbox]:checked").length)if(a.find("input[type=checkbox]:checked").removeAttr("checked"),a.find("span.um-field-checkbox-state i").removeClass("um-icon-android-checkbox-outline"),a.find("span.um-field-checkbox-state i").addClass("um-icon-android-checkbox-outline-blank"),a.find(".um-field-checkbox.active").removeClass("active"),jQuery.isArray(n.value))jQuery.each(n.value,function(e,i){var n=a.find('input[type=checkbox][value="'+i+'"]');n.attr("checked",!0),n.closest(".um-field-checkbox").find("i").removeClass("um-icon-android-checkbox-outline-blank"),n.closest(".um-field-checkbox").find("i").addClass("um-icon-android-checkbox-outline"),n.closest(".um-field-checkbox").addClass("active")});else{var t=a.find('input[type=checkbox][value="'+n.value+'"]');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")}break;case"radio":1<=a.find("input[type=radio]:checked").length&&setTimeout(function(){a.find("input[type=radio]:checked").removeAttr("checked"),a.find("span.um-field-radio-state i").removeClass("um-icon-android-radio-button-on"),a.find("span.um-field-radio-state i").addClass("um-icon-android-radio-button-off"),a.find(".um-field-radio.active").removeClass("active");var e=a.find("input[type=radio][value='"+n.value+"']");e.attr("checked",!0),e.closest(".um-field-radio").find("i").removeClass("um-icon-android-radio-button-off"),e.closest(".um-field-radio").find("i").addClass("um-icon-android-radio-button-on"),e.closest(".um-field-radio").addClass("active")},100)}if(!a.hasClass("um-field-has-changed")){var u=um_get_field_element(a);"radio"!=e&&"checkbox"!=e||(u=u.find(":checked")),u&&(u.trigger("change"),a.addClass("um-field-has-changed"))}}function um_field_hide_siblings(){jQuery.each(um_field_conditions,function(e,i){(1<=jQuery('.um-field[data-key="'+e+'"]:hidden').length||"none"==jQuery('.um-field[data-key="'+e+'"]').css("display"))&&jQuery.each(i,function(e,i){jQuery('.um-field[data-key="'+i.owner+'"]').hide()})})}function _hide_in_ie(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"hidden"})}function _show_in_ie(e){void 0!==jQuery.browser&&jQuery.browser.msie&&e.css({visibility:"visible"})}function um_init_field_conditions(){var e=[];jQuery(".um-field[data-key]").each(function(){var a=jQuery(this).data("key");e.push(a);var u={};jQuery.each(jQuery(this)[0].attributes,function(e,i){if(-1!=i.name.indexOf("data-cond")){var n=i.name.slice(10),a=n.substring(1,0),t=n.slice(2);void 0===u[a]&&(u[a]={}),u[a][t]=i.value}}),jQuery.each(u,function(e,i){var n={field:{owner:a,action:i.action,parent:i.field,operator:i.operator,value:i.value,condition:{owner:a,action:i.action,operator:i.operator,value:i.value}}};arr_all_conditions.push(n)}),um_field_default_values[jQuery(this).data("key")]=um_get_field_default_value(jQuery(this))}),jQuery.each(e,function(e,i){um_field_conditions[i]=um_get_field_children(i)}),jQuery(".um-field[data-key]:visible").each(function(){var e=um_get_field_element(jQuery(this));void 0!==e.trigger&&e.trigger("change")})}jQuery(document).ready(function(){jQuery(document).on("change",'.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="text"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="number"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("input change",'.um-field input[type="password"]',function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on("um_fields_change",function(){um_field_hide_siblings(),um_field_hide_siblings()}),um_init_field_conditions()});
assets/js/um-members.js CHANGED
@@ -132,18 +132,32 @@ function um_members_hide_preloader( directory ) {
132
 
133
 
134
  function um_set_range_label( slider, ui ) {
135
- var placeholder = slider.siblings( '.um-slider-range' ).data( 'placeholder' );
136
-
137
- if( ui ) {
138
- placeholder = placeholder.replace( '\{min_range\}', ui.values[ 0 ] )
139
- .replace( '\{max_range\}', ui.values[ 1 ] )
140
- .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
141
- .data('label') );
 
 
 
 
 
 
 
 
142
  } else {
143
- placeholder = placeholder.replace( '\{min_range\}', slider.slider( "values", 0 ) )
144
- .replace( '\{max_range\}', slider.slider( "values", 1 ) )
145
- .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
146
- .data('label') );
 
 
 
 
 
 
147
  }
148
  slider.siblings( '.um-slider-range' ).html( placeholder );
149
 
@@ -320,7 +334,7 @@ function um_ajax_get_members( directory, args ) {
320
  }
321
 
322
  //args.directory = directory;
323
- jQuery( document ).trigger('um_members_rendered', args );
324
 
325
  um_init_new_dropdown();
326
 
@@ -500,11 +514,17 @@ function um_get_filters_data( directory ) {
500
  return;
501
  }
502
 
503
- filter_title = filter.find('div.um-slider-range').data('label');
 
 
 
 
 
 
 
 
504
 
505
- var filter_value_title = filter.find('div.um-slider-range').data( 'placeholder' ).replace( '\{min_range\}', filter_value_from )
506
- .replace( '\{max_range\}', filter_value_to )
507
- .replace( '\{field_label\}', filter.find('div.um-slider-range').data('label') );
508
 
509
  filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value_title, 'value':[filter_value_from, filter_value_to], 'type':filter_type} );
510
  }
@@ -559,16 +579,22 @@ function um_run_search( directory ) {
559
  directory.data( 'page', 1 );
560
  um_set_url_from_data( directory, 'page', '' );
561
 
562
- var show_after_search = directory.data('must-search');
563
- if ( show_after_search === 1 ) {
564
- var search = um_get_search( directory );
565
- if ( directory.find( '.um-members-filter-remove' ).length === 0 && ! search ) {
566
- directory.data( 'searched', 0 );
567
- directory.find('.um-members-grid, .um-members-list').remove();
568
- directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
569
- directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
570
- um_members_hide_preloader( directory );
571
- return;
 
 
 
 
 
 
572
  }
573
  }
574
 
@@ -1086,12 +1112,29 @@ jQuery(document.body).ready( function() {
1086
  } else if ( type === 'slider' ) {
1087
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1088
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
 
 
 
 
 
 
 
 
 
 
 
1089
  } else if ( type === 'datepicker' ) {
1090
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1091
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
 
 
 
1092
  } else if ( type === 'timepicker' ) {
1093
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1094
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
 
 
 
1095
  }
1096
 
1097
 
@@ -1108,16 +1151,21 @@ jQuery(document.body).ready( function() {
1108
  directory.find('.um-clear-filters').show();
1109
  }
1110
 
1111
- var show_after_search = directory.data('must-search');
1112
- if ( show_after_search === 1 ) {
1113
- var search = um_get_search( directory );
1114
- if ( directory.find( '.um-members-filter-remove' ).length === 0 && ! search ) {
1115
- directory.data( 'searched', 0 );
1116
- directory.find('.um-members-grid, .um-members-list').remove();
1117
- directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
1118
- directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
1119
- um_members_hide_preloader( directory );
1120
- return;
 
 
 
 
 
1121
  }
1122
  }
1123
 
@@ -1176,24 +1224,35 @@ jQuery(document.body).ready( function() {
1176
  }
1177
  select.select2('destroy').select2();
1178
 
 
 
 
 
1179
  } else if ( type === 'slider' ) {
1180
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1181
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
1182
 
1183
- jQuery( '.um-search-filter input[name="filter_' + filter_name + '_from"]' ).val('');
1184
- jQuery( '.um-search-filter input[name="filter_' + filter_name + '_to"]' ).val('');
 
 
 
 
 
 
 
1185
  } else if ( type === 'datepicker' ) {
1186
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1187
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
1188
 
1189
- jQuery( '.um-search-filter input[name="filter_' + filter_name + '_from"]' ).val('');
1190
- jQuery( '.um-search-filter input[name="filter_' + filter_name + '_to"]' ).val('');
1191
  } else if ( type === 'timepicker' ) {
1192
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1193
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
1194
 
1195
- jQuery( '.um-search-filter input[name="filter_' + filter_name + '_from"]' ).val('');
1196
- jQuery( '.um-search-filter input[name="filter_' + filter_name + '_to"]' ).val('');
1197
  }
1198
  });
1199
 
@@ -1211,16 +1270,21 @@ jQuery(document.body).ready( function() {
1211
  directory.find('.um-clear-filters').parents('.um-member-directory-header-row').removeClass( 'um-header-row-invisible' );
1212
  }
1213
 
1214
- var show_after_search = directory.data('must-search');
1215
- if ( show_after_search === 1 ) {
1216
- var search = um_get_search( directory );
1217
- if ( ! search ) {
1218
- directory.data( 'searched', 0 );
1219
- directory.find('.um-members-grid, .um-members-list').remove();
1220
- directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
1221
- directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
1222
- um_members_hide_preloader( directory );
1223
- return;
 
 
 
 
 
1224
  }
1225
  }
1226
 
@@ -1325,6 +1389,11 @@ jQuery(document.body).ready( function() {
1325
  elem.blur();
1326
  },
1327
  onSet: function( context ) {
 
 
 
 
 
1328
  var directory = elem.parents('.um-directory');
1329
 
1330
  if ( um_is_directory_busy( directory ) ) {
@@ -1408,6 +1477,10 @@ jQuery(document.body).ready( function() {
1408
  onClose: function() { elem.blur(); },
1409
  onSet: function( context ) {
1410
 
 
 
 
 
1411
  var directory = elem.parents('.um-directory');
1412
 
1413
  if ( um_is_directory_busy( directory ) ) {
@@ -1486,12 +1559,17 @@ jQuery(document.body).ready( function() {
1486
 
1487
  });
1488
 
1489
- var show_after_search = directory.data('must-search');
1490
- if ( show_after_search === 1 ) {
1491
- var search = um_get_search( directory );
1492
- var filters_data = um_get_filters_data( directory );
1493
- if ( ! filters_data.length && ! search ) {
1494
- return;
 
 
 
 
 
1495
  }
1496
  }
1497
 
@@ -1611,17 +1689,21 @@ jQuery(document.body).ready( function() {
1611
  }
1612
  });
1613
 
1614
-
1615
- var show_after_search = directory.data('must-search');
1616
- if ( show_after_search === 1 ) {
1617
- var search = um_get_search( directory );
1618
- var filters_data = um_get_filters_data( directory );
1619
- if ( ! filters_data.length && ! search ) {
1620
- directory.data( 'searched', 0 );
1621
- um_members_hide_preloader( directory );
1622
- return;
1623
- } else {
1624
- directory.data( 'searched', 1 );
 
 
 
 
1625
  }
1626
  }
1627
 
132
 
133
 
134
  function um_set_range_label( slider, ui ) {
135
+ var placeholder = '';
136
+ var placeholder_s = slider.siblings( '.um-slider-range' ).data( 'placeholder-s' );
137
+ var placeholder_p = slider.siblings( '.um-slider-range' ).data( 'placeholder-p' );
138
+
139
+ if ( ui ) {
140
+ if ( ui.values[ 0 ] === ui.values[ 1 ] ) {
141
+ placeholder = placeholder_s.replace( '\{value\}', ui.values[ 0 ] )
142
+ .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
143
+ .data('label') );
144
+ } else {
145
+ placeholder = placeholder_p.replace( '\{min_range\}', ui.values[ 0 ] )
146
+ .replace( '\{max_range\}', ui.values[ 1 ] )
147
+ .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
148
+ .data('label') );
149
+ }
150
  } else {
151
+ if ( slider.slider( "values", 0 ) === slider.slider( "values", 1 ) ) {
152
+ placeholder = placeholder_s.replace( '\{value\}', slider.slider( "values", 0 ) )
153
+ .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
154
+ .data('label') );
155
+ } else {
156
+ placeholder = placeholder_p.replace( '\{min_range\}', slider.slider( "values", 0 ) )
157
+ .replace( '\{max_range\}', slider.slider( "values", 1 ) )
158
+ .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
159
+ .data('label') );
160
+ }
161
  }
162
  slider.siblings( '.um-slider-range' ).html( placeholder );
163
 
334
  }
335
 
336
  //args.directory = directory;
337
+ jQuery( document ).trigger('um_members_rendered', [ directory, answer ] );
338
 
339
  um_init_new_dropdown();
340
 
514
  return;
515
  }
516
 
517
+ var filter_value_title;
518
+ if ( filter_value_from === filter_value_to ) {
519
+ filter_value_title = filter.find('div.um-slider-range').data( 'placeholder-s' ).replace( '\{value\}', filter_value_from )
520
+ .replace( '\{field_label\}', filter.find('div.um-slider-range').data('label') );
521
+ } else {
522
+ filter_value_title = filter.find('div.um-slider-range').data( 'placeholder-p' ).replace( '\{min_range\}', filter_value_from )
523
+ .replace( '\{max_range\}', filter_value_to )
524
+ .replace( '\{field_label\}', filter.find('div.um-slider-range').data('label') );
525
+ }
526
 
527
+ filter_title = filter.find('div.um-slider-range').data('label');
 
 
528
 
529
  filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value_title, 'value':[filter_value_from, filter_value_to], 'type':filter_type} );
530
  }
579
  directory.data( 'page', 1 );
580
  um_set_url_from_data( directory, 'page', '' );
581
 
582
+
583
+ var ignore_after_search = false;
584
+ ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search );
585
+
586
+ if ( ! ignore_after_search ) {
587
+ var show_after_search = directory.data('must-search');
588
+ if ( show_after_search === 1 ) {
589
+ var search = um_get_search( directory );
590
+ if ( directory.find( '.um-members-filter-remove' ).length === 0 && ! search ) {
591
+ directory.data( 'searched', 0 );
592
+ directory.find('.um-members-grid, .um-members-list').remove();
593
+ directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
594
+ directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
595
+ um_members_hide_preloader( directory );
596
+ return;
597
+ }
598
  }
599
  }
600
 
1112
  } else if ( type === 'slider' ) {
1113
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1114
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
1115
+
1116
+
1117
+ var $slider = jQuery( '.um-search-filter #' + filter_name + '_min' ).siblings('.um-slider');
1118
+ var options = $slider.slider( 'option' );
1119
+
1120
+ $slider.slider( 'values', [ options.min, options.max ] );
1121
+
1122
+ jQuery( '.um-search-filter #' + filter_name + '_min' ).val('');
1123
+ jQuery( '.um-search-filter #' + filter_name + '_max' ).val('');
1124
+
1125
+ um_set_range_label( $slider );
1126
  } else if ( type === 'datepicker' ) {
1127
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1128
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
1129
+
1130
+ jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
1131
+ jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
1132
  } else if ( type === 'timepicker' ) {
1133
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1134
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
1135
+
1136
+ jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
1137
+ jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
1138
  }
1139
 
1140
 
1151
  directory.find('.um-clear-filters').show();
1152
  }
1153
 
1154
+ var ignore_after_search = false;
1155
+ ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search );
1156
+
1157
+ if ( ! ignore_after_search ) {
1158
+ var show_after_search = directory.data('must-search');
1159
+ if ( show_after_search === 1 ) {
1160
+ var search = um_get_search( directory );
1161
+ if ( directory.find( '.um-members-filter-remove' ).length === 0 && ! search ) {
1162
+ directory.data( 'searched', 0 );
1163
+ directory.find('.um-members-grid, .um-members-list').remove();
1164
+ directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
1165
+ directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
1166
+ um_members_hide_preloader( directory );
1167
+ return;
1168
+ }
1169
  }
1170
  }
1171
 
1224
  }
1225
  select.select2('destroy').select2();
1226
 
1227
+ if ( directory.find( '.um-search-filter select[data-um-parent="' + filter_name + '"]' ).length > 0 ) {
1228
+ select.trigger('change');
1229
+ }
1230
+
1231
  } else if ( type === 'slider' ) {
1232
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1233
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
1234
 
1235
+ var $slider = jQuery( '.um-search-filter #' + filter_name + '_min' ).siblings('.um-slider');
1236
+ var options = $slider.slider( 'option' );
1237
+
1238
+ $slider.slider( 'values', [ options.min, options.max ] );
1239
+
1240
+ jQuery( '.um-search-filter #' + filter_name + '_min' ).val('');
1241
+ jQuery( '.um-search-filter #' + filter_name + '_max' ).val('');
1242
+
1243
+ um_set_range_label( $slider );
1244
  } else if ( type === 'datepicker' ) {
1245
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1246
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
1247
 
1248
+ jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
1249
+ jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
1250
  } else if ( type === 'timepicker' ) {
1251
  um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
1252
  um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
1253
 
1254
+ jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
1255
+ jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
1256
  }
1257
  });
1258
 
1270
  directory.find('.um-clear-filters').parents('.um-member-directory-header-row').removeClass( 'um-header-row-invisible' );
1271
  }
1272
 
1273
+ var ignore_after_search = false;
1274
+ ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search );
1275
+
1276
+ if ( ! ignore_after_search ) {
1277
+ var show_after_search = directory.data('must-search');
1278
+ if ( show_after_search === 1 ) {
1279
+ var search = um_get_search( directory );
1280
+ if ( ! search ) {
1281
+ directory.data( 'searched', 0 );
1282
+ directory.find('.um-members-grid, .um-members-list').remove();
1283
+ directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
1284
+ directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
1285
+ um_members_hide_preloader( directory );
1286
+ return;
1287
+ }
1288
  }
1289
  }
1290
 
1389
  elem.blur();
1390
  },
1391
  onSet: function( context ) {
1392
+
1393
+ if ( ! context.select ) {
1394
+ return;
1395
+ }
1396
+
1397
  var directory = elem.parents('.um-directory');
1398
 
1399
  if ( um_is_directory_busy( directory ) ) {
1477
  onClose: function() { elem.blur(); },
1478
  onSet: function( context ) {
1479
 
1480
+ if ( ! context.select ) {
1481
+ return;
1482
+ }
1483
+
1484
  var directory = elem.parents('.um-directory');
1485
 
1486
  if ( um_is_directory_busy( directory ) ) {
1559
 
1560
  });
1561
 
1562
+ var ignore_after_search = false;
1563
+ ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search );
1564
+
1565
+ if ( ! ignore_after_search ) {
1566
+ var show_after_search = directory.data('must-search');
1567
+ if ( show_after_search === 1 ) {
1568
+ var search = um_get_search( directory );
1569
+ var filters_data = um_get_filters_data( directory );
1570
+ if ( ! filters_data.length && ! search ) {
1571
+ return;
1572
+ }
1573
  }
1574
  }
1575
 
1689
  }
1690
  });
1691
 
1692
+ var ignore_after_search = false;
1693
+ ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search );
1694
+
1695
+ if ( ! ignore_after_search ) {
1696
+ var show_after_search = directory.data('must-search');
1697
+ if ( show_after_search === 1 ) {
1698
+ var search = um_get_search( directory );
1699
+ var filters_data = um_get_filters_data( directory );
1700
+ if ( ! filters_data.length && ! search ) {
1701
+ directory.data( 'searched', 0 );
1702
+ um_members_hide_preloader( directory );
1703
+ return;
1704
+ } else {
1705
+ directory.data( 'searched', 1 );
1706
+ }
1707
  }
1708
  }
1709
 
assets/js/um-members.min.js CHANGED
@@ -1 +1 @@
1
- var um_members_directory_busy=[],um_member_directories=[],um_member_directory_last_data=[];function um_parse_current_url(){var t={},a=window.location.search.substring(1).split("&");return jQuery.each(a,function(e){var r=a[e].split("=");t[r[0]]=r[1]}),t}function um_get_data_for_directory(e,r){var t=um_members_get_hash(e),a={},i=um_parse_current_url();if(jQuery.each(i,function(e){-1!==e.indexOf("_"+t)&&""!==i[e]&&(a[e.replace("_"+t,"")]=i[e])}),r){if(void 0!==a[r])try{a[r]=decodeURIComponent(a[r])}catch(e){console.error(e)}return a[r]}return a}function um_set_url_from_data(e,r,t){var a=um_members_get_hash(e),i=um_get_data_for_directory(e),m={};jQuery.isArray(t)?(jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")):jQuery.isNumeric(t)||(t=t.split("||"),jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")),""!==t&&(m[r+"_"+a]=t),jQuery.each(i,function(e){r===e?""!==t&&(m[e+"_"+a]=t):m[e+"_"+a]=i[e]}),jQuery.each(um_member_directories,function(e){var r=um_member_directories[e];if(r!==a){var t=um_get_data_for_directory(jQuery('.um-directory[data-hash="'+r+'"]'));jQuery.each(t,function(e){m[e+"_"+r]=t[e]})}});var d=[];jQuery.each(m,function(e){d.push(e+"="+m[e])});var u="?"+(d=wp.hooks.applyFilters("um_member_directory_url_attrs",d)).join("&");"?"===u&&(u=""),window.history.pushState("string","UM Member Directory",window.location.origin+window.location.pathname+u)}function um_members_get_hash(e){return e.data("hash")}function um_is_directory_busy(e){var r=um_members_get_hash(e);return void 0!==um_members_directory_busy[r]&&um_members_directory_busy[r]}function um_members_show_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!0,e.find(".um-members-overlay").show()}function um_members_hide_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!1,e.find(".um-members-overlay").hide()}function um_set_range_label(e,r){var t=e.siblings(".um-slider-range").data("placeholder");t=r?t.replace("{min_range}",r.values[0]).replace("{max_range}",r.values[1]).replace("{field_label}",e.siblings(".um-slider-range").data("label")):t.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1)).replace("{field_label}",e.siblings(".um-slider-range").data("label")),e.siblings(".um-slider-range").html(t),e.siblings(".um_range_min").val(e.slider("values",0)),e.siblings(".um_range_max").val(e.slider("values",1))}function um_get_search(e){return e.find(".um-search-line").length?e.find(".um-search-line").val():""}function um_get_sort(e){return e.data("sorting")}function um_get_current_page(e){var r=e.data("page");return r&&void 0!==r||(r=1),r}function um_time_convert(e,r){var t=Math.floor(e/60),a=e%60;return 60<=a&&(a=0,24<=(t+=1)&&(t=0)),a<10&&(a="0"+a),t+":"+a}function um_ajax_get_members(s,t){var a=um_members_get_hash(s),e=um_get_current_page(s),r=um_get_search(s),i=um_get_sort(s),m=-(new Date).getTimezoneOffset()/60,_={directory_id:a,page:e,search:r,sorting:i,gmt_offset:m,post_refferer:s.data("base-post"),nonce:um_scripts.nonce};s.find(".um-search-filter").length&&s.find(".um-search-filter").each(function(){var e=jQuery(this);if(e.find(".um-slider").length){var r=e.find(".um-slider").data("field_name"),t=um_get_data_for_directory(s,"filter_"+r+"_from"),a=um_get_data_for_directory(s,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-datepicker-filter").length){r=e.find(".um-datepicker-filter").data("filter_name"),t=um_get_data_for_directory(s,"filter_"+r+"_from"),a=um_get_data_for_directory(s,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-timepicker-filter").length){r=e.find(".um-timepicker-filter").data("filter_name"),t=um_get_data_for_directory(s,"filter_"+r+"_from"),a=um_get_data_for_directory(s,"filter_"+r+"_to");if(void 0!==t)(i=1*(t=t.split(":"))[0])<10&&(i="0"+i),(d=1*t[1])<10&&(d="0"+d),t=i+":"+d+":00";if(void 0!==a){var i,m=a.split(":"),d=1*m[1];(i=1*m[0])<10&&(i="0"+i),d<10&&(d="0"+d),a=i+":"+d+":59"}void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find("select").length){r=e.find("select").attr("name");void 0!==(u=um_get_data_for_directory(s,"filter_"+r))&&(_[r]=u.split("||"))}else{var u;r=e.find('input[type="text"]').attr("name");void 0!==(u=um_get_data_for_directory(s,"filter_"+r))&&(_[r]=u)}}),_=wp.hooks.applyFilters("um_member_directory_filter_request",_),wp.ajax.send("um_get_members",{data:_,success:function(e){um_member_directory_last_data[a]=e,um_build_template(s,e);var r=wp.template("um-members-pagination");s.find(".um-members-pagination-box").html(r(e)),s.data("total_pages",e.pagination.total_pages),e.pagination.total_pages?(s.find(".um-member-directory-sorting-options").prop("disabled",!1),s.find(".um-member-directory-view-type").removeClass("um-disabled")):(s.find(".um-member-directory-sorting-options").prop("disabled",!0),s.find(".um-member-directory-view-type").addClass("um-disabled")),jQuery(document).trigger("um_members_rendered",t),um_init_new_dropdown(),um_members_hide_preloader(s)},error:function(e){console.log(e),um_members_hide_preloader(s)}})}function um_build_template(e,r){var t=e.data("view_type"),a=wp.template("um-member-"+t+"-"+um_members_get_hash(e));e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-members-wrapper").prepend(a(r.users));var i=wp.template("um-members-header");e.find(".um-members-intro").remove(),void 0!==r.is_search&&r.is_search&&e.find(".um-members-wrapper").prepend(i(r)),e.addClass("um-loaded"),e.find(".um-members.um-members-grid").length&&UM_Member_Grid(e.find(".um-members.um-members-grid")),jQuery(document).trigger("um_build_template",[e,r]),jQuery(window).trigger("resize"),init_tipsy()}function UM_Member_Grid(e){e.find(".um-member").length&&e.imagesLoaded(function(){e.masonry({itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"}).on("layoutComplete",function(e,r){jQuery(document).trigger("um_grid_initialized",[e,r])})})}function um_get_filters_data(s){var _=[];return s.find(".um-search-filter").each(function(){var t,a,d,i=jQuery(this);if(i.find("input.um-datepicker-filter").length)d="datepicker",i.find("input.um-datepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(s,"filter_"+e+"_from"),t=um_get_data_for_directory(s,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=s.find('input.um-datepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("input.um-timepicker-filter").length)d="timepicker",i.find("input.um-timepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(s,"filter_"+e+"_from"),t=um_get_data_for_directory(s,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=s.find('input.um-timepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("select").length){d="select",t=i.find("select").attr("name"),a=i.find("select").data("placeholder"),m=void 0===(m=um_get_data_for_directory(s,"filter_"+t))?[]:m.split("||"),jQuery.each(m,function(e){var r=i.find('select option[value="'+m[e]+'"]').data("value_label");_.push({name:t,label:a,value_label:r,value:m[e],type:d})})}else if(i.find('input[type="text"]').length){var m;d="text",t=i.find('input[type="text"]').attr("name"),a=i.find('input[type="text"]').attr("placeholder"),void 0===(m=um_get_data_for_directory(s,"filter_"+t))&&(m=""),""!=m&&_.push({name:t,label:a,value_label:m,value:m,type:d})}else if(i.find("div.ui-slider").length){d="slider",t=i.find("div.ui-slider").data("field_name");var e=um_get_data_for_directory(s,"filter_"+t+"_from"),r=um_get_data_for_directory(s,"filter_"+t+"_to");if(void 0===e&&void 0===r)return;a=i.find("div.um-slider-range").data("label");var u=i.find("div.um-slider-range").data("placeholder").replace("{min_range}",e).replace("{max_range}",r).replace("{field_label}",i.find("div.um-slider-range").data("label"));_.push({name:t,label:a,value_label:u,value:[e,r],type:d})}}),_}function um_change_tag(e){var r=um_get_filters_data(e);e.find(".um-members-filter-tag").remove();var t=e.find(".um-filtered-line");if(t.length){var a=wp.template("um-members-filtered-line");t.prepend(a({filters:r})),0===e.find(".um-members-filter-remove").length?(e.find(".um-clear-filters").hide(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(e.find(".um-clear-filters").show(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"))}}function um_run_search(e){if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=um_get_data_for_directory(e,"search");if((t=e.find(".um-search-line").val())===r||""===t&&void 0===r)um_members_hide_preloader(e);else{if(e.data("general_search",t),um_set_url_from_data(e,"search",t),e.data("page",1),um_set_url_from_data(e,"page",""),1===e.data("must-search")){var t=um_get_search(e);if(0===e.find(".um-members-filter-remove").length&&!t)return e.data("searched",0),e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),void um_members_hide_preloader(e)}e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}}jQuery(document.body).ready(function(){jQuery(".um-directory .um-search-filter select").each(function(){1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0),jQuery(this).select2("destroy").select2()}),jQuery(document.body).on("mouseover",".um-directory .um-member-directory-view-type",function(){if(!jQuery(this).hasClass("um-disabled")){var e=jQuery(this).find(".um-member-directory-view-type-a:visible");e.hide(),e.next().length?e.next().show().tipsy("show"):jQuery(this).find(".um-member-directory-view-type-a:first").show().tipsy("show")}}).on("mouseout",".um-directory .um-member-directory-view-type",function(){jQuery(this).hasClass("um-disabled")||(jQuery(this).find(".um-member-directory-view-type-a").hide().tipsy("hide"),jQuery(this).find('.um-member-directory-view-type-a[data-type="'+jQuery(this).parents(".um-directory").data("view_type")+'"]').show())}),jQuery(document.body).on("click",".um-directory .um-member-directory-view-type-a",function(){var e=jQuery(this).parents(".um-directory");if(um_is_directory_busy(e))return!1;var r=jQuery(this),t=r.parents(".um-member-directory-view-type");if(!t.hasClass("um-disabled")){um_members_show_preloader(e);var a=t.find(".um-member-directory-view-type-a:visible");a.hide(),a.next().length?a.next().show().tipsy("show"):t.find(".um-member-directory-view-type-a:first").show().tipsy("show");var i=um_member_directory_last_data[um_members_get_hash(e)];if(null!==i){var m=r.data("type");um_set_url_from_data(e,"view_type",m),e.data("view_type",m),um_build_template(e,i)}um_members_hide_preloader(e)}}),jQuery(document.body).on("click",".um-directory .um-do-search",function(){um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("keypress",".um-directory .um-search-line",function(e){13===e.which&&um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("click",".um-directory .um-member-directory-sorting-a .um-new-dropdown li a",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&1!==jQuery(this).data("selected")){um_members_show_preloader(e);var r=jQuery(this).data("value");e.data("sorting",r),um_set_url_from_data(e,"sort",r),um_ajax_get_members(e),jQuery(this).parents(".um-new-dropdown").find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),jQuery(this).data("selected",1).prop("data-selected",1).attr("data-selected",1),jQuery(this).parents(".um-member-directory-sorting-a").find("> a").html(jQuery(this).html())}}),jQuery(document.body).on("click",".um-directory .pagi:not(.current)",function(){if(!jQuery(this).hasClass("disabled")){var e,r=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(r))um_members_show_preloader(r),1===(e="first"===jQuery(this).data("page")?1:"prev"===jQuery(this).data("page")?1*r.data("page")-1:"next"===jQuery(this).data("page")?1*r.data("page")+1:"last"===jQuery(this).data("page")?parseInt(r.data("total_pages")):parseInt(jQuery(this).data("page")))?(r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass("disabled"),r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled")):(e===parseInt(r.data("total_pages"))?r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass("disabled"):r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled"),r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass("disabled")),r.find(".pagi").removeClass("current"),r.find('.pagi[data-page="'+e+'"]').addClass("current"),r.data("page",e),um_set_url_from_data(r,"page",1===e?"":e),um_ajax_get_members(r)}}),jQuery(document.body).on("change",".um-directory .um-members-pagi-dropdown",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=jQuery(this).val();e.find(".pagi").removeClass("current"),e.find('.pagi[data-page="'+r+'"]').addClass("current"),e.data("page",r),um_set_url_from_data(e,"page",1===r?"":r),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-more").hide(),r.find(".um-member-meta-main").slideDown(),r.find(".um-member-less").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-less").hide(),r.find(".um-member-meta-main").slideUp(),r.find(".um-member-more").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-more").hide(),r.find(".um-member-meta").slideDown(function(){UM_Member_Grid(t)}),r.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(t)},100),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(t)}),!1}),jQuery(".um-member-directory-filters-a").click(function(){var e=jQuery(this),r=e.parents(".um-directory").find(".um-search");r.is(":visible")?r.slideUp(250,function(){e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}):r.slideDown({duration:250,start:function(){jQuery(this).css({display:"grid"}),e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}})}),jQuery(document.body).on("change",".um-directory .um-search-filter select",function(){if(""!==jQuery(this).val()){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=jQuery(this).prop("name"),t=um_get_data_for_directory(e,"filter_"+r);t=void 0===t?[]:t.split("||"),-1===jQuery.inArray(jQuery(this).val(),t)&&(t.push(jQuery(this).val()),um_set_url_from_data(e,"filter_"+r,t=t.join("||")),e.data("page",1),um_set_url_from_data(e,"page","")),jQuery(this).find('option[value="'+jQuery(this).val()+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0),jQuery(this).select2("destroy").select2(),jQuery(this).val("").trigger("change"),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled")}}}),jQuery(document.body).on("blur",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){var r=jQuery(this).val(),t=jQuery(this).prop("name"),a=um_get_data_for_directory(e,"filter_"+t);void 0===a&&(a=""),r!==a&&(um_members_show_preloader(e),um_set_url_from_data(e,"filter_"+t,r),e.data("page",1),um_set_url_from_data(e,"page",""),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),jQuery(document.body).on("keypress",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(e){if(13===e.which){var r=jQuery(this).parents(".um-directory");if(um_is_directory_busy(r))return;var t=jQuery(this).val(),a=jQuery(this).prop("name"),i=um_get_data_for_directory(r,"filter_"+a);if(void 0===i&&(i=""),t===i)return;um_members_show_preloader(r),um_set_url_from_data(r,"filter_"+a,t),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}),jQuery(document.body).on("click",".um-directory .um-members-filter-remove",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&e){um_members_show_preloader(e);var r=jQuery(this).data("value"),t=jQuery(this).data("name"),a=jQuery(this).data("type");if("text"===a)um_set_url_from_data(e,"filter_"+t,""),jQuery('.um-search-filter input[name="'+t+'"]').val("");else if("select"===a){var i=um_get_data_for_directory(e,"filter_"+t);i=void 0===i?[]:i.split("||"),-1!==jQuery.inArray(r.toString(),i)&&(i=jQuery.grep(i,function(e){return e!==r.toString()})),i.length||(i=""),um_set_url_from_data(e,"filter_"+t,i);var m=jQuery('.um-search-filter select[name="'+t+'"]');m.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<m.find("option:not(:disabled)").length&&m.prop("disabled",!1),m.select2("destroy").select2(),0<e.find('.um-search-filter select[data-um-parent="'+t+'"]').length&&m.trigger("change")}else"slider"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to","")):"datepicker"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to","")):"timepicker"===a&&(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""));if(e.data("page",1),um_set_url_from_data(e,"page",""),jQuery(this).tipsy("hide"),jQuery(this).parents(".um-members-filter-tag").remove(),0===e.find(".um-members-filter-remove").length?e.find(".um-clear-filters").hide():e.find(".um-clear-filters").show(),1===e.data("must-search")){var d=um_get_search(e);if(0===e.find(".um-members-filter-remove").length&&!d)return e.data("searched",0),e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),void um_members_hide_preloader(e)}e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-clear-filters-a",function(){var m=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(m)){if(um_members_show_preloader(m),m.find(".um-members-filter-remove").each(function(){var r=jQuery(this).data("value"),e=jQuery(this).data("name"),t=jQuery(this).data("type");if("text"===t)um_set_url_from_data(m,"filter_"+e,""),jQuery('.um-search-filter input[name="'+e+'"]').val("");else if("select"===t){var a=um_get_data_for_directory(m,"filter_"+e);a=void 0===a?[]:a.split("||"),-1!==jQuery.inArray(r.toString(),a)&&(a=jQuery.grep(a,function(e){return e!==r.toString()})),a.length||(a=""),um_set_url_from_data(m,"filter_"+e,a);var i=jQuery('.um-search-filter select[name="'+e+'"]');i.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<i.find("option:not(:disabled)").length&&i.prop("disabled",!1),i.select2("destroy").select2()}else"slider"===t?(um_set_url_from_data(m,"filter_"+e+"_from",""),um_set_url_from_data(m,"filter_"+e+"_to",""),jQuery('.um-search-filter input[name="filter_'+e+'_from"]').val(""),jQuery('.um-search-filter input[name="filter_'+e+'_to"]').val("")):"datepicker"===t?(um_set_url_from_data(m,"filter_"+e+"_from",""),um_set_url_from_data(m,"filter_"+e+"_to",""),jQuery('.um-search-filter input[name="filter_'+e+'_from"]').val(""),jQuery('.um-search-filter input[name="filter_'+e+'_to"]').val("")):"timepicker"===t&&(um_set_url_from_data(m,"filter_"+e+"_from",""),um_set_url_from_data(m,"filter_"+e+"_to",""),jQuery('.um-search-filter input[name="filter_'+e+'_from"]').val(""),jQuery('.um-search-filter input[name="filter_'+e+'_to"]').val(""))}),m.data("page",1),um_set_url_from_data(m,"page",""),m.find(".um-members-filter-tag").remove(),0===m.find(".um-members-filter-remove").length?(m.find(".um-clear-filters").hide(),m.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(m.find(".um-clear-filters").show(),m.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible")),1===m.data("must-search"))if(!um_get_search(m))return m.data("searched",0),m.find(".um-members-grid, .um-members-list").remove(),m.find(".um-member-directory-sorting-options").prop("disabled",!0),m.find(".um-member-directory-view-type").addClass("um-disabled"),void um_members_hide_preloader(m);m.find(".um-member-directory-sorting-options").prop("disabled",!1),m.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(m)}}),jQuery(".um-directory").each(function(){var e=jQuery(this),r=um_members_get_hash(e);if(um_member_directories.push(r),e.find(".um-search").length&&(e.find(".um-search").is(":visible")||e.find(".um-search").css({display:"grid"}).slideUp(1)),e.find(".um-slider").each(function(){var e=jQuery(this),t=e.parents(".um-directory"),a=e.data("field_name"),r=um_get_data_for_directory(t,"filter_"+a+"_from"),i=um_get_data_for_directory(t,"filter_"+a+"_to");void 0===r&&(r=parseInt(e.data("min"))),void 0===i&&(i=parseInt(e.data("max")));var m=[r,i];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:m,create:function(e,r){},step:1,slide:function(e,r){um_set_range_label(jQuery(this),r)},stop:function(e,r){um_is_directory_busy(t)||(um_set_url_from_data(t,"filter_"+a+"_from",r.values[0]),um_set_url_from_data(t,"filter_"+a+"_to",r.values[1]),t.data("page",1),um_set_url_from_data(t,"page",""),um_ajax_get_members(t),um_change_tag(t),t.data("searched",1),t.find(".um-member-directory-sorting-options").prop("disabled",!1),t.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),um_set_range_label(e)}),e.find(".um-datepicker-filter").each(function(){var u=jQuery(this),s=new Date(1e3*u.data("date_min")),_=new Date(1e3*u.data("date_max")),e=u.pickadate({selectYears:!0,min:s,max:_,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){u.blur()},onClose:function(){u.blur()},onSet:function(e){var r=u.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=u.data("filter_name"),a=u.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");void 0===i&&(i=s/1e3),void 0===m&&(m=_/1e3);var d=e.select/1e3;u.val();"from"===a?i=d:"to"===a&&(m=d),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}).pickadate("picker"),r=u.data("filter_name"),t=u.data("range"),a=um_get_data_for_directory(u.parents(".um-directory"),"filter_"+r+"_"+t);void 0!==a&&e.set("select",1e3*a)}),e.find(".um-timepicker-filter").each(function(){var s=jQuery(this),_=s.attr("id"),o=s.data("filter_name"),n=s.attr("data-min"),l=s.attr("data-max"),e=n.split(":"),r=l.split(":"),t=s.pickatime({format:s.data("format"),interval:parseInt(s.data("intervals")),min:[e[0],e[1]],max:[r[0],r[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){s.blur()},onClose:function(){s.blur()},onSet:function(e){var r=s.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=s.data("filter_name"),a=s.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");if(void 0===i&&(i=n),void 0===m&&(m=l),void 0!==e.select){var d=um_time_convert(e.select,a);"from"===a?i=d:"to"===a&&(m=d)}else"from"===a?i=n:"to"===a&&(m=l);var u=jQuery("#"+_).val();"from"===s.data("range")?jQuery("#"+o+"_to").pickatime("picker").set("min",u):jQuery("#"+o+"_from").pickatime("picker").set("max",u),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}).pickatime("picker"),a=s.data("filter_name"),i=s.data("range"),m=um_get_data_for_directory(s.parents(".um-directory"),"filter_"+a+"_"+i);if(void 0!==m){var d=m.split(":");t.set("select",60*d[0]+1*d[1])}}),1===e.data("must-search")){var t=um_get_search(e);if(!um_get_filters_data(e).length&&!t)return}um_members_show_preloader(e),um_ajax_get_members(e,{first_load:!0}),um_change_tag(e)}),window.addEventListener("popstate",function(e){jQuery(".um-directory").each(function(){var d=jQuery(this),e=um_members_get_hash(d);(um_member_directories.push(e),um_members_show_preloader(d),d.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),d.find(".um-member-directory-search-line").length)&&(void 0===(m=um_get_data_for_directory(d,"search"))&&(m=""),d.data("general_search",m),d.find(".um-search-line").val(m));var r=um_get_data_for_directory(d,"page");if(void 0===r?r=1:r>d.data("total_pages")&&(r=d.data("total_pages")),d.data("page",r).attr("data-page",r),d.find(".um-member-directory-sorting").length){var t=um_get_data_for_directory(d,"sort");void 0===t&&(t=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a[data-default="1"]').data("value")),d.data("sorting",t);var a=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]');a.find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),a.find('a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),d.find(".um-member-directory-sorting-a").find("> a").html(a.find('a[data-value="'+t+'"]').html())}if(d.find(".um-member-directory-view-type").length){var i=um_get_data_for_directory(d,"view_type");void 0===i&&(i=d.find('.um-member-directory-view-type-a[data-default="1"]').data("type")),d.data("view_type",i),d.find(".um-member-directory-view-type .um-member-directory-view-type-a").hide(),d.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="'+i+'"]').show()}if(d.find(".um-datepicker-filter").each(function(){var e=jQuery(this),r=e.pickadate("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);void 0!==i?r.set("select",1e3*i):r.clear()}),d.find(".um-slider").each(function(){var e=jQuery(this),r=e.data("field_name"),t=um_get_data_for_directory(d,"filter_"+r+"_from"),a=um_get_data_for_directory(d,"filter_"+r+"_to");void 0===t&&(t=e.data("min")),t=parseInt(t),void 0===a&&(a=e.data("max")),a=parseInt(a),e.slider("values",[t,a]),um_set_range_label(e)}),d.find(".um-timepicker-filter").each(function(){var e=jQuery(this),r=e.pickatime("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);if(void 0!==i){var m=i.split(":");r.set("select",60*m[0])}else r.clear()}),1===d.data("must-search")){var m=um_get_search(d);if(!um_get_filters_data(d).length&&!m)return d.data("searched",0),void um_members_hide_preloader(d);d.data("searched",1)}um_ajax_get_members(d),um_change_tag(d)})})});
1
+ var um_members_directory_busy=[],um_member_directories=[],um_member_directory_last_data=[];function um_parse_current_url(){var t={},a=window.location.search.substring(1).split("&");return jQuery.each(a,function(e){var r=a[e].split("=");t[r[0]]=r[1]}),t}function um_get_data_for_directory(e,r){var t=um_members_get_hash(e),a={},i=um_parse_current_url();if(jQuery.each(i,function(e){-1!==e.indexOf("_"+t)&&""!==i[e]&&(a[e.replace("_"+t,"")]=i[e])}),r){if(void 0!==a[r])try{a[r]=decodeURIComponent(a[r])}catch(e){console.error(e)}return a[r]}return a}function um_set_url_from_data(e,r,t){var a=um_members_get_hash(e),i=um_get_data_for_directory(e),m={};jQuery.isArray(t)?(jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")):jQuery.isNumeric(t)||(t=t.split("||"),jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")),""!==t&&(m[r+"_"+a]=t),jQuery.each(i,function(e){r===e?""!==t&&(m[e+"_"+a]=t):m[e+"_"+a]=i[e]}),jQuery.each(um_member_directories,function(e){var r=um_member_directories[e];if(r!==a){var t=um_get_data_for_directory(jQuery('.um-directory[data-hash="'+r+'"]'));jQuery.each(t,function(e){m[e+"_"+r]=t[e]})}});var d=[];jQuery.each(m,function(e){d.push(e+"="+m[e])});var u="?"+(d=wp.hooks.applyFilters("um_member_directory_url_attrs",d)).join("&");"?"===u&&(u=""),window.history.pushState("string","UM Member Directory",window.location.origin+window.location.pathname+u)}function um_members_get_hash(e){return e.data("hash")}function um_is_directory_busy(e){var r=um_members_get_hash(e);return void 0!==um_members_directory_busy[r]&&um_members_directory_busy[r]}function um_members_show_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!0,e.find(".um-members-overlay").show()}function um_members_hide_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!1,e.find(".um-members-overlay").hide()}function um_set_range_label(e,r){var t="",a=e.siblings(".um-slider-range").data("placeholder-s"),i=e.siblings(".um-slider-range").data("placeholder-p");t=r?r.values[0]===r.values[1]?a.replace("{value}",r.values[0]).replace("{field_label}",e.siblings(".um-slider-range").data("label")):i.replace("{min_range}",r.values[0]).replace("{max_range}",r.values[1]).replace("{field_label}",e.siblings(".um-slider-range").data("label")):e.slider("values",0)===e.slider("values",1)?a.replace("{value}",e.slider("values",0)).replace("{field_label}",e.siblings(".um-slider-range").data("label")):i.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1)).replace("{field_label}",e.siblings(".um-slider-range").data("label")),e.siblings(".um-slider-range").html(t),e.siblings(".um_range_min").val(e.slider("values",0)),e.siblings(".um_range_max").val(e.slider("values",1))}function um_get_search(e){return e.find(".um-search-line").length?e.find(".um-search-line").val():""}function um_get_sort(e){return e.data("sorting")}function um_get_current_page(e){var r=e.data("page");return r&&void 0!==r||(r=1),r}function um_time_convert(e,r){var t=Math.floor(e/60),a=e%60;return 60<=a&&(a=0,24<=(t+=1)&&(t=0)),a<10&&(a="0"+a),t+":"+a}function um_ajax_get_members(s,e){var t=um_members_get_hash(s),r=um_get_current_page(s),a=um_get_search(s),i=um_get_sort(s),m=-(new Date).getTimezoneOffset()/60,_={directory_id:t,page:r,search:a,sorting:i,gmt_offset:m,post_refferer:s.data("base-post"),nonce:um_scripts.nonce};s.find(".um-search-filter").length&&s.find(".um-search-filter").each(function(){var e=jQuery(this);if(e.find(".um-slider").length){var r=e.find(".um-slider").data("field_name"),t=um_get_data_for_directory(s,"filter_"+r+"_from"),a=um_get_data_for_directory(s,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-datepicker-filter").length){r=e.find(".um-datepicker-filter").data("filter_name"),t=um_get_data_for_directory(s,"filter_"+r+"_from"),a=um_get_data_for_directory(s,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-timepicker-filter").length){r=e.find(".um-timepicker-filter").data("filter_name"),t=um_get_data_for_directory(s,"filter_"+r+"_from"),a=um_get_data_for_directory(s,"filter_"+r+"_to");if(void 0!==t)(i=1*(t=t.split(":"))[0])<10&&(i="0"+i),(d=1*t[1])<10&&(d="0"+d),t=i+":"+d+":00";if(void 0!==a){var i,m=a.split(":"),d=1*m[1];(i=1*m[0])<10&&(i="0"+i),d<10&&(d="0"+d),a=i+":"+d+":59"}void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find("select").length){r=e.find("select").attr("name");void 0!==(u=um_get_data_for_directory(s,"filter_"+r))&&(_[r]=u.split("||"))}else{var u;r=e.find('input[type="text"]').attr("name");void 0!==(u=um_get_data_for_directory(s,"filter_"+r))&&(_[r]=u)}}),_=wp.hooks.applyFilters("um_member_directory_filter_request",_),wp.ajax.send("um_get_members",{data:_,success:function(e){um_member_directory_last_data[t]=e,um_build_template(s,e);var r=wp.template("um-members-pagination");s.find(".um-members-pagination-box").html(r(e)),s.data("total_pages",e.pagination.total_pages),e.pagination.total_pages?(s.find(".um-member-directory-sorting-options").prop("disabled",!1),s.find(".um-member-directory-view-type").removeClass("um-disabled")):(s.find(".um-member-directory-sorting-options").prop("disabled",!0),s.find(".um-member-directory-view-type").addClass("um-disabled")),jQuery(document).trigger("um_members_rendered",[s,e]),um_init_new_dropdown(),um_members_hide_preloader(s)},error:function(e){console.log(e),um_members_hide_preloader(s)}})}function um_build_template(e,r){var t=e.data("view_type"),a=wp.template("um-member-"+t+"-"+um_members_get_hash(e));e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-members-wrapper").prepend(a(r.users));var i=wp.template("um-members-header");e.find(".um-members-intro").remove(),void 0!==r.is_search&&r.is_search&&e.find(".um-members-wrapper").prepend(i(r)),e.addClass("um-loaded"),e.find(".um-members.um-members-grid").length&&UM_Member_Grid(e.find(".um-members.um-members-grid")),jQuery(document).trigger("um_build_template",[e,r]),jQuery(window).trigger("resize"),init_tipsy()}function UM_Member_Grid(e){e.find(".um-member").length&&e.imagesLoaded(function(){e.masonry({itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"}).on("layoutComplete",function(e,r){jQuery(document).trigger("um_grid_initialized",[e,r])})})}function um_get_filters_data(s){var _=[];return s.find(".um-search-filter").each(function(){var t,a,d,i=jQuery(this);if(i.find("input.um-datepicker-filter").length)d="datepicker",i.find("input.um-datepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(s,"filter_"+e+"_from"),t=um_get_data_for_directory(s,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=s.find('input.um-datepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("input.um-timepicker-filter").length)d="timepicker",i.find("input.um-timepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(s,"filter_"+e+"_from"),t=um_get_data_for_directory(s,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=s.find('input.um-timepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("select").length){d="select",t=i.find("select").attr("name"),a=i.find("select").data("placeholder"),m=void 0===(m=um_get_data_for_directory(s,"filter_"+t))?[]:m.split("||"),jQuery.each(m,function(e){var r=i.find('select option[value="'+m[e]+'"]').data("value_label");_.push({name:t,label:a,value_label:r,value:m[e],type:d})})}else if(i.find('input[type="text"]').length){var m;d="text",t=i.find('input[type="text"]').attr("name"),a=i.find('input[type="text"]').attr("placeholder"),void 0===(m=um_get_data_for_directory(s,"filter_"+t))&&(m=""),""!=m&&_.push({name:t,label:a,value_label:m,value:m,type:d})}else if(i.find("div.ui-slider").length){d="slider",t=i.find("div.ui-slider").data("field_name");var e,r=um_get_data_for_directory(s,"filter_"+t+"_from"),u=um_get_data_for_directory(s,"filter_"+t+"_to");if(void 0===r&&void 0===u)return;e=r===u?i.find("div.um-slider-range").data("placeholder-s").replace("{value}",r).replace("{field_label}",i.find("div.um-slider-range").data("label")):i.find("div.um-slider-range").data("placeholder-p").replace("{min_range}",r).replace("{max_range}",u).replace("{field_label}",i.find("div.um-slider-range").data("label")),a=i.find("div.um-slider-range").data("label"),_.push({name:t,label:a,value_label:e,value:[r,u],type:d})}}),_}function um_change_tag(e){var r=um_get_filters_data(e);e.find(".um-members-filter-tag").remove();var t=e.find(".um-filtered-line");if(t.length){var a=wp.template("um-members-filtered-line");t.prepend(a({filters:r})),0===e.find(".um-members-filter-remove").length?(e.find(".um-clear-filters").hide(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(e.find(".um-clear-filters").show(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"))}}function um_run_search(e){if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=um_get_data_for_directory(e,"search");if((a=e.find(".um-search-line").val())===r||""===a&&void 0===r)um_members_hide_preloader(e);else{e.data("general_search",a),um_set_url_from_data(e,"search",a),e.data("page",1),um_set_url_from_data(e,"page","");var t=!1;if(!(t=wp.hooks.applyFilters("um_member_directory_ignore_after_search",t)))if(1===e.data("must-search")){var a=um_get_search(e);if(0===e.find(".um-members-filter-remove").length&&!a)return e.data("searched",0),e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),void um_members_hide_preloader(e)}e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}}jQuery(document.body).ready(function(){jQuery(".um-directory .um-search-filter select").each(function(){1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0),jQuery(this).select2("destroy").select2()}),jQuery(document.body).on("mouseover",".um-directory .um-member-directory-view-type",function(){if(!jQuery(this).hasClass("um-disabled")){var e=jQuery(this).find(".um-member-directory-view-type-a:visible");e.hide(),e.next().length?e.next().show().tipsy("show"):jQuery(this).find(".um-member-directory-view-type-a:first").show().tipsy("show")}}).on("mouseout",".um-directory .um-member-directory-view-type",function(){jQuery(this).hasClass("um-disabled")||(jQuery(this).find(".um-member-directory-view-type-a").hide().tipsy("hide"),jQuery(this).find('.um-member-directory-view-type-a[data-type="'+jQuery(this).parents(".um-directory").data("view_type")+'"]').show())}),jQuery(document.body).on("click",".um-directory .um-member-directory-view-type-a",function(){var e=jQuery(this).parents(".um-directory");if(um_is_directory_busy(e))return!1;var r=jQuery(this),t=r.parents(".um-member-directory-view-type");if(!t.hasClass("um-disabled")){um_members_show_preloader(e);var a=t.find(".um-member-directory-view-type-a:visible");a.hide(),a.next().length?a.next().show().tipsy("show"):t.find(".um-member-directory-view-type-a:first").show().tipsy("show");var i=um_member_directory_last_data[um_members_get_hash(e)];if(null!==i){var m=r.data("type");um_set_url_from_data(e,"view_type",m),e.data("view_type",m),um_build_template(e,i)}um_members_hide_preloader(e)}}),jQuery(document.body).on("click",".um-directory .um-do-search",function(){um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("keypress",".um-directory .um-search-line",function(e){13===e.which&&um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("click",".um-directory .um-member-directory-sorting-a .um-new-dropdown li a",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&1!==jQuery(this).data("selected")){um_members_show_preloader(e);var r=jQuery(this).data("value");e.data("sorting",r),um_set_url_from_data(e,"sort",r),um_ajax_get_members(e),jQuery(this).parents(".um-new-dropdown").find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),jQuery(this).data("selected",1).prop("data-selected",1).attr("data-selected",1),jQuery(this).parents(".um-member-directory-sorting-a").find("> a").html(jQuery(this).html())}}),jQuery(document.body).on("click",".um-directory .pagi:not(.current)",function(){if(!jQuery(this).hasClass("disabled")){var e,r=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(r))um_members_show_preloader(r),1===(e="first"===jQuery(this).data("page")?1:"prev"===jQuery(this).data("page")?1*r.data("page")-1:"next"===jQuery(this).data("page")?1*r.data("page")+1:"last"===jQuery(this).data("page")?parseInt(r.data("total_pages")):parseInt(jQuery(this).data("page")))?(r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass("disabled"),r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled")):(e===parseInt(r.data("total_pages"))?r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass("disabled"):r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled"),r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass("disabled")),r.find(".pagi").removeClass("current"),r.find('.pagi[data-page="'+e+'"]').addClass("current"),r.data("page",e),um_set_url_from_data(r,"page",1===e?"":e),um_ajax_get_members(r)}}),jQuery(document.body).on("change",".um-directory .um-members-pagi-dropdown",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=jQuery(this).val();e.find(".pagi").removeClass("current"),e.find('.pagi[data-page="'+r+'"]').addClass("current"),e.data("page",r),um_set_url_from_data(e,"page",1===r?"":r),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-more").hide(),r.find(".um-member-meta-main").slideDown(),r.find(".um-member-less").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-less").hide(),r.find(".um-member-meta-main").slideUp(),r.find(".um-member-more").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-more").hide(),r.find(".um-member-meta").slideDown(function(){UM_Member_Grid(t)}),r.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(t)},100),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(t)}),!1}),jQuery(".um-member-directory-filters-a").click(function(){var e=jQuery(this),r=e.parents(".um-directory").find(".um-search");r.is(":visible")?r.slideUp(250,function(){e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}):r.slideDown({duration:250,start:function(){jQuery(this).css({display:"grid"}),e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}})}),jQuery(document.body).on("change",".um-directory .um-search-filter select",function(){if(""!==jQuery(this).val()){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=jQuery(this).prop("name"),t=um_get_data_for_directory(e,"filter_"+r);t=void 0===t?[]:t.split("||"),-1===jQuery.inArray(jQuery(this).val(),t)&&(t.push(jQuery(this).val()),um_set_url_from_data(e,"filter_"+r,t=t.join("||")),e.data("page",1),um_set_url_from_data(e,"page","")),jQuery(this).find('option[value="'+jQuery(this).val()+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0),jQuery(this).select2("destroy").select2(),jQuery(this).val("").trigger("change"),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled")}}}),jQuery(document.body).on("blur",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){var r=jQuery(this).val(),t=jQuery(this).prop("name"),a=um_get_data_for_directory(e,"filter_"+t);void 0===a&&(a=""),r!==a&&(um_members_show_preloader(e),um_set_url_from_data(e,"filter_"+t,r),e.data("page",1),um_set_url_from_data(e,"page",""),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),jQuery(document.body).on("keypress",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(e){if(13===e.which){var r=jQuery(this).parents(".um-directory");if(um_is_directory_busy(r))return;var t=jQuery(this).val(),a=jQuery(this).prop("name"),i=um_get_data_for_directory(r,"filter_"+a);if(void 0===i&&(i=""),t===i)return;um_members_show_preloader(r),um_set_url_from_data(r,"filter_"+a,t),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}),jQuery(document.body).on("click",".um-directory .um-members-filter-remove",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&e){um_members_show_preloader(e);var r=jQuery(this).data("value"),t=jQuery(this).data("name"),a=jQuery(this).data("type");if("text"===a)um_set_url_from_data(e,"filter_"+t,""),jQuery('.um-search-filter input[name="'+t+'"]').val("");else if("select"===a){var i=um_get_data_for_directory(e,"filter_"+t);i=void 0===i?[]:i.split("||"),-1!==jQuery.inArray(r.toString(),i)&&(i=jQuery.grep(i,function(e){return e!==r.toString()})),i.length||(i=""),um_set_url_from_data(e,"filter_"+t,i);var m=jQuery('.um-search-filter select[name="'+t+'"]');m.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<m.find("option:not(:disabled)").length&&m.prop("disabled",!1),m.select2("destroy").select2(),0<e.find('.um-search-filter select[data-um-parent="'+t+'"]').length&&m.trigger("change")}else if("slider"===a){um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to","");var d=jQuery(".um-search-filter #"+t+"_min").siblings(".um-slider"),u=d.slider("option");d.slider("values",[u.min,u.max]),jQuery(".um-search-filter #"+t+"_min").val(""),jQuery(".um-search-filter #"+t+"_max").val(""),um_set_range_label(d)}else"datepicker"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),jQuery(".um-search-filter #"+t+"_from").val(""),jQuery(".um-search-filter #"+t+"_to").val("")):"timepicker"===a&&(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),jQuery(".um-search-filter #"+t+"_from").val(""),jQuery(".um-search-filter #"+t+"_to").val(""));e.data("page",1),um_set_url_from_data(e,"page",""),jQuery(this).tipsy("hide"),jQuery(this).parents(".um-members-filter-tag").remove(),0===e.find(".um-members-filter-remove").length?e.find(".um-clear-filters").hide():e.find(".um-clear-filters").show();var s=!1;if(!(s=wp.hooks.applyFilters("um_member_directory_ignore_after_search",s)))if(1===e.data("must-search")){var _=um_get_search(e);if(0===e.find(".um-members-filter-remove").length&&!_)return e.data("searched",0),e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),void um_members_hide_preloader(e)}e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-clear-filters-a",function(){var u=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(u)){um_members_show_preloader(u),u.find(".um-members-filter-remove").each(function(){var r=jQuery(this).data("value"),e=jQuery(this).data("name"),t=jQuery(this).data("type");if("text"===t)um_set_url_from_data(u,"filter_"+e,""),jQuery('.um-search-filter input[name="'+e+'"]').val("");else if("select"===t){var a=um_get_data_for_directory(u,"filter_"+e);a=void 0===a?[]:a.split("||"),-1!==jQuery.inArray(r.toString(),a)&&(a=jQuery.grep(a,function(e){return e!==r.toString()})),a.length||(a=""),um_set_url_from_data(u,"filter_"+e,a);var i=jQuery('.um-search-filter select[name="'+e+'"]');i.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<i.find("option:not(:disabled)").length&&i.prop("disabled",!1),i.select2("destroy").select2(),0<u.find('.um-search-filter select[data-um-parent="'+e+'"]').length&&i.trigger("change")}else if("slider"===t){um_set_url_from_data(u,"filter_"+e+"_from",""),um_set_url_from_data(u,"filter_"+e+"_to","");var m=jQuery(".um-search-filter #"+e+"_min").siblings(".um-slider"),d=m.slider("option");m.slider("values",[d.min,d.max]),jQuery(".um-search-filter #"+e+"_min").val(""),jQuery(".um-search-filter #"+e+"_max").val(""),um_set_range_label(m)}else"datepicker"===t?(um_set_url_from_data(u,"filter_"+e+"_from",""),um_set_url_from_data(u,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):"timepicker"===t&&(um_set_url_from_data(u,"filter_"+e+"_from",""),um_set_url_from_data(u,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val(""))}),u.data("page",1),um_set_url_from_data(u,"page",""),u.find(".um-members-filter-tag").remove(),0===u.find(".um-members-filter-remove").length?(u.find(".um-clear-filters").hide(),u.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(u.find(".um-clear-filters").show(),u.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"));var e=!1;if(!(e=wp.hooks.applyFilters("um_member_directory_ignore_after_search",e)))if(1===u.data("must-search"))if(!um_get_search(u))return u.data("searched",0),u.find(".um-members-grid, .um-members-list").remove(),u.find(".um-member-directory-sorting-options").prop("disabled",!0),u.find(".um-member-directory-view-type").addClass("um-disabled"),void um_members_hide_preloader(u);u.find(".um-member-directory-sorting-options").prop("disabled",!1),u.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(u)}}),jQuery(".um-directory").each(function(){var e=jQuery(this),r=um_members_get_hash(e);um_member_directories.push(r),e.find(".um-search").length&&(e.find(".um-search").is(":visible")||e.find(".um-search").css({display:"grid"}).slideUp(1)),e.find(".um-slider").each(function(){var e=jQuery(this),t=e.parents(".um-directory"),a=e.data("field_name"),r=um_get_data_for_directory(t,"filter_"+a+"_from"),i=um_get_data_for_directory(t,"filter_"+a+"_to");void 0===r&&(r=parseInt(e.data("min"))),void 0===i&&(i=parseInt(e.data("max")));var m=[r,i];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:m,create:function(e,r){},step:1,slide:function(e,r){um_set_range_label(jQuery(this),r)},stop:function(e,r){um_is_directory_busy(t)||(um_set_url_from_data(t,"filter_"+a+"_from",r.values[0]),um_set_url_from_data(t,"filter_"+a+"_to",r.values[1]),t.data("page",1),um_set_url_from_data(t,"page",""),um_ajax_get_members(t),um_change_tag(t),t.data("searched",1),t.find(".um-member-directory-sorting-options").prop("disabled",!1),t.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),um_set_range_label(e)}),e.find(".um-datepicker-filter").each(function(){var u=jQuery(this),s=new Date(1e3*u.data("date_min")),_=new Date(1e3*u.data("date_max")),e=u.pickadate({selectYears:!0,min:s,max:_,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){u.blur()},onClose:function(){u.blur()},onSet:function(e){if(e.select){var r=u.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=u.data("filter_name"),a=u.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");void 0===i&&(i=s/1e3),void 0===m&&(m=_/1e3);var d=e.select/1e3;u.val();"from"===a?i=d:"to"===a&&(m=d),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}}).pickadate("picker"),r=u.data("filter_name"),t=u.data("range"),a=um_get_data_for_directory(u.parents(".um-directory"),"filter_"+r+"_"+t);void 0!==a&&e.set("select",1e3*a)}),e.find(".um-timepicker-filter").each(function(){var s=jQuery(this),_=s.attr("id"),o=s.data("filter_name"),n=s.attr("data-min"),l=s.attr("data-max"),e=n.split(":"),r=l.split(":"),t=s.pickatime({format:s.data("format"),interval:parseInt(s.data("intervals")),min:[e[0],e[1]],max:[r[0],r[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){s.blur()},onClose:function(){s.blur()},onSet:function(e){if(e.select){var r=s.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=s.data("filter_name"),a=s.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");if(void 0===i&&(i=n),void 0===m&&(m=l),void 0!==e.select){var d=um_time_convert(e.select,a);"from"===a?i=d:"to"===a&&(m=d)}else"from"===a?i=n:"to"===a&&(m=l);var u=jQuery("#"+_).val();"from"===s.data("range")?jQuery("#"+o+"_to").pickatime("picker").set("min",u):jQuery("#"+o+"_from").pickatime("picker").set("max",u),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}}).pickatime("picker"),a=s.data("filter_name"),i=s.data("range"),m=um_get_data_for_directory(s.parents(".um-directory"),"filter_"+a+"_"+i);if(void 0!==m){var d=m.split(":");t.set("select",60*d[0]+1*d[1])}});var t=!1;if(!(t=wp.hooks.applyFilters("um_member_directory_ignore_after_search",t))&&1===e.data("must-search")){var a=um_get_search(e);if(!um_get_filters_data(e).length&&!a)return}um_members_show_preloader(e),um_ajax_get_members(e,{first_load:!0}),um_change_tag(e)}),window.addEventListener("popstate",function(e){jQuery(".um-directory").each(function(){var d=jQuery(this),e=um_members_get_hash(d);(um_member_directories.push(e),um_members_show_preloader(d),d.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),d.find(".um-member-directory-search-line").length)&&(void 0===(u=um_get_data_for_directory(d,"search"))&&(u=""),d.data("general_search",u),d.find(".um-search-line").val(u));var r=um_get_data_for_directory(d,"page");if(void 0===r?r=1:r>d.data("total_pages")&&(r=d.data("total_pages")),d.data("page",r).attr("data-page",r),d.find(".um-member-directory-sorting").length){var t=um_get_data_for_directory(d,"sort");void 0===t&&(t=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a[data-default="1"]').data("value")),d.data("sorting",t);var a=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]');a.find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),a.find('a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),d.find(".um-member-directory-sorting-a").find("> a").html(a.find('a[data-value="'+t+'"]').html())}if(d.find(".um-member-directory-view-type").length){var i=um_get_data_for_directory(d,"view_type");void 0===i&&(i=d.find('.um-member-directory-view-type-a[data-default="1"]').data("type")),d.data("view_type",i),d.find(".um-member-directory-view-type .um-member-directory-view-type-a").hide(),d.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="'+i+'"]').show()}d.find(".um-datepicker-filter").each(function(){var e=jQuery(this),r=e.pickadate("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);void 0!==i?r.set("select",1e3*i):r.clear()}),d.find(".um-slider").each(function(){var e=jQuery(this),r=e.data("field_name"),t=um_get_data_for_directory(d,"filter_"+r+"_from"),a=um_get_data_for_directory(d,"filter_"+r+"_to");void 0===t&&(t=e.data("min")),t=parseInt(t),void 0===a&&(a=e.data("max")),a=parseInt(a),e.slider("values",[t,a]),um_set_range_label(e)}),d.find(".um-timepicker-filter").each(function(){var e=jQuery(this),r=e.pickatime("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);if(void 0!==i){var m=i.split(":");r.set("select",60*m[0])}else r.clear()});var m=!1;if(!(m=wp.hooks.applyFilters("um_member_directory_ignore_after_search",m))&&1===d.data("must-search")){var u=um_get_search(d);if(!um_get_filters_data(d).length&&!u)return d.data("searched",0),void um_members_hide_preloader(d);d.data("searched",1)}um_ajax_get_members(d),um_change_tag(d)})})});
assets/js/um-modal.js CHANGED
@@ -16,25 +16,25 @@ jQuery(document).ready(function() {
16
 
17
  jQuery(document).on('click', '.um-modal .um-single-file-preview a.cancel', function(e){
18
  e.preventDefault();
19
-
20
  var parent = jQuery(this).parents('.um-modal-body');
21
  var src = jQuery(this).parents('.um-modal-body').find('.um-single-fileinfo a').attr('href');
22
-
23
- parent.find('.um-single-file-preview').hide();
24
-
25
- parent.find('.ajax-upload-dragdrop').show();
26
-
27
- parent.find('.um-modal-btn.um-finish-upload').addClass('disabled');
28
-
29
- um_modal_responsive();
30
-
31
  jQuery.ajax({
32
  url: wp.ajax.settings.url,
33
  type: 'post',
34
  data: {
35
  action: 'um_remove_file',
36
  src: src,
 
37
  nonce: um_scripts.nonce
 
 
 
 
 
 
38
  }
39
  });
40
 
@@ -46,18 +46,7 @@ jQuery(document).ready(function() {
46
 
47
  var parent = jQuery(this).parents('.um-modal-body');
48
  var src = jQuery(this).parents('.um-modal-body').find('.um-single-image-preview img').attr('src');
49
-
50
- jQuery('img.cropper-hidden').cropper('destroy');
51
-
52
- parent.find('.um-single-image-preview img').attr('src', '');
53
-
54
- parent.find('.um-single-image-preview').hide();
55
-
56
- parent.find('.ajax-upload-dragdrop').show();
57
-
58
- parent.find('.um-modal-btn.um-finish-upload').addClass('disabled');
59
-
60
- um_modal_responsive();
61
 
62
  jQuery.ajax({
63
  url: wp.ajax.settings.url,
@@ -65,7 +54,17 @@ jQuery(document).ready(function() {
65
  data: {
66
  action: 'um_remove_file',
67
  src: src,
 
68
  nonce: um_scripts.nonce
 
 
 
 
 
 
 
 
 
69
  }
70
  });
71
 
16
 
17
  jQuery(document).on('click', '.um-modal .um-single-file-preview a.cancel', function(e){
18
  e.preventDefault();
19
+
20
  var parent = jQuery(this).parents('.um-modal-body');
21
  var src = jQuery(this).parents('.um-modal-body').find('.um-single-fileinfo a').attr('href');
22
+ var mode = parent.find('.um-single-file-upload').data('set_mode');
23
+
 
 
 
 
 
 
 
24
  jQuery.ajax({
25
  url: wp.ajax.settings.url,
26
  type: 'post',
27
  data: {
28
  action: 'um_remove_file',
29
  src: src,
30
+ mode: mode,
31
  nonce: um_scripts.nonce
32
+ },
33
+ success: function() {
34
+ parent.find('.um-single-file-preview').hide();
35
+ parent.find('.ajax-upload-dragdrop').show();
36
+ parent.find('.um-modal-btn.um-finish-upload').addClass('disabled');
37
+ um_modal_responsive();
38
  }
39
  });
40
 
46
 
47
  var parent = jQuery(this).parents('.um-modal-body');
48
  var src = jQuery(this).parents('.um-modal-body').find('.um-single-image-preview img').attr('src');
49
+ var mode = parent.find('.um-single-image-upload').data('set_mode');
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  jQuery.ajax({
52
  url: wp.ajax.settings.url,
54
  data: {
55
  action: 'um_remove_file',
56
  src: src,
57
+ mode: mode,
58
  nonce: um_scripts.nonce
59
+ },
60
+ success: function() {
61
+ jQuery('img.cropper-hidden').cropper( 'destroy' );
62
+ parent.find('.um-single-image-preview img').attr( 'src', '' );
63
+ parent.find('.um-single-image-preview').hide();
64
+ parent.find('.ajax-upload-dragdrop').show();
65
+ parent.find('.um-modal-btn.um-finish-upload').addClass( 'disabled' );
66
+
67
+ um_modal_responsive();
68
  }
69
  });
70
 
assets/js/um-modal.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){jQuery(document).on("click",".um-popup-overlay",function(){remove_Modal()}),jQuery(document).on("click",'.um-modal-overlay, a[data-action="um_remove_modal"]',function(){um_remove_modal()}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"], .um-modal a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-modal .um-single-file-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),t=jQuery(this).parents(".um-modal-body").find(".um-single-fileinfo a").attr("href");return a.find(".um-single-file-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive(),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:t,nonce:um_scripts.nonce}}),!1}),jQuery(document).on("click",".um-modal .um-single-image-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),t=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview img").attr("src");return jQuery("img.cropper-hidden").cropper("destroy"),a.find(".um-single-image-preview img").attr("src",""),a.find(".um-single-image-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive(),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:t,nonce:um_scripts.nonce}}),!1}),jQuery(document).on("click",".um-finish-upload.file:not(.disabled)",function(){var e=jQuery(this).attr("data-key"),a=jQuery(this).parents(".um-modal-body").find(".um-single-file-preview").html();um_remove_modal(),jQuery(".um-single-file-preview[data-key="+e+"]").fadeIn().html(a);var t=jQuery(".um-field[data-key="+e+"]").find(".um-single-fileinfo a").data("file");jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-btn-auto-width").html(jQuery(this).attr("data-change")),jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find('input[type="hidden"]').val(t)}),jQuery(document).on("click",".um-finish-upload.image:not(.disabled)",function(){var a=jQuery(this),t=jQuery(this).attr("data-key"),e=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),i=e.find("img").attr("src"),r=e.attr("data-coord"),u=e.find("img").data("file"),n=0;jQuery(this).parents("#um_upload_single").data("user_id")&&(n=jQuery(this).parents("#um_upload_single").data("user_id")),r?(jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_resize_image",src:i,coord:r,user_id:n,key:t,nonce:um_scripts.nonce},success:function(e){e.success&&(d=new Date,"profile_photo"===t?jQuery(".um-profile-photo-img img").attr("src",e.data.image.source_url+"?"+d.getTime()):"cover_photo"===t&&(jQuery(".um-cover-e").empty().html('<img src="'+e.data.image.source_url+"?"+d.getTime()+'" alt="" />'),jQuery(".um").hasClass("um-editing")&&jQuery(".um-cover-overlay").show()),jQuery(".um-single-image-preview[data-key="+t+"]").fadeIn().find("img").attr("src",e.data.image.source_url+"?"+d.getTime()),um_remove_modal(),jQuery("img.cropper-invisible").remove(),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find(".um-btn-auto-width").html(a.attr("data-change")),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find('input[type="hidden"]').val(e.data.image.filename))}})):(d=new Date,jQuery(".um-single-image-preview[data-key="+t+"]").fadeIn().find("img").attr("src",i+"?"+d.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find(".um-btn-auto-width").html(a.attr("data-change")),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find("input[type=hidden]").val(u))}),jQuery(document.body).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal"),t="normal";if(jQuery(this).data("modal-size"))t=jQuery(this).data("modal-size");jQuery(this).data("modal-copy")&&(jQuery("#"+a).html(jQuery(this).parents(".um-field").find(".um-modal-hidden-content").html()),jQuery(this).parents(".um-profile-photo").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-profile-photo").attr("data-user_id")),jQuery(this).parents(".um-cover").attr("data-ratio")&&jQuery("#"+a).attr("data-ratio",jQuery(this).parents(".um-cover").attr("data-ratio")),jQuery(this).parents(".um-cover").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-cover").attr("data-user_id")),0<jQuery("input[type=hidden][name='user_id']").length&&jQuery("#"+a).attr("data-user_id",jQuery("input[type=hidden][name='user_id']").val())),um_new_modal(a,t)})});
1
+ jQuery(document).ready(function(){jQuery(document).on("click",".um-popup-overlay",function(){remove_Modal()}),jQuery(document).on("click",'.um-modal-overlay, a[data-action="um_remove_modal"]',function(){um_remove_modal()}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"], .um-modal a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-modal .um-single-file-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),t=jQuery(this).parents(".um-modal-body").find(".um-single-fileinfo a").attr("href"),i=a.find(".um-single-file-upload").data("set_mode");return jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:t,mode:i,nonce:um_scripts.nonce},success:function(){a.find(".um-single-file-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive()}}),!1}),jQuery(document).on("click",".um-modal .um-single-image-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),t=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview img").attr("src"),i=a.find(".um-single-image-upload").data("set_mode");return jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:t,mode:i,nonce:um_scripts.nonce},success:function(){jQuery("img.cropper-hidden").cropper("destroy"),a.find(".um-single-image-preview img").attr("src",""),a.find(".um-single-image-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive()}}),!1}),jQuery(document).on("click",".um-finish-upload.file:not(.disabled)",function(){var e=jQuery(this).attr("data-key"),a=jQuery(this).parents(".um-modal-body").find(".um-single-file-preview").html();um_remove_modal(),jQuery(".um-single-file-preview[data-key="+e+"]").fadeIn().html(a);var t=jQuery(".um-field[data-key="+e+"]").find(".um-single-fileinfo a").data("file");jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-btn-auto-width").html(jQuery(this).attr("data-change")),jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find('input[type="hidden"]').val(t)}),jQuery(document).on("click",".um-finish-upload.image:not(.disabled)",function(){var a=jQuery(this),t=jQuery(this).attr("data-key"),e=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),i=e.find("img").attr("src"),r=e.attr("data-coord"),u=e.find("img").data("file"),n=0;jQuery(this).parents("#um_upload_single").data("user_id")&&(n=jQuery(this).parents("#um_upload_single").data("user_id")),r?(jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_resize_image",src:i,coord:r,user_id:n,key:t,nonce:um_scripts.nonce},success:function(e){e.success&&(d=new Date,"profile_photo"===t?jQuery(".um-profile-photo-img img").attr("src",e.data.image.source_url+"?"+d.getTime()):"cover_photo"===t&&(jQuery(".um-cover-e").empty().html('<img src="'+e.data.image.source_url+"?"+d.getTime()+'" alt="" />'),jQuery(".um").hasClass("um-editing")&&jQuery(".um-cover-overlay").show()),jQuery(".um-single-image-preview[data-key="+t+"]").fadeIn().find("img").attr("src",e.data.image.source_url+"?"+d.getTime()),um_remove_modal(),jQuery("img.cropper-invisible").remove(),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find(".um-btn-auto-width").html(a.attr("data-change")),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find('input[type="hidden"]').val(e.data.image.filename))}})):(d=new Date,jQuery(".um-single-image-preview[data-key="+t+"]").fadeIn().find("img").attr("src",i+"?"+d.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find(".um-btn-auto-width").html(a.attr("data-change")),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find("input[type=hidden]").val(u))}),jQuery(document.body).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal"),t="normal";if(jQuery(this).data("modal-size"))t=jQuery(this).data("modal-size");jQuery(this).data("modal-copy")&&(jQuery("#"+a).html(jQuery(this).parents(".um-field").find(".um-modal-hidden-content").html()),jQuery(this).parents(".um-profile-photo").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-profile-photo").attr("data-user_id")),jQuery(this).parents(".um-cover").attr("data-ratio")&&jQuery("#"+a).attr("data-ratio",jQuery(this).parents(".um-cover").attr("data-ratio")),jQuery(this).parents(".um-cover").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-cover").attr("data-user_id")),0<jQuery("input[type=hidden][name='user_id']").length&&jQuery("#"+a).attr("data-user_id",jQuery("input[type=hidden][name='user_id']").val())),um_new_modal(a,t)})});
assets/js/um-scripts.js CHANGED
@@ -1,11 +1,10 @@
1
  function um_init_datetimepicker() {
2
  jQuery('.um-datepicker:not(.picker__input)').each(function(){
3
- elem = jQuery(this);
4
 
5
- if ( typeof elem.attr('data-disabled_weekdays') != 'undefined' && elem.attr('data-disabled_weekdays') != '' ) {
6
- var disable = JSON.parse( elem.attr('data-disabled_weekdays') );
7
- } else {
8
- var disable = false;
9
  }
10
 
11
  var years_n = null;
@@ -64,7 +63,7 @@ function um_init_datetimepicker() {
64
  });
65
 
66
  jQuery('.um-timepicker:not(.picker__input)').each(function(){
67
- elem = jQuery(this);
68
 
69
  elem.pickatime({
70
  format: elem.attr('data-format'),
@@ -90,18 +89,18 @@ function init_tipsy() {
90
 
91
  jQuery(document).ready(function() {
92
 
93
- jQuery( document.body ).on('click', '.um-dropdown a.real_url', function(e){
94
  window.location = jQuery(this).attr('href');
95
  });
96
 
97
- jQuery( document.body ).on( 'click', '.um-trigger-menu-on-click', function(e) {
98
  jQuery('.um-dropdown').hide();
99
  var menu = jQuery(this).find('.um-dropdown');
100
  menu.show();
101
  return false;
102
  });
103
 
104
- jQuery( document.body ).on('click', '.um-dropdown-hide', function(e) {
105
  UM_hide_menus();
106
  return false;
107
  });
@@ -143,7 +142,7 @@ jQuery(document).ready(function() {
143
 
144
  init_tipsy();
145
 
146
- if( typeof(jQuery.fn.um_raty) === "function" ){
147
  jQuery('.um-rating').um_raty({
148
  half: false,
149
  starType: 'i',
@@ -152,19 +151,19 @@ jQuery(document).ready(function() {
152
  scoreName: function(){return jQuery(this).attr('data-key');},
153
  hints: false,
154
  click: function( score, evt ) {
155
- live_field = this.id;
156
- live_value = score;
157
  um_apply_conditions( jQuery(this), false );
158
  }
159
  });
160
 
161
  jQuery('.um-rating-readonly').um_raty({
162
- half: false,
163
- starType: 'i',
164
- number: function() {return jQuery(this).attr('data-number');},
165
- score: function() {return jQuery(this).attr('data-score');},
166
- scoreName: function(){return jQuery(this).attr('data-key');},
167
- hints: false,
168
  readOnly: true
169
  });
170
  }
@@ -179,8 +178,6 @@ jQuery(document).ready(function() {
179
  });
180
 
181
  jQuery(document).on('change', '.um-field-area input[type="checkbox"]', function(){
182
-
183
- var field = jQuery(this).parents('.um-field-area');
184
  var this_field = jQuery(this).parents('label');
185
  if ( this_field.hasClass('active') ) {
186
  this_field.removeClass('active');
@@ -197,42 +194,62 @@ jQuery(document).ready(function() {
197
  jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function(e){
198
  e.preventDefault();
199
  var parent = jQuery(this).parents('.um-field');
 
 
 
200
  var src = jQuery(this).parents('.um-field').find('.um-single-image-preview img').attr('src');
201
- parent.find('.um-single-image-preview img').attr('src','');
202
- parent.find('.um-single-image-preview').hide();
203
- parent.find('.um-btn-auto-width').html('Upload');
204
- parent.find('input[type=hidden]').val('empty_file');
205
 
206
- jQuery.ajax({
207
- url: wp.ajax.settings.url,
208
- type: 'post',
209
  data: {
210
- action: 'um_remove_file',
 
211
  src: src,
212
  nonce: um_scripts.nonce
 
 
 
 
 
 
213
  }
214
- });
 
 
 
 
 
 
215
 
216
  return false;
217
  });
218
 
219
- jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function(e){
220
  e.preventDefault();
221
  var parent = jQuery(this).parents('.um-field');
 
222
  var src = jQuery(this).parents('.um-field').find('.um-single-fileinfo a').attr('href');
223
- parent.find('.um-single-file-preview').hide();
224
- parent.find('.um-btn-auto-width').html('Upload');
225
- parent.find('input[type=hidden]').val('empty_file');
226
 
227
- jQuery.ajax({
228
- url: wp.ajax.settings.url,
229
- type: 'post',
230
  data: {
231
- action: 'um_remove_file',
 
232
  src: src,
233
  nonce: um_scripts.nonce
 
 
 
 
 
234
  }
235
- });
 
 
 
 
 
 
236
 
237
  return false;
238
  });
@@ -247,7 +264,7 @@ jQuery(document).ready(function() {
247
  field.find('.um-field-group-body:first').clone().appendTo( field );
248
  }
249
 
250
- increase_id = 0;
251
  field.find('.um-field-group-body').each(function(){
252
  increase_id++;
253
  jQuery(this).find('input').each(function(){
@@ -289,13 +306,15 @@ jQuery(document).ready(function() {
289
  e.preventDefault();
290
 
291
  var obj = jQuery(this);
292
- var parent = jQuery(this).parent();
293
  parent.addClass( 'loading' );
294
 
295
- var hook = jQuery(this).data('hook');
 
 
 
 
296
  if ( 'um_load_posts' === hook ) {
297
- var pages = jQuery(this).data('pages')*1;
298
- var next_page = jQuery(this).data('page')*1 + 1;
299
 
300
  jQuery.ajax({
301
  url: wp.ajax.settings.url,
@@ -319,8 +338,6 @@ jQuery(document).ready(function() {
319
  }
320
  });
321
  } else if ( 'um_load_comments' === hook ) {
322
- var pages = jQuery(this).data('pages')*1;
323
- var next_page = jQuery(this).data('page')*1 + 1;
324
 
325
  jQuery.ajax({
326
  url: wp.ajax.settings.url,
@@ -470,7 +487,6 @@ jQuery(document).ready(function() {
470
  var me = jQuery(this);
471
  var parent_option = me.data('um-parent');
472
  var um_ajax_source = me.data('um-ajax-source');
473
- var original_value = me.val();
474
 
475
  me.attr('data-um-init-field', true );
476
 
@@ -482,14 +498,22 @@ jQuery(document).ready(function() {
482
  if ( me.attr( 'data-member-directory' ) === 'yes' ) {
483
  var directory = parent.parents('.um-directory');
484
  arr_key = um_get_data_for_directory( directory, 'filter_' + parent_option );
485
- if ( typeof arr_key != 'undefined' ) {
486
  arr_key = arr_key.split('||');
 
 
487
  }
488
  } else {
489
  arr_key = parent.val();
490
  }
491
 
492
- if ( typeof arr_key != 'undefined' && arr_key != '' && typeof um_select_options_cache[ arr_key ] != 'object' ) {
 
 
 
 
 
 
493
 
494
  jQuery.ajax({
495
  url: wp.ajax.settings.url,
@@ -504,29 +528,31 @@ jQuery(document).ready(function() {
504
  form_id: form_id,
505
  nonce: um_scripts.nonce
506
  },
507
- success: function( data ){
508
- if ( data.status == 'success' && arr_key != '' ) {
 
509
  um_field_populate_child_options( me, data, arr_key );
510
  }
511
 
512
  if ( typeof data.debug !== 'undefined' ) {
513
  console.log( data );
514
  }
 
 
515
  },
516
- error: function( e ){
517
  console.log( e );
 
518
  }
519
  });
520
 
521
-
522
  }
523
 
524
- if ( typeof arr_key != 'undefined' && arr_key != '' && typeof um_select_options_cache[ arr_key ] == 'object' ) {
525
- var data = um_select_options_cache[ arr_key ];
526
- um_field_populate_child_options( me, data, arr_key );
527
  }
528
 
529
- if ( typeof arr_key != 'undefined' || arr_key == '' ) {
530
  me.find('option[value!=""]').remove();
531
  me.val('').trigger('change');
532
  }
@@ -537,17 +563,17 @@ jQuery(document).ready(function() {
537
 
538
  });
539
 
 
540
  /**
541
  * Populates child options and cache ajax response
542
- * @param DOM me child option elem
543
- * @param array data
544
- * @param string key
 
545
  */
546
- function um_field_populate_child_options( me, data, arr_key, arr_items ) {
547
  var directory = me.parents('.um-directory');
548
- var parent_option = me.data('um-parent');
549
  var child_name = me.attr('name');
550
- var parent_dom = jQuery('select[name="'+parent_option+'"]');
551
  me.find('option[value!=""]').remove();
552
 
553
  if ( ! me.hasClass('um-child-option-disabled') ) {
@@ -579,7 +605,7 @@ jQuery(document).ready(function() {
579
  });
580
 
581
  var current_filter_val = um_get_data_for_directory( directory, 'filter_' + child_name );
582
- if ( typeof current_filter_val != 'undefined' ) {
583
  current_filter_val = current_filter_val.split('||');
584
 
585
  var temp_filter_val = [];
@@ -609,7 +635,7 @@ jQuery(document).ready(function() {
609
  if ( data.post.members_directory !== 'yes' ) {
610
  if ( typeof data.field.default !== 'undefined' && ! me.data('um-original-value') ) {
611
  me.val( data.field.default ).trigger('change');
612
- } else if ( me.data('um-original-value') != '' ) {
613
  me.val( me.data('um-original-value') ).trigger('change');
614
  }
615
 
@@ -618,8 +644,6 @@ jQuery(document).ready(function() {
618
  me.attr('disabled','disabled');
619
  }
620
  }
621
- um_select_options_cache[ arr_key ] = data;
622
-
623
  }
624
 
625
  });
1
  function um_init_datetimepicker() {
2
  jQuery('.um-datepicker:not(.picker__input)').each(function(){
3
+ var elem = jQuery(this);
4
 
5
+ var disable = false;
6
+ if ( typeof elem.attr('data-disabled_weekdays') != 'undefined' && elem.attr('data-disabled_weekdays') !== '' ) {
7
+ disable = JSON.parse( elem.attr('data-disabled_weekdays') );
 
8
  }
9
 
10
  var years_n = null;
63
  });
64
 
65
  jQuery('.um-timepicker:not(.picker__input)').each(function(){
66
+ var elem = jQuery(this);
67
 
68
  elem.pickatime({
69
  format: elem.attr('data-format'),
89
 
90
  jQuery(document).ready(function() {
91
 
92
+ jQuery( document.body ).on('click', '.um-dropdown a.real_url', function() {
93
  window.location = jQuery(this).attr('href');
94
  });
95
 
96
+ jQuery( document.body ).on( 'click', '.um-trigger-menu-on-click', function() {
97
  jQuery('.um-dropdown').hide();
98
  var menu = jQuery(this).find('.um-dropdown');
99
  menu.show();
100
  return false;
101
  });
102
 
103
+ jQuery( document.body ).on('click', '.um-dropdown-hide', function() {
104
  UM_hide_menus();
105
  return false;
106
  });
142
 
143
  init_tipsy();
144
 
145
+ if ( typeof( jQuery.fn.um_raty ) === "function" ) {
146
  jQuery('.um-rating').um_raty({
147
  half: false,
148
  starType: 'i',
151
  scoreName: function(){return jQuery(this).attr('data-key');},
152
  hints: false,
153
  click: function( score, evt ) {
154
+ um_live_field = this.id;
155
+ um_live_value = score;
156
  um_apply_conditions( jQuery(this), false );
157
  }
158
  });
159
 
160
  jQuery('.um-rating-readonly').um_raty({
161
+ half: false,
162
+ starType: 'i',
163
+ number: function() {return jQuery(this).attr('data-number');},
164
+ score: function() {return jQuery(this).attr('data-score');},
165
+ scoreName: function(){return jQuery(this).attr('data-key');},
166
+ hints: false,
167
  readOnly: true
168
  });
169
  }
178
  });
179
 
180
  jQuery(document).on('change', '.um-field-area input[type="checkbox"]', function(){
 
 
181
  var this_field = jQuery(this).parents('label');
182
  if ( this_field.hasClass('active') ) {
183
  this_field.removeClass('active');
194
  jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function(e){
195
  e.preventDefault();
196
  var parent = jQuery(this).parents('.um-field');
197
+
198
+ var filename = parent.find( 'input[type="hidden"]#' + parent.data('key') + '-' + jQuery(this).parents('form').find('input[type="hidden"][name="form_id"]').val() ).val();
199
+
200
  var src = jQuery(this).parents('.um-field').find('.um-single-image-preview img').attr('src');
201
+ var mode = parent.data('mode');
 
 
 
202
 
203
+ var args = {
 
 
204
  data: {
205
+ mode: mode,
206
+ filename: filename,
207
  src: src,
208
  nonce: um_scripts.nonce
209
+ },
210
+ success: function() {
211
+ parent.find('.um-single-image-preview img').attr( 'src', '' );
212
+ parent.find('.um-single-image-preview').hide();
213
+ parent.find('.um-btn-auto-width').html( parent.data('upload-label') );
214
+ parent.find('input[type=hidden]').val( 'empty_file' );
215
  }
216
+ };
217
+
218
+ if ( mode !== 'register' ) {
219
+ args.data.user_id = jQuery(this).parents('form' ).find( '#user_id' ).val();
220
+ }
221
+
222
+ wp.ajax.send( 'um_remove_file', args );
223
 
224
  return false;
225
  });
226
 
227
+ jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function(e) {
228
  e.preventDefault();
229
  var parent = jQuery(this).parents('.um-field');
230
+ var filename = parent.find( 'input[type="hidden"]#' + parent.data('key') + '-' + jQuery(this).parents('form').find('input[type="hidden"][name="form_id"]').val() ).val();
231
  var src = jQuery(this).parents('.um-field').find('.um-single-fileinfo a').attr('href');
232
+ var mode = parent.data('mode');
 
 
233
 
234
+ var args = {
 
 
235
  data: {
236
+ mode: mode,
237
+ filename: filename,
238
  src: src,
239
  nonce: um_scripts.nonce
240
+ },
241
+ success: function() {
242
+ parent.find('.um-single-file-preview').hide();
243
+ parent.find('.um-btn-auto-width').html( parent.data('upload-label') );
244
+ parent.find('input[type=hidden]').val( 'empty_file' );
245
  }
246
+ };
247
+
248
+ if ( mode !== 'register' ) {
249
+ args.data.user_id = jQuery(this).parents('form' ).find( '#user_id' ).val();
250
+ }
251
+
252
+ wp.ajax.send( 'um_remove_file', args );
253
 
254
  return false;
255
  });
264
  field.find('.um-field-group-body:first').clone().appendTo( field );
265
  }
266
 
267
+ var increase_id = 0;
268
  field.find('.um-field-group-body').each(function(){
269
  increase_id++;
270
  jQuery(this).find('input').each(function(){
306
  e.preventDefault();
307
 
308
  var obj = jQuery(this);
309
+ var parent = obj.parent();
310
  parent.addClass( 'loading' );
311
 
312
+ var pages = obj.data('pages')*1;
313
+ var next_page = obj.data('page')*1 + 1;
314
+
315
+ var hook = obj.data('hook');
316
+
317
  if ( 'um_load_posts' === hook ) {
 
 
318
 
319
  jQuery.ajax({
320
  url: wp.ajax.settings.url,
338
  }
339
  });
340
  } else if ( 'um_load_comments' === hook ) {
 
 
341
 
342
  jQuery.ajax({
343
  url: wp.ajax.settings.url,
487
  var me = jQuery(this);
488
  var parent_option = me.data('um-parent');
489
  var um_ajax_source = me.data('um-ajax-source');
 
490
 
491
  me.attr('data-um-init-field', true );
492
 
498
  if ( me.attr( 'data-member-directory' ) === 'yes' ) {
499
  var directory = parent.parents('.um-directory');
500
  arr_key = um_get_data_for_directory( directory, 'filter_' + parent_option );
501
+ if ( typeof arr_key != 'undefined' ) {
502
  arr_key = arr_key.split('||');
503
+ } else {
504
+ arr_key = '';
505
  }
506
  } else {
507
  arr_key = parent.val();
508
  }
509
 
510
+ if ( typeof arr_key != 'undefined' && arr_key !== '' && typeof um_select_options_cache[ arr_key ] !== 'object' ) {
511
+
512
+ if ( typeof( me.um_wait ) === 'undefined' || me.um_wait === false ) {
513
+ me.um_wait = true;
514
+ } else {
515
+ return;
516
+ }
517
 
518
  jQuery.ajax({
519
  url: wp.ajax.settings.url,
528
  form_id: form_id,
529
  nonce: um_scripts.nonce
530
  },
531
+ success: function( data ) {
532
+ if ( data.status === 'success' && arr_key !== '' ) {
533
+ um_select_options_cache[ arr_key ] = data;
534
  um_field_populate_child_options( me, data, arr_key );
535
  }
536
 
537
  if ( typeof data.debug !== 'undefined' ) {
538
  console.log( data );
539
  }
540
+
541
+ me.um_wait = false;
542
  },
543
+ error: function( e ) {
544
  console.log( e );
545
+ me.um_wait = false;
546
  }
547
  });
548
 
 
549
  }
550
 
551
+ if ( typeof arr_key != 'undefined' && arr_key !== '' && typeof um_select_options_cache[ arr_key ] == 'object' ) {
552
+ setTimeout( um_field_populate_child_options, 10, me, um_select_options_cache[ arr_key ], arr_key );
 
553
  }
554
 
555
+ if ( typeof arr_key != 'undefined' || arr_key === '' ) {
556
  me.find('option[value!=""]').remove();
557
  me.val('').trigger('change');
558
  }
563
 
564
  });
565
 
566
+
567
  /**
568
  * Populates child options and cache ajax response
569
+ *
570
+ * @param me
571
+ * @param data
572
+ * @param arr_key
573
  */
574
+ function um_field_populate_child_options( me, data, arr_key ) {
575
  var directory = me.parents('.um-directory');
 
576
  var child_name = me.attr('name');
 
577
  me.find('option[value!=""]').remove();
578
 
579
  if ( ! me.hasClass('um-child-option-disabled') ) {
605
  });
606
 
607
  var current_filter_val = um_get_data_for_directory( directory, 'filter_' + child_name );
608
+ if ( typeof current_filter_val !== 'undefined' ) {
609
  current_filter_val = current_filter_val.split('||');
610
 
611
  var temp_filter_val = [];
635
  if ( data.post.members_directory !== 'yes' ) {
636
  if ( typeof data.field.default !== 'undefined' && ! me.data('um-original-value') ) {
637
  me.val( data.field.default ).trigger('change');
638
+ } else if ( me.data('um-original-value') !== '' ) {
639
  me.val( me.data('um-original-value') ).trigger('change');
640
  }
641
 
644
  me.attr('disabled','disabled');
645
  }
646
  }
 
 
647
  }
648
 
649
  });
assets/js/um-scripts.min.js CHANGED
@@ -1 +1 @@
1
- function um_init_datetimepicker(){jQuery(".um-datepicker:not(.picker__input)").each(function(){if(elem=jQuery(this),void 0!==elem.attr("data-disabled_weekdays")&&""!=elem.attr("data-disabled_weekdays"))var e=JSON.parse(elem.attr("data-disabled_weekdays"));else e=!1;var t=null;void 0!==elem.attr("data-years")&&(t=elem.attr("data-years"));var a=elem.attr("data-date_min"),i=elem.attr("data-date_max"),r=[],n=[];void 0!==a&&(r=a.split(",")),void 0!==i&&(n=i.split(","));var u=r.length?new Date(r):null,o=r.length?new Date(n):null;if(u&&"Invalid Date"==u.toString()&&3==r.length){var s=r[1]+"/"+r[2]+"/"+r[0];u=new Date(Date.parse(s))}if(o&&"Invalid Date"==o.toString()&&3==n.length){var d=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(d))}var l={disable:e,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}};null!==t&&(l.selectYears=t),null!==u&&(l.min=u),null!==o&&(l.max=o),elem.pickadate(l)}),jQuery(".um-timepicker:not(.picker__input)").each(function(){elem=jQuery(this),elem.pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})})}function init_tipsy(){"function"==typeof jQuery.fn.tipsy&&(jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}))}jQuery(document).ready(function(){jQuery(document.body).on("click",".um-dropdown a.real_url",function(e){window.location=jQuery(this).attr("href")}),jQuery(document.body).on("click",".um-trigger-menu-on-click",function(e){return jQuery(".um-dropdown").hide(),jQuery(this).find(".um-dropdown").show(),!1}),jQuery(document.body).on("click",".um-dropdown-hide",function(e){return UM_hide_menus(),!1}),jQuery(document.body).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");return jQuery(this).parents(t).find(e).trigger("click"),UM_hide_menus(),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),"function"==typeof jQuery.fn.select2&&(jQuery(".um-s1").select2({allowClear:!0}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(".um-s3").select2({allowClear:!1,minimumResultsForSearch:-1})),init_tipsy(),"function"==typeof jQuery.fn.um_raty&&(jQuery(".um-rating").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){live_field=this.id,live_value=e,um_apply_conditions(jQuery(this),!1)}}),jQuery(".um-rating-readonly").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0})),jQuery(document).on("change",'.um-field-area input[type="radio"]',function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeAttr("class").addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeAttr("class").addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",'.um-field-area input[type="checkbox"]',function(){jQuery(this).parents(".um-field-area");var e=jQuery(this).parents("label");e.hasClass("active")?(e.removeClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline"))}),um_init_datetimepicker(),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src");return t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val("empty_file"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:a,nonce:um_scripts.nonce}}),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val("empty_file"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:a,nonce:um_scripts.nonce}}),!1}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),increase_id=0,e.find(".um-field-group-body").each(function(){increase_id++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+increase_id),e.attr("name",e.data("key")+"-"+increase_id),e.parent().parent().find("label").attr("for",e.data("key")+"-"+increase_id)})}),0<t&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),a=t.data("max_entries");return 1<t.find(".um-field-group-body").length?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),0<a&&t.find(".um-field-group-body").length<a&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document.body).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this),a=jQuery(this).parent();a.addClass("loading");var i=jQuery(this).data("hook");if("um_load_posts"===i){var r=1*jQuery(this).data("pages"),n=1*jQuery(this).data("page")+1;jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_posts",author:jQuery(this).data("author"),page:n,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),n===r?a.remove():t.data("page",n)}})}else if("um_load_comments"===i){r=1*jQuery(this).data("pages"),n=1*jQuery(this).data("page")+1;jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_comments",user_id:jQuery(this).data("user_id"),page:n,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),n===r?a.remove():t.data("page",n)}})}else{var u=jQuery(this).data("args"),o=jQuery(this).parents(".um").find(".um-ajax-items");jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate",hook:i,args:u,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.remove(),o.append(e)}})}}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),a=jQuery(this).data("user_id"),arguments=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_muted_action",hook:t,user_id:a,arguments:arguments,nonce:um_scripts.nonce},success:function(e){}}),!1}),jQuery(document.body).on("click","#um-search-button",function(){var e=jQuery(this).parents(".um-search-form").data("members_page"),t=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){t.push(jQuery(this).val())});var a,i=jQuery(this).parents(".um-search-form").find(".um-search-field").val();if(""===i)a=e;else{for(var r="?",n=0;n<t.length;n++)r+=t[n]+"="+i,n!==t.length-1&&(r+="&");a=e+r}window.location=a}),jQuery(document.body).on("keypress",".um-search-field",function(e){if(13===e.which){var t=jQuery(this).parents(".um-search-form").data("members_page"),a=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){a.push(jQuery(this).val())});var i,r=jQuery(this).val();if(""===r)i=t;else{for(var n="?",u=0;u<a.length;u++)n+=a[u]+"="+r,u!==a.length-1&&(n+="&");i=t+n}window.location=i}}),jQuery('.um-form input[class="um-button"][type="submit"]').removeAttr("disabled"),jQuery(document).one("click",'.um:not(.um-account) .um-form input[class="um-button"][type="submit"]:not(.um-has-recaptcha)',function(){jQuery(this).attr("disabled","disabled"),jQuery(this).parents("form").submit()});var d={};function s(t,e,a,i){var r=t.parents(".um-directory"),n=t.data("um-parent"),u=t.attr("name");jQuery('select[name="'+n+'"]');t.find('option[value!=""]').remove(),t.hasClass("um-child-option-disabled")||t.removeAttr("disabled");i=[];if("yes"===e.post.members_directory&&i.push({id:"",text:"",selected:1}),jQuery.each(e.items,function(e,t){i.push({id:e,text:t,selected:""===t})}),t.select2("destroy"),t.select2({data:i,allowClear:!0,minimumResultsForSearch:10}),"yes"===e.post.members_directory){t.find("option").each(function(){""!==jQuery(this).html()&&jQuery(this).data("value_label",jQuery(this).html()).attr("data-value_label",jQuery(this).html())});var o=um_get_data_for_directory(r,"filter_"+u);if(void 0!==o){o=o.split("||");var s=[];jQuery.each(o,function(e){t.find('option[value="'+o[e]+'"]').length&&s.push(o[e]),t.find('option[value="'+o[e]+'"]').prop("disabled",!0).hide(),1===t.find("option:not(:disabled)").length&&t.prop("disabled",!0),t.select2("destroy").select2(),t.val("").trigger("change")}),s=s.join("||"),o!==s&&(um_set_url_from_data(r,"filter_"+u,s),um_ajax_get_members(r))}um_change_tag(r)}"yes"!==e.post.members_directory&&(void 0===e.field.default||t.data("um-original-value")?""!=t.data("um-original-value")&&t.val(t.data("um-original-value")).trigger("change"):t.val(e.field.default).trigger("change"),0==e.field.editable&&(t.addClass("um-child-option-disabled"),t.attr("disabled","disabled"))),d[a]=e}jQuery("select[data-um-parent]").each(function(){var n=jQuery(this),u=n.data("um-parent"),o=n.data("um-ajax-source");n.val();n.attr("data-um-init-field",!0),jQuery(document).on("change",'select[name="'+u+'"]',function(){var t,e=jQuery(this),a=e.closest("form").find('input[type="hidden"][name="form_id"]').val();if("yes"===n.attr("data-member-directory")){var i=e.parents(".um-directory");void 0!==(t=um_get_data_for_directory(i,"filter_"+u))&&(t=t.split("||"))}else t=e.val();if(void 0!==t&&""!=t&&"object"!=typeof d[t]&&jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_select_options",parent_option_name:u,parent_option:t,child_callback:o,child_name:n.attr("name"),members_directory:n.attr("data-member-directory"),form_id:a,nonce:um_scripts.nonce},success:function(e){"success"==e.status&&""!=t&&s(n,e,t),void 0!==e.debug&&console.log(e)},error:function(e){console.log(e)}}),void 0!==t&&""!=t&&"object"==typeof d[t]){var r=d[t];s(n,r,t)}void 0===t&&""!=t||(n.find('option[value!=""]').remove(),n.val("").trigger("change"))}),jQuery('select[name="'+u+'"]').trigger("change")})});
1
+ function um_init_datetimepicker(){jQuery(".um-datepicker:not(.picker__input)").each(function(){var e=jQuery(this),t=!1;void 0!==e.attr("data-disabled_weekdays")&&""!==e.attr("data-disabled_weekdays")&&(t=JSON.parse(e.attr("data-disabled_weekdays")));var a=null;void 0!==e.attr("data-years")&&(a=e.attr("data-years"));var i=e.attr("data-date_min"),r=e.attr("data-date_max"),n=[],u=[];void 0!==i&&(n=i.split(",")),void 0!==r&&(u=r.split(","));var o=n.length?new Date(n):null,s=n.length?new Date(u):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var d=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(d))}if(s&&"Invalid Date"==s.toString()&&3==u.length){var l=u[1]+"/"+u[2]+"/"+u[0];s=new Date(Date.parse(l))}var m={disable:t,format:e.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}};null!==a&&(m.selectYears=a),null!==o&&(m.min=o),null!==s&&(m.max=s),e.pickadate(m)}),jQuery(".um-timepicker:not(.picker__input)").each(function(){var e=jQuery(this);e.pickatime({format:e.attr("data-format"),interval:parseInt(e.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}})})}function init_tipsy(){"function"==typeof jQuery.fn.tipsy&&(jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}))}jQuery(document).ready(function(){jQuery(document.body).on("click",".um-dropdown a.real_url",function(){window.location=jQuery(this).attr("href")}),jQuery(document.body).on("click",".um-trigger-menu-on-click",function(){return jQuery(".um-dropdown").hide(),jQuery(this).find(".um-dropdown").show(),!1}),jQuery(document.body).on("click",".um-dropdown-hide",function(){return UM_hide_menus(),!1}),jQuery(document.body).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");return jQuery(this).parents(t).find(e).trigger("click"),UM_hide_menus(),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),"function"==typeof jQuery.fn.select2&&(jQuery(".um-s1").select2({allowClear:!0}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(".um-s3").select2({allowClear:!1,minimumResultsForSearch:-1})),init_tipsy(),"function"==typeof jQuery.fn.um_raty&&(jQuery(".um-rating").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){um_live_field=this.id,um_live_value=e,um_apply_conditions(jQuery(this),!1)}}),jQuery(".um-rating-readonly").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0})),jQuery(document).on("change",'.um-field-area input[type="radio"]',function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeAttr("class").addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeAttr("class").addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",'.um-field-area input[type="checkbox"]',function(){var e=jQuery(this).parents("label");e.hasClass("active")?(e.removeClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline"))}),um_init_datetimepicker(),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src"),r=t.data("mode"),n={data:{mode:r,filename:a,src:i,nonce:um_scripts.nonce},success:function(){t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find("input[type=hidden]").val("empty_file")}};return"register"!==r&&(n.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",n),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href"),r=t.data("mode"),n={data:{mode:r,filename:a,src:i,nonce:um_scripts.nonce},success:function(){t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find("input[type=hidden]").val("empty_file")}};return"register"!==r&&(n.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",n),!1}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e);var a=0;e.find(".um-field-group-body").each(function(){a++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+a),e.attr("name",e.data("key")+"-"+a),e.parent().parent().find("label").attr("for",e.data("key")+"-"+a)})}),0<t&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),a=t.data("max_entries");return 1<t.find(".um-field-group-body").length?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),0<a&&t.find(".um-field-group-body").length<a&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document.body).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this),a=t.parent();a.addClass("loading");var i=1*t.data("pages"),r=1*t.data("page")+1,n=t.data("hook");if("um_load_posts"===n)jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_posts",author:jQuery(this).data("author"),page:r,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),r===i?a.remove():t.data("page",r)}});else if("um_load_comments"===n)jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_comments",user_id:jQuery(this).data("user_id"),page:r,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),r===i?a.remove():t.data("page",r)}});else{var u=jQuery(this).data("args"),o=jQuery(this).parents(".um").find(".um-ajax-items");jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate",hook:n,args:u,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.remove(),o.append(e)}})}}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),a=jQuery(this).data("user_id"),arguments=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_muted_action",hook:t,user_id:a,arguments:arguments,nonce:um_scripts.nonce},success:function(e){}}),!1}),jQuery(document.body).on("click","#um-search-button",function(){var e=jQuery(this).parents(".um-search-form").data("members_page"),t=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){t.push(jQuery(this).val())});var a,i=jQuery(this).parents(".um-search-form").find(".um-search-field").val();if(""===i)a=e;else{for(var r="?",n=0;n<t.length;n++)r+=t[n]+"="+i,n!==t.length-1&&(r+="&");a=e+r}window.location=a}),jQuery(document.body).on("keypress",".um-search-field",function(e){if(13===e.which){var t=jQuery(this).parents(".um-search-form").data("members_page"),a=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){a.push(jQuery(this).val())});var i,r=jQuery(this).val();if(""===r)i=t;else{for(var n="?",u=0;u<a.length;u++)n+=a[u]+"="+r,u!==a.length-1&&(n+="&");i=t+n}window.location=i}}),jQuery('.um-form input[class="um-button"][type="submit"]').removeAttr("disabled"),jQuery(document).one("click",'.um:not(.um-account) .um-form input[class="um-button"][type="submit"]:not(.um-has-recaptcha)',function(){jQuery(this).attr("disabled","disabled"),jQuery(this).parents("form").submit()});var o={};function s(t,e,a){var i=t.parents(".um-directory"),r=t.attr("name");t.find('option[value!=""]').remove(),t.hasClass("um-child-option-disabled")||t.removeAttr("disabled");var n=[];if("yes"===e.post.members_directory&&n.push({id:"",text:"",selected:1}),jQuery.each(e.items,function(e,t){n.push({id:e,text:t,selected:""===t})}),t.select2("destroy"),t.select2({data:n,allowClear:!0,minimumResultsForSearch:10}),"yes"===e.post.members_directory){t.find("option").each(function(){""!==jQuery(this).html()&&jQuery(this).data("value_label",jQuery(this).html()).attr("data-value_label",jQuery(this).html())});var u=um_get_data_for_directory(i,"filter_"+r);if(void 0!==u){u=u.split("||");var o=[];jQuery.each(u,function(e){t.find('option[value="'+u[e]+'"]').length&&o.push(u[e]),t.find('option[value="'+u[e]+'"]').prop("disabled",!0).hide(),1===t.find("option:not(:disabled)").length&&t.prop("disabled",!0),t.select2("destroy").select2(),t.val("").trigger("change")}),o=o.join("||"),u!==o&&(um_set_url_from_data(i,"filter_"+r,o),um_ajax_get_members(i))}um_change_tag(i)}"yes"!==e.post.members_directory&&(void 0===e.field.default||t.data("um-original-value")?""!==t.data("um-original-value")&&t.val(t.data("um-original-value")).trigger("change"):t.val(e.field.default).trigger("change"),0==e.field.editable&&(t.addClass("um-child-option-disabled"),t.attr("disabled","disabled")))}jQuery("select[data-um-parent]").each(function(){var r=jQuery(this),n=r.data("um-parent"),u=r.data("um-ajax-source");r.attr("data-um-init-field",!0),jQuery(document).on("change",'select[name="'+n+'"]',function(){var t,e=jQuery(this),a=e.closest("form").find('input[type="hidden"][name="form_id"]').val();if("yes"===r.attr("data-member-directory")){var i=e.parents(".um-directory");t=void 0!==(t=um_get_data_for_directory(i,"filter_"+n))?t.split("||"):""}else t=e.val();if(void 0!==t&&""!==t&&"object"!=typeof o[t]){if(void 0!==r.um_wait&&!1!==r.um_wait)return;r.um_wait=!0,jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_select_options",parent_option_name:n,parent_option:t,child_callback:u,child_name:r.attr("name"),members_directory:r.attr("data-member-directory"),form_id:a,nonce:um_scripts.nonce},success:function(e){"success"===e.status&&""!==t&&(o[t]=e,s(r,e,t)),void 0!==e.debug&&console.log(e),r.um_wait=!1},error:function(e){console.log(e),r.um_wait=!1}})}void 0!==t&&""!==t&&"object"==typeof o[t]&&setTimeout(s,10,r,o[t],t),void 0===t&&""!==t||(r.find('option[value!=""]').remove(),r.val("").trigger("change"))}),jQuery('select[name="'+n+'"]').trigger("change")})});
includes/admin/assets/css/um-admin-forms.css CHANGED
@@ -14,6 +14,28 @@
14
  padding: 0 0 15px 0;
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  input[type=text].um-forms-field.um-long-field,
18
  select.um-forms-field.um-long-field,
19
  textarea.um-forms-field.um-long-field {
@@ -64,6 +86,10 @@ textarea.um-forms-field.um-small-field {
64
  margin: 5px 0 0 0;
65
  }
66
 
 
 
 
 
67
  .um-multi-selects-option-line.um-admin-drag-fld {
68
  background: none;
69
  border: none;
@@ -88,6 +114,33 @@ textarea.um-forms-field.um-small-field {
88
  box-sizing: border-box;
89
  }
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  .um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper {
92
  width: calc( 100% - 90px );
93
  }
@@ -125,6 +178,12 @@ textarea.um-forms-field.um-small-field {
125
  }
126
 
127
  .um-md-default-filters-option-line .um-field-wrapper2 input {
 
 
 
 
 
 
128
  width: calc( 50% - 7px ) !important;
129
  float: left;
130
  }
@@ -136,7 +195,8 @@ textarea.um-forms-field.um-small-field {
136
  display: block;
137
  }
138
 
139
- .um-md-default-filters-option-line .um-field-wrapper2 input:first-child {
 
140
  margin-right: 11px;
141
  }
142
 
@@ -190,6 +250,10 @@ textarea.um-forms-field.um-small-field {
190
  width:calc( 100% - 20px );
191
  }
192
 
 
 
 
 
193
 
194
  @media screen and (max-width: 782px) {
195
  .um-form-fields-section {
@@ -269,4 +333,33 @@ textarea.um-forms-field.um-small-field {
269
 
270
  .um-forms-line[data-conditional] {
271
  display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
  }
14
  padding: 0 0 15px 0;
15
  }
16
 
17
+ .um-form-table.um-top-label .um-forms-line[data-field_type="icon"] td label {
18
+ width: 100%;
19
+ display: block;
20
+ margin: 0 0 5px 0;
21
+ }
22
+
23
+ .um_admin_fonticon_wrapper {
24
+ display: flex;
25
+ flex-direction: row;
26
+ flex-wrap: nowrap;
27
+ justify-content: flex-start;
28
+ align-items: center;
29
+ }
30
+
31
+ .um-admin-icon-value {
32
+ line-height: 1;
33
+ }
34
+
35
+ .um_admin_fonticon_wrapper .um-admin-icon-value i {
36
+ top: 0;
37
+ }
38
+
39
  input[type=text].um-forms-field.um-long-field,
40
  select.um-forms-field.um-long-field,
41
  textarea.um-forms-field.um-long-field {
86
  margin: 5px 0 0 0;
87
  }
88
 
89
+ .um-md-default-filters-option-line .um.um-field-wrapper2 {
90
+ margin: 5px 0 0 0;
91
+ }
92
+
93
  .um-multi-selects-option-line.um-admin-drag-fld {
94
  background: none;
95
  border: none;
114
  box-sizing: border-box;
115
  }
116
 
117
+ .um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields {
118
+ margin: 5px 0 0 0;
119
+ }
120
+
121
+ .um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label {
122
+ float:left;
123
+ width: 100%;
124
+ line-height: 30px;
125
+ box-sizing: border-box;
126
+ margin: 0 !important;
127
+ padding: 0 !important;
128
+ font-weight: bold;
129
+ display: flex;
130
+ flex-direction: row;
131
+ flex-wrap: nowrap;
132
+ justify-content: space-between;
133
+ align-items: baseline;
134
+ }
135
+
136
+ .um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type="text"] {
137
+ width: auto;
138
+ display: inline;
139
+ font-weight: normal;
140
+ max-width: 70%;
141
+ flex: 0.9;
142
+ }
143
+
144
  .um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper {
145
  width: calc( 100% - 90px );
146
  }
178
  }
179
 
180
  .um-md-default-filters-option-line .um-field-wrapper2 input {
181
+ width: 100%;
182
+ float: left;
183
+ }
184
+
185
+ .um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter,
186
+ .um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter {
187
  width: calc( 50% - 7px ) !important;
188
  float: left;
189
  }
195
  display: block;
196
  }
197
 
198
+ .um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter:first-child,
199
+ .um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter:first-child {
200
  margin-right: 11px;
201
  }
202
 
250
  width:calc( 100% - 20px );
251
  }
252
 
253
+ .um-multi-text-option-line,
254
+ .um-multi-selects-option-line {
255
+ margin: 0 0 5px 0;
256
+ }
257
 
258
  @media screen and (max-width: 782px) {
259
  .um-form-fields-section {
333
 
334
  .um-forms-line[data-conditional] {
335
  display: none;
336
+ }
337
+
338
+
339
+
340
+ /* Same page update field */
341
+ .um-forms-line td .um-same-page-update-wrapper {
342
+ display: none;
343
+ margin: 7px 0 0 0;
344
+ }
345
+
346
+ .um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update {
347
+ margin: 7px 0 0 0;
348
+ }
349
+
350
+ .um-forms-line td .um-same-page-update-wrapper .upgrade_log {
351
+ margin: 7px 0 0 0;
352
+ width:100%;
353
+ height:150px;
354
+ overflow: auto;
355
+ border: 1px solid #a1a1a1;
356
+ }
357
+
358
+ .um-forms-line[data-field_type="same_page_update"] {
359
+ vertical-align: baseline;
360
+ }
361
+
362
+ .um-forms-line[data-field_type="same_page_update"] th,
363
+ .um-forms-line[data-field_type="same_page_update"] td {
364
+ vertical-align: baseline;
365
  }
includes/admin/assets/js/um-admin-forms.js CHANGED
@@ -1,6 +1,146 @@
1
  jQuery(document).ready( function() {
2
 
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  /**
5
  * Multi-selects sort
6
  */
@@ -10,6 +150,61 @@ jQuery(document).ready( function() {
10
  forcePlaceholderSize: true
11
  });
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  /**
15
  * Multi-selects field
@@ -26,6 +221,10 @@ jQuery(document).ready( function() {
26
  });
27
 
28
  jQuery( '.um-multi-selects-add-option' ).click( function() {
 
 
 
 
29
  var list = jQuery(this).siblings('ul.um-multi-selects-list');
30
 
31
  var sortable = list.hasClass( 'um-sortable-multi-selects' );
@@ -266,18 +465,33 @@ jQuery(document).ready( function() {
266
  });
267
 
268
  function um_set_range_label( slider, ui ) {
269
- var placeholder = slider.siblings( '.um-slider-range' ).data( 'placeholder' );
270
-
271
- if( ui ) {
272
- placeholder = placeholder.replace( '\{min_range\}', ui.values[ 0 ] )
273
- .replace( '\{max_range\}', ui.values[ 1 ] )
274
- .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
275
- .data('label') );
 
 
 
 
 
 
 
 
 
276
  } else {
277
- placeholder = placeholder.replace( '\{min_range\}', slider.slider( "values", 0 ) )
278
- .replace( '\{max_range\}', slider.slider( "values", 1 ) )
279
- .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
280
- .data('label') );
 
 
 
 
 
 
281
  }
282
  slider.siblings( '.um-slider-range' ).html( placeholder );
283
 
1
  jQuery(document).ready( function() {
2
 
3
 
4
+ /**
5
+ * Same page upgrade field
6
+ */
7
+ jQuery( document.body ).on( 'click', '.um-forms-field[data-log-object]', function() {
8
+ var obj = jQuery( this ).data( 'log-object' );
9
+ if ( jQuery( this ).is( ':checked' ) ) {
10
+ jQuery( this ).siblings( '.um-same-page-update-' + obj ).show();
11
+ } else {
12
+ jQuery( this ).siblings( '.um-same-page-update-' + obj ).hide();
13
+ }
14
+ });
15
+
16
+
17
+
18
+ jQuery( document.body ).on( 'click', '.um-admin-form-same-page-update', function() {
19
+ var field_key = jQuery(this).data('upgrade_cb');
20
+ jQuery(this).prop( 'disabled', true );
21
+
22
+ um_add_same_page_log( field_key, wp.i18n.__( 'Upgrade Process Started...', 'ultimate-member' ) );
23
+
24
+ if ( field_key === 'sync_metatable' ) {
25
+ var metadata_pages = 0;
26
+ var metadata_per_page = 500;
27
+ var current_page;
28
+
29
+ jQuery.ajax({
30
+ url: wp.ajax.settings.url,
31
+ type: 'POST',
32
+ dataType: 'json',
33
+ data: {
34
+ action: 'um_same_page_update',
35
+ cb_func: 'um_usermeta_fields',
36
+ nonce: um_admin_scripts.nonce
37
+ },
38
+ success: function( response ) {
39
+ get_metadata();
40
+ },
41
+ error: function() {
42
+ um_same_page_something_wrong( field_key );
43
+ }
44
+ });
45
+
46
+
47
+ /**
48
+ *
49
+ * @returns {boolean}
50
+ */
51
+ function get_metadata() {
52
+ current_page = 1;
53
+
54
+ um_add_same_page_log( field_key, wp.i18n.__( 'Getting metadata', 'ultimate-member' ) );
55
+ jQuery.ajax({
56
+ url: wp.ajax.settings.url,
57
+ type: 'POST',
58
+ dataType: 'json',
59
+ data: {
60
+ action: 'um_same_page_update',
61
+ cb_func: 'um_get_metadata',
62
+ nonce: um_admin_scripts.nonce
63
+ },
64
+ success: function( response ) {
65
+ if ( typeof response.data.count != 'undefined' ) {
66
+ um_add_same_page_log( field_key, wp.i18n.__( 'There are ', 'ultimate-member' ) + response.data.count + wp.i18n.__( ' metadata rows...', 'ultimate-member' ) );
67
+ um_add_same_page_log( field_key, wp.i18n.__( 'Start metadata upgrading...', 'ultimate-member' ) );
68
+
69
+ metadata_pages = Math.ceil( response.data.count / metadata_per_page );
70
+
71
+ update_metadata_per_page();
72
+ } else {
73
+ um_same_page_wrong_ajax( field_key );
74
+ }
75
+ },
76
+ error: function() {
77
+ um_same_page_something_wrong( field_key );
78
+ }
79
+ });
80
+
81
+ return false;
82
+ }
83
+
84
+
85
+ function update_metadata_per_page() {
86
+ if ( current_page <= metadata_pages ) {
87
+ jQuery.ajax({
88
+ url: wp.ajax.settings.url,
89
+ type: 'POST',
90
+ dataType: 'json',
91
+ data: {
92
+ action: 'um_same_page_update',
93
+ cb_func: 'um_update_metadata_per_page',
94
+ page: current_page,
95
+ nonce: um_admin_scripts.nonce
96
+ },
97
+ success: function( response ) {
98
+ if ( typeof response.data != 'undefined' ) {
99
+ um_add_same_page_log( field_key, response.data.message );
100
+ current_page++;
101
+ update_metadata_per_page();
102
+ } else {
103
+ um_same_page_wrong_ajax( field_key );
104
+ }
105
+ },
106
+ error: function() {
107
+ um_same_page_something_wrong( field_key );
108
+ }
109
+ });
110
+ } else {
111
+ window.location = um_forms_data.successfully_redirect;
112
+ }
113
+ }
114
+ }
115
+ });
116
+
117
+
118
+
119
+ /**
120
+ *
121
+ * @param field_key
122
+ * @param line
123
+ */
124
+ function um_add_same_page_log( field_key, line ) {
125
+ var log_field = jQuery( '.um-same-page-update-' + field_key ).find( '.upgrade_log' );
126
+ var previous_html = log_field.html();
127
+ log_field.html( previous_html + line + "<br />" );
128
+ }
129
+
130
+
131
+ function um_same_page_wrong_ajax( field_key ) {
132
+ um_add_same_page_log( field_key, wp.i18n.__( 'Wrong AJAX response...', 'ultimate-member' ) );
133
+ um_add_same_page_log( field_key, wp.i18n.__( 'Your upgrade was crashed, please contact with support', 'ultimate-member' ) );
134
+ }
135
+
136
+
137
+ function um_same_page_something_wrong( field_key ) {
138
+ um_add_same_page_log( field_key, wp.i18n.__( 'Something went wrong with AJAX request...', 'ultimate-member' ) );
139
+ um_add_same_page_log( field_key, wp.i18n.__( 'Your upgrade was crashed, please contact with support', 'ultimate-member' ) );
140
+ }
141
+
142
+
143
+
144
  /**
145
  * Multi-selects sort
146
  */
150
  forcePlaceholderSize: true
151
  });
152
 
153
+ jQuery('.um-multi-selects-list[data-field_id="_um_sorting_fields"] li').each( function() {
154
+ var if_other = jQuery(this).find( '.um-field-wrapper:not(.um-custom-order-fields) select' ).val();
155
+ if ( if_other === 'other' ) {
156
+ jQuery(this).find( '.um-field-wrapper.um-custom-order-fields' ).show();
157
+ } else {
158
+ jQuery(this).find( '.um-field-wrapper.um-custom-order-fields' ).hide();
159
+ }
160
+ });
161
+
162
+ jQuery( '.um-forms-line[data-field_type="md_sorting_fields"] .um-multi-selects-add-option' ).click( function() {
163
+ var list = jQuery(this).siblings('ul.um-multi-selects-list');
164
+
165
+ var sortable = list.hasClass( 'um-sortable-multi-selects' );
166
+
167
+ var field_id = list.data('field_id');
168
+ var k = 0;
169
+ if ( list.find( 'li:last select.um-forms-field' ).length > 0 ) {
170
+ k = list.find( 'li:last select.um-forms-field' ).attr('id').split("-");
171
+ k = k[1]*1 + 1;
172
+ }
173
+
174
+ var selector_html = jQuery( '<div>' ).append( list.siblings('.um-hidden-multi-selects').clone() ).html();
175
+
176
+ var html = '<li class="um-multi-selects-option-line' + ( sortable ? ' um-admin-drag-fld' : '' ) + '">';
177
+ if ( sortable ) {
178
+ html += '<span class="um-field-icon"><i class="um-faicon-sort"></i></span>';
179
+ }
180
+
181
+ html += '<span class="um-field-wrapper">' + selector_html + '</span>' +
182
+ '<span class="um-field-control">' +
183
+ '<a href="javascript:void(0);" class="um-select-delete">' + wp.i18n.__( 'Remove', 'ultimate-member' ) + '</a>' +
184
+ '</span>' +
185
+ '<span class="um-field-wrapper um-custom-order-fields"><label>' + wp.i18n.__( 'Meta key', 'ultimate-member' ) + ':&nbsp;<input type="text" name="meta_key" /></label></span>' +
186
+ '<span class="um-field-wrapper um-custom-order-fields"><label>' + wp.i18n.__( 'Label', 'ultimate-member' ) + ':&nbsp;<input type="text" name="label" /></label></span>' +
187
+ '</li>';
188
+ list.append( html );
189
+
190
+ list.find('li:last .um-hidden-multi-selects').attr('name', jQuery(this).data('name') ).
191
+ addClass('um-forms-field um-long-field').removeClass('um-hidden-multi-selects').attr('id', list.data('id_attr') + '-' + k).trigger('change');
192
+
193
+ jQuery( '#' + list.data('id_attr') + '-' + k ).parents('li').find('.um-field-wrapper.um-custom-order-fields input[name="meta_key"]').attr('name', 'um_metadata[_um_sorting_fields][other_data][' + k + '][meta_key]');
194
+ jQuery( '#' + list.data('id_attr') + '-' + k ).parents('li').find('.um-field-wrapper.um-custom-order-fields input[name="label"]').attr('name', 'um_metadata[_um_sorting_fields][other_data][' + k + '][label]');
195
+ });
196
+
197
+
198
+ jQuery( document.body ).on( 'change', '.um-multi-selects-list[data-field_id="_um_sorting_fields"] .um-field-wrapper:not(.um-custom-order-fields) select', function() {
199
+ var if_other = jQuery(this).val();
200
+
201
+ if ( if_other === 'other' ) {
202
+ jQuery(this).parents('li').find( '.um-field-wrapper.um-custom-order-fields' ).show();
203
+ } else {
204
+ jQuery(this).parents('li').find( '.um-field-wrapper.um-custom-order-fields' ).hide();
205
+ }
206
+ });
207
+
208
 
209
  /**
210
  * Multi-selects field
221
  });
222
 
223
  jQuery( '.um-multi-selects-add-option' ).click( function() {
224
+ if ( jQuery(this).parents( '.um-forms-line[data-field_type="md_sorting_fields"]' ).length ) {
225
+ return;
226
+ }
227
+
228
  var list = jQuery(this).siblings('ul.um-multi-selects-list');
229
 
230
  var sortable = list.hasClass( 'um-sortable-multi-selects' );
465
  });
466
 
467
  function um_set_range_label( slider, ui ) {
468
+ console.log( slider );
469
+ var placeholder = '';
470
+ var placeholder_s = slider.siblings( '.um-slider-range' ).data( 'placeholder-s' );
471
+ var placeholder_p = slider.siblings( '.um-slider-range' ).data( 'placeholder-p' );
472
+
473
+ if ( ui ) {
474
+ if ( ui.values[ 0 ] === ui.values[ 1 ] ) {
475
+ placeholder = placeholder_s.replace( '\{value\}', ui.values[ 0 ] )
476
+ .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
477
+ .data('label') );
478
+ } else {
479
+ placeholder = placeholder_p.replace( '\{min_range\}', ui.values[ 0 ] )
480
+ .replace( '\{max_range\}', ui.values[ 1 ] )
481
+ .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
482
+ .data('label') );
483
+ }
484
  } else {
485
+ if ( slider.slider( "values", 0 ) === slider.slider( "values", 1 ) ) {
486
+ placeholder = placeholder_s.replace( '\{value\}', slider.slider( "values", 0 ) )
487
+ .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
488
+ .data('label') );
489
+ } else {
490
+ placeholder = placeholder_p.replace( '\{min_range\}', slider.slider( "values", 0 ) )
491
+ .replace( '\{max_range\}', slider.slider( "values", 1 ) )
492
+ .replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
493
+ .data('label') );
494
+ }
495
  }
496
  slider.siblings( '.um-slider-range' ).html( placeholder );
497
 
includes/admin/assets/js/um-admin-modal.js CHANGED
@@ -387,13 +387,13 @@ jQuery(document).ready(function() {
387
  jQuery(document.body).on('click', '#UM_fonticons a.um-admin-modal-back:not(.um-admin-modal-cancel)', function(){
388
  var v_id = '';
389
  var icon_selected = jQuery(this).attr('data-code');
390
- if (icon_selected != ''){
391
  if ( jQuery(this).attr('data-modal') ) {
392
  v_id = '#' + jQuery(this).attr('data-modal');
393
  } else {
394
  v_id = '.postbox';
395
  }
396
- jQuery( v_id ).find('input#_icon,input#_um_icon,input#notice__um_icon').val( icon_selected );
397
  jQuery( v_id ).find('span.um-admin-icon-value').html('<i class="'+icon_selected+'"></i>');
398
  jQuery( v_id ).find('.um-admin-icon-clear').show();
399
  }
387
  jQuery(document.body).on('click', '#UM_fonticons a.um-admin-modal-back:not(.um-admin-modal-cancel)', function(){
388
  var v_id = '';
389
  var icon_selected = jQuery(this).attr('data-code');
390
+ if ( icon_selected != '' ) {
391
  if ( jQuery(this).attr('data-modal') ) {
392
  v_id = '#' + jQuery(this).attr('data-modal');
393
  } else {
394
  v_id = '.postbox';
395
  }
396
+ jQuery( v_id ).find('input#_icon,input#_um_icon,input#notice__um_icon,input#um_profile_tab__icon').val( icon_selected );
397
  jQuery( v_id ).find('span.um-admin-icon-value').html('<i class="'+icon_selected+'"></i>');
398
  jQuery( v_id ).find('.um-admin-icon-clear').show();
399
  }
includes/admin/core/class-admin-ajax-hooks.php CHANGED
@@ -28,6 +28,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Ajax_Hooks' ) ) {
28
  add_action( 'wp_ajax_um_populate_dropdown_options', array( UM()->builder(), 'populate_dropdown_options' ) );
29
  add_action( 'wp_ajax_um_rated', array( UM()->admin_menu(), 'ultimatemember_rated' ) );
30
  add_action( 'wp_ajax_um_member_directory_default_filter_settings', array( UM()->member_directory(), 'default_filter_settings' ) );
 
 
31
  }
32
 
33
  }
28
  add_action( 'wp_ajax_um_populate_dropdown_options', array( UM()->builder(), 'populate_dropdown_options' ) );
29
  add_action( 'wp_ajax_um_rated', array( UM()->admin_menu(), 'ultimatemember_rated' ) );
30
  add_action( 'wp_ajax_um_member_directory_default_filter_settings', array( UM()->member_directory(), 'default_filter_settings' ) );
31
+
32
+ add_action( 'wp_ajax_um_same_page_update', array( UM()->admin_settings(), 'same_page_update_ajax' ) );
33
  }
34
 
35
  }
includes/admin/core/class-admin-builder.php CHANGED
@@ -635,7 +635,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
635
  * }
636
  * ?>
637
  */
638
- $array = apply_filters( "um_admin_pre_save_fields_hook", $array );
639
 
640
  /**
641
  * UM hook
@@ -666,23 +666,23 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
666
  */
667
  extract( $array['post'] );
668
 
669
- if ( empty( $output['error'] ) ){
670
 
671
  $save = array();
672
  $save[ $_metakey ] = null;
673
- foreach( $array['post'] as $key => $val){
674
 
675
- if ( substr( $key, 0, 1) === '_' && $val != '' ) { // field attribute
676
  $new_key = ltrim ($key,'_');
677
 
678
  if ( $new_key == 'options' ) {
679
  //$save[ $_metakey ][$new_key] = explode(PHP_EOL, $val);
680
- $save[ $_metakey ][$new_key] = preg_split('/[\r\n]+/', $val, -1, PREG_SPLIT_NO_EMPTY);
681
  } else {
682
- $save[ $_metakey ][$new_key] = $val;
683
  }
684
 
685
- } else if ( strstr( $key, 'um_editor' ) ) {
686
  $save[ $_metakey ]['content'] = $val;
687
  }
688
 
@@ -711,7 +711,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
711
  * }
712
  * ?>
713
  */
714
- $field_args = apply_filters("um_admin_pre_save_field_to_form", $field_args );
715
 
716
  UM()->fields()->update_field( $field_ID, $field_args, $post_id );
717
 
@@ -735,7 +735,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
735
  * }
736
  * ?>
737
  */
738
- $field_args = apply_filters("um_admin_pre_save_field_to_db", $field_args );
739
 
740
  if ( ! isset( $array['args']['form_only'] ) ) {
741
  if ( ! isset( UM()->builtin()->predefined_fields[ $field_ID ] ) ) {
635
  * }
636
  * ?>
637
  */
638
+ $array = apply_filters( 'um_admin_pre_save_fields_hook', $array );
639