Version Description
Download this release
Release Info
Developer | nsinelnikov |
Plugin | Ultimate Member – User Profile & Membership Plugin |
Version | 2.2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.2 to 2.2.3
- assets/js/um-members.js +8 -2
- assets/js/um-members.min.js +1 -1
- assets/js/um-modal.js +1 -0
- assets/js/um-modal.min.js +1 -1
- assets/js/um-scripts.js +7 -0
- assets/js/um-scripts.min.js +1 -1
- includes/admin/core/class-admin-dragdrop.php +249 -249
- includes/admin/core/class-admin-metabox.php +2427 -2427
- includes/admin/core/class-admin-notices.php +2 -1
- includes/admin/core/class-admin-settings.php +3455 -3437
- includes/admin/templates/access/restrict_content.php +164 -164
- includes/class-config.php +807 -805
- includes/core/class-access.php +1435 -1276
- includes/core/class-external-integrations.php +26 -1
- includes/core/class-fields.php +4767 -4779
assets/js/um-members.js
CHANGED
@@ -303,12 +303,14 @@ function um_ajax_get_members( directory, args ) {
|
|
303 |
var filter_name = filter.find('select').attr('name');
|
304 |
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
305 |
if ( typeof value != 'undefined' ) {
|
|
|
306 |
request[ filter_name ] = value.split( '||' );
|
307 |
}
|
308 |
} else if ( filter.hasClass( 'um-text-filter-type' ) && filter.find('input[type="text"]').length ) {
|
309 |
var filter_name = filter.find('input[type="text"]').attr('name');
|
310 |
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
311 |
if ( typeof value != 'undefined' ) {
|
|
|
312 |
request[ filter_name ] = value;
|
313 |
}
|
314 |
} else {
|
@@ -491,9 +493,11 @@ function um_get_filters_data( directory ) {
|
|
491 |
filter_title = filter.find('select').data('placeholder');
|
492 |
|
493 |
var filter_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
|
|
494 |
if ( typeof filter_value == 'undefined' ) {
|
495 |
filter_value = [];
|
496 |
} else {
|
|
|
497 |
filter_value = filter_value.split( '||' );
|
498 |
}
|
499 |
|
@@ -956,7 +960,8 @@ jQuery(document.body).ready( function() {
|
|
956 |
|
957 |
//filtration process
|
958 |
jQuery( document.body ).on( 'change', '.um-directory .um-search-filter select', function() {
|
959 |
-
var
|
|
|
960 |
|
961 |
if ( selected_val === '' ) {
|
962 |
return;
|
@@ -991,7 +996,7 @@ jQuery(document.body).ready( function() {
|
|
991 |
}
|
992 |
|
993 |
//disable options and disable select if all options are disabled
|
994 |
-
jQuery(this).find('option[value="' +
|
995 |
if ( jQuery(this).find('option:not(:disabled)').length === 1 ) {
|
996 |
jQuery(this).prop('disabled', true);
|
997 |
}
|
@@ -1115,6 +1120,7 @@ jQuery(document.body).ready( function() {
|
|
1115 |
if ( typeof current_value == 'undefined' ) {
|
1116 |
current_value = [];
|
1117 |
} else {
|
|
|
1118 |
current_value = current_value.split( '||' );
|
1119 |
}
|
1120 |
|
303 |
var filter_name = filter.find('select').attr('name');
|
304 |
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
305 |
if ( typeof value != 'undefined' ) {
|
306 |
+
value = um_unsanitize_value( value );
|
307 |
request[ filter_name ] = value.split( '||' );
|
308 |
}
|
309 |
} else if ( filter.hasClass( 'um-text-filter-type' ) && filter.find('input[type="text"]').length ) {
|
310 |
var filter_name = filter.find('input[type="text"]').attr('name');
|
311 |
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
312 |
if ( typeof value != 'undefined' ) {
|
313 |
+
value = um_unsanitize_value( value );
|
314 |
request[ filter_name ] = value;
|
315 |
}
|
316 |
} else {
|
493 |
filter_title = filter.find('select').data('placeholder');
|
494 |
|
495 |
var filter_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
496 |
+
|
497 |
if ( typeof filter_value == 'undefined' ) {
|
498 |
filter_value = [];
|
499 |
} else {
|
500 |
+
filter_value = um_unsanitize_value( filter_value );
|
501 |
filter_value = filter_value.split( '||' );
|
502 |
}
|
503 |
|
960 |
|
961 |
//filtration process
|
962 |
jQuery( document.body ).on( 'change', '.um-directory .um-search-filter select', function() {
|
963 |
+
var selected_val_raw = jQuery(this).val();
|
964 |
+
var selected_val = um_sanitize_value( selected_val_raw );
|
965 |
|
966 |
if ( selected_val === '' ) {
|
967 |
return;
|
996 |
}
|
997 |
|
998 |
//disable options and disable select if all options are disabled
|
999 |
+
jQuery(this).find('option[value="' + selected_val_raw + '"]').prop('disabled', true).hide();
|
1000 |
if ( jQuery(this).find('option:not(:disabled)').length === 1 ) {
|
1001 |
jQuery(this).prop('disabled', true);
|
1002 |
}
|
1120 |
if ( typeof current_value == 'undefined' ) {
|
1121 |
current_value = [];
|
1122 |
} else {
|
1123 |
+
current_value = um_unsanitize_value( current_value );
|
1124 |
current_value = current_value.split( '||' );
|
1125 |
}
|
1126 |
|
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={};Array.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 s="?"+(d=wp.hooks.applyFilters("um_member_directory_url_attrs",d)).join("&");"?"===s&&(s=""),window.history.pushState("string","UM Member Directory",window.location.origin+window.location.pathname+s)}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(u,e){var t=um_members_get_hash(u);if(wp.hooks.applyFilters("um_member_directory_get_members_allow",!0,t,u)){var r=um_get_current_page(u),a=um_get_search(u),i=um_get_sort(u),m=-(new Date).getTimezoneOffset()/60,_={directory_id:t,page:r,search:a,sorting:i,gmt_offset:m,post_refferer:u.data("base-post"),nonce:um_scripts.nonce};u.find(".um-search-filter").length&&u.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(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"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(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"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(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"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!==(s=um_get_data_for_directory(u,"filter_"+r))&&(_[r]=s.split("||"))}else if(e.hasClass("um-text-filter-type")&&e.find('input[type="text"]').length){var s;r=e.find('input[type="text"]').attr("name");void 0!==(s=um_get_data_for_directory(u,"filter_"+r))&&(_[r]=s)}else _=wp.hooks.applyFilters("um_member_directory_custom_filter_handler",_,e,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(u,e);var r=wp.template("um-members-pagination");u.find(".um-members-pagination-box").html(r(e)),u.data("total_pages",e.pagination.total_pages),e.pagination.total_pages?(u.find(".um-member-directory-sorting-options").prop("disabled",!1),u.find(".um-member-directory-view-type").removeClass("um-disabled")):(u.find(".um-member-directory-sorting-options").prop("disabled",!0),u.find(".um-member-directory-view-type").addClass("um-disabled")),wp.hooks.doAction("um_member_directory_loaded",u,e),um_init_new_dropdown(),um_members_hide_preloader(u)},error:function(e){console.log(e),um_members_hide_preloader(u)}})}else setTimeout(um_ajax_get_members,600,u,e)}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();var m=wp.hooks.applyFilters("um_member_directory_generate_header",!1,e);(void 0!==r.is_search&&r.is_search||m)&&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(r){r.find(".um-member").length&&r.imagesLoaded(function(){var e=wp.hooks.applyFilters("um_member_directory_grid_masonry_attrs",{itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"},r);r.masonry(e).on("layoutComplete",function(e,r){jQuery(document).trigger("um_grid_initialized",[e,r])})})}function um_get_filters_data(u){var _=[];return u.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(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.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(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.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(u,"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.hasClass("um-text-filter-type")&&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(u,"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(u,"filter_"+t+"_from"),s=um_get_data_for_directory(u,"filter_"+t+"_to");if(void 0===r&&void 0===s)return;e=r===s?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}",s).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,s],type:d})}else _=wp.hooks.applyFilters("um_member_directory_get_filter_data",_,u,i)}),_}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"),t=um_sanitize_value(e.find(".um-search-line").val());if(t===r||""===t&&void 0===r)um_members_hide_preloader(e);else{e.data("general_search",t),um_set_url_from_data(e,"search",t),e.data("page",1),um_set_url_from_data(e,"page","");var a=!1;if(!(a=wp.hooks.applyFilters("um_member_directory_ignore_after_search",a,e)))if(1===e.data("must-search")&&(t=um_get_search(e),0===e.find(".um-members-filter-remove").length&&!t))return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),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);var e=jQuery(this);e.select2("destroy").select2({dropdownParent:e.parent()})}),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_init_new_dropdown()}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-new-dropdown[data-element=".um-member-directory-sorting-a"] li a',function(){if(1!==jQuery(this).data("selected")){var e=jQuery(this).data("directory-hash"),r=jQuery('.um-directory[data-hash="'+e+'"]');if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=jQuery(this).html(),a=jQuery(this).data("value");r.data("sorting",a),um_set_url_from_data(r,"sort",a),um_ajax_get_members(r),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"] a[data-value="'+a+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),r.find(".um-member-directory-sorting-a").find("> a").html(t)}}}),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").on("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(){var e=um_sanitize_value(jQuery(this).val());if(""!==e){var r=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=jQuery(this).prop("name"),a=um_get_data_for_directory(r,"filter_"+t);a=void 0===a?[]:a.split("||"),-1===jQuery.inArray(e,a)&&(a.push(e),um_set_url_from_data(r,"filter_"+t,a=a.join("||")),r.data("page",1),um_set_url_from_data(r,"page","")),jQuery(this).find('option[value="'+e+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var i=jQuery(this);i.select2("destroy").select2({dropdownParent:i.parent()}),i.val("").trigger("change"),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("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=um_sanitize_value(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=um_sanitize_value(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({dropdownParent:m.parent()}),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"),s=d.slider("option");d.slider("values",[s.min,s.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("")):wp.hooks.doAction("um_member_directory_filter_remove",a,e,t,r);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 u=!1;if(!(u=wp.hooks.applyFilters("um_member_directory_ignore_after_search",u,e)))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, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),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 s=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(s)){um_members_show_preloader(s),s.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(s,"filter_"+e,""),jQuery('.um-search-filter input[name="'+e+'"]').val("");else if("select"===t){var a=um_get_data_for_directory(s,"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(s,"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({dropdownParent:i.parent()}),0<s.find('.um-search-filter select[data-um-parent="'+e+'"]').length&&i.trigger("change")}else if("slider"===t){um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"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(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):"timepicker"===t?(um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):wp.hooks.doAction("um_member_directory_clear_filters",t,s,e,r)}),s.data("page",1),um_set_url_from_data(s,"page",""),s.find(".um-members-filter-tag").remove(),0===s.find(".um-members-filter-remove").length?(s.find(".um-clear-filters").hide(),s.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(s.find(".um-clear-filters").show(),s.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,s)))if(1===s.data("must-search"))if(!um_get_search(s))return s.data("searched",0),s.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),s.find(".um-member-directory-sorting-options").prop("disabled",!0),s.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",s),void um_members_hide_preloader(s);s.find(".um-member-directory-sorting-options").prop("disabled",!1),s.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(s)}}),wp.hooks.doAction("um_member_directory_on_first_pages_loading"),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_members_show_preloader(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 s=jQuery(this),u=new Date(1e3*s.data("date_min")),_=new Date(1e3*s.data("date_max")),e=s.pickadate({selectYears:!0,min:u,max:_,formatSubmit:"yyyy/mm/dd",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");void 0===i&&(i=u/1e3),void 0===m&&(m=_/1e3);var d=e.select/1e3;s.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=s.data("filter_name"),t=s.data("range"),a=um_get_data_for_directory(s.parents(".um-directory"),"filter_"+r+"_"+t);void 0!==a&&e.set("select",1e3*a)}),e.find(".um-timepicker-filter").each(function(){var u=jQuery(this),_=u.attr("id"),o=u.data("filter_name"),n=u.attr("data-min"),l=u.attr("data-max"),e=n.split(":"),r=l.split(":"),t=u.pickatime({format:u.data("format"),interval:parseInt(u.data("intervals")),min:[e[0],e[1]],max:[r[0],r[1]],formatSubmit:"HH:i",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");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 s=jQuery("#"+_).val();"from"===u.data("range")?jQuery("#"+o+"_to").pickatime("picker").set("min",s):jQuery("#"+o+"_from").pickatime("picker").set("max",s),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=u.data("filter_name"),i=u.data("range"),m=um_get_data_for_directory(u.parents(".um-directory"),"filter_"+a+"_"+i);if(void 0!==m){var d=m.split(":");t.set("select",60*d[0]+1*d[1])}}),wp.hooks.doAction("um_member_directory_on_init",e,r);var t=!1;if(!(t=wp.hooks.applyFilters("um_member_directory_ignore_after_search",t,e))&&1===e.data("must-search")){var a=um_get_search(e);if(!um_get_filters_data(e).length&&!a)return}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,e,r)||(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===(s=um_get_data_for_directory(d,"search"))&&(s=""),d.data("general_search",s),d.find(".um-search-line").val(s));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,d))&&1===d.data("must-search")){var s=um_get_search(d);if(!um_get_filters_data(d).length&&!s)return d.data("searched",0),void um_members_hide_preloader(d);d.data("searched",1)}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,d,e)||(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={};Array.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 s="?"+(d=wp.hooks.applyFilters("um_member_directory_url_attrs",d)).join("&");"?"===s&&(s=""),window.history.pushState("string","UM Member Directory",window.location.origin+window.location.pathname+s)}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(u,e){var t=um_members_get_hash(u);if(wp.hooks.applyFilters("um_member_directory_get_members_allow",!0,t,u)){var r=um_get_current_page(u),a=um_get_search(u),i=um_get_sort(u),m=-(new Date).getTimezoneOffset()/60,_={directory_id:t,page:r,search:a,sorting:i,gmt_offset:m,post_refferer:u.data("base-post"),nonce:um_scripts.nonce};u.find(".um-search-filter").length&&u.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(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"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(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"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(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"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!==(s=um_get_data_for_directory(u,"filter_"+r))&&(s=um_unsanitize_value(s),_[r]=s.split("||"))}else if(e.hasClass("um-text-filter-type")&&e.find('input[type="text"]').length){var s;r=e.find('input[type="text"]').attr("name");void 0!==(s=um_get_data_for_directory(u,"filter_"+r))&&(s=um_unsanitize_value(s),_[r]=s)}else _=wp.hooks.applyFilters("um_member_directory_custom_filter_handler",_,e,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(u,e);var r=wp.template("um-members-pagination");u.find(".um-members-pagination-box").html(r(e)),u.data("total_pages",e.pagination.total_pages),e.pagination.total_pages?(u.find(".um-member-directory-sorting-options").prop("disabled",!1),u.find(".um-member-directory-view-type").removeClass("um-disabled")):(u.find(".um-member-directory-sorting-options").prop("disabled",!0),u.find(".um-member-directory-view-type").addClass("um-disabled")),wp.hooks.doAction("um_member_directory_loaded",u,e),um_init_new_dropdown(),um_members_hide_preloader(u)},error:function(e){console.log(e),um_members_hide_preloader(u)}})}else setTimeout(um_ajax_get_members,600,u,e)}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();var m=wp.hooks.applyFilters("um_member_directory_generate_header",!1,e);(void 0!==r.is_search&&r.is_search||m)&&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(r){r.find(".um-member").length&&r.imagesLoaded(function(){var e=wp.hooks.applyFilters("um_member_directory_grid_masonry_attrs",{itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"},r);r.masonry(e).on("layoutComplete",function(e,r){jQuery(document).trigger("um_grid_initialized",[e,r])})})}function um_get_filters_data(u){var _=[];return u.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(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.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(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.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(u,"filter_"+t))?[]:(m=um_unsanitize_value(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.hasClass("um-text-filter-type")&&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(u,"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(u,"filter_"+t+"_from"),s=um_get_data_for_directory(u,"filter_"+t+"_to");if(void 0===r&&void 0===s)return;e=r===s?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}",s).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,s],type:d})}else _=wp.hooks.applyFilters("um_member_directory_get_filter_data",_,u,i)}),_}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"),t=um_sanitize_value(e.find(".um-search-line").val());if(t===r||""===t&&void 0===r)um_members_hide_preloader(e);else{e.data("general_search",t),um_set_url_from_data(e,"search",t),e.data("page",1),um_set_url_from_data(e,"page","");var a=!1;if(!(a=wp.hooks.applyFilters("um_member_directory_ignore_after_search",a,e)))if(1===e.data("must-search")&&(t=um_get_search(e),0===e.find(".um-members-filter-remove").length&&!t))return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),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);var e=jQuery(this);e.select2("destroy").select2({dropdownParent:e.parent()})}),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_init_new_dropdown()}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-new-dropdown[data-element=".um-member-directory-sorting-a"] li a',function(){if(1!==jQuery(this).data("selected")){var e=jQuery(this).data("directory-hash"),r=jQuery('.um-directory[data-hash="'+e+'"]');if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=jQuery(this).html(),a=jQuery(this).data("value");r.data("sorting",a),um_set_url_from_data(r,"sort",a),um_ajax_get_members(r),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"] a[data-value="'+a+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),r.find(".um-member-directory-sorting-a").find("> a").html(t)}}}),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").on("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(){var e=jQuery(this).val(),r=um_sanitize_value(e);if(""!==r){var t=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(t)){um_members_show_preloader(t);var a=jQuery(this).prop("name"),i=um_get_data_for_directory(t,"filter_"+a);i=void 0===i?[]:i.split("||"),-1===jQuery.inArray(r,i)&&(i.push(r),um_set_url_from_data(t,"filter_"+a,i=i.join("||")),t.data("page",1),um_set_url_from_data(t,"page","")),jQuery(this).find('option[value="'+e+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var m=jQuery(this);m.select2("destroy").select2({dropdownParent:m.parent()}),m.val("").trigger("change"),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")}}}),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=um_sanitize_value(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=um_sanitize_value(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=um_unsanitize_value(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({dropdownParent:m.parent()}),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"),s=d.slider("option");d.slider("values",[s.min,s.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("")):wp.hooks.doAction("um_member_directory_filter_remove",a,e,t,r);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 u=!1;if(!(u=wp.hooks.applyFilters("um_member_directory_ignore_after_search",u,e)))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, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),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 s=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(s)){um_members_show_preloader(s),s.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(s,"filter_"+e,""),jQuery('.um-search-filter input[name="'+e+'"]').val("");else if("select"===t){var a=um_get_data_for_directory(s,"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(s,"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({dropdownParent:i.parent()}),0<s.find('.um-search-filter select[data-um-parent="'+e+'"]').length&&i.trigger("change")}else if("slider"===t){um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"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(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):"timepicker"===t?(um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):wp.hooks.doAction("um_member_directory_clear_filters",t,s,e,r)}),s.data("page",1),um_set_url_from_data(s,"page",""),s.find(".um-members-filter-tag").remove(),0===s.find(".um-members-filter-remove").length?(s.find(".um-clear-filters").hide(),s.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(s.find(".um-clear-filters").show(),s.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,s)))if(1===s.data("must-search"))if(!um_get_search(s))return s.data("searched",0),s.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),s.find(".um-member-directory-sorting-options").prop("disabled",!0),s.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",s),void um_members_hide_preloader(s);s.find(".um-member-directory-sorting-options").prop("disabled",!1),s.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(s)}}),wp.hooks.doAction("um_member_directory_on_first_pages_loading"),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_members_show_preloader(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 s=jQuery(this),u=new Date(1e3*s.data("date_min")),_=new Date(1e3*s.data("date_max")),e=s.pickadate({selectYears:!0,min:u,max:_,formatSubmit:"yyyy/mm/dd",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");void 0===i&&(i=u/1e3),void 0===m&&(m=_/1e3);var d=e.select/1e3;s.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=s.data("filter_name"),t=s.data("range"),a=um_get_data_for_directory(s.parents(".um-directory"),"filter_"+r+"_"+t);void 0!==a&&e.set("select",1e3*a)}),e.find(".um-timepicker-filter").each(function(){var u=jQuery(this),_=u.attr("id"),o=u.data("filter_name"),n=u.attr("data-min"),l=u.attr("data-max"),e=n.split(":"),r=l.split(":"),t=u.pickatime({format:u.data("format"),interval:parseInt(u.data("intervals")),min:[e[0],e[1]],max:[r[0],r[1]],formatSubmit:"HH:i",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");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 s=jQuery("#"+_).val();"from"===u.data("range")?jQuery("#"+o+"_to").pickatime("picker").set("min",s):jQuery("#"+o+"_from").pickatime("picker").set("max",s),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=u.data("filter_name"),i=u.data("range"),m=um_get_data_for_directory(u.parents(".um-directory"),"filter_"+a+"_"+i);if(void 0!==m){var d=m.split(":");t.set("select",60*d[0]+1*d[1])}}),wp.hooks.doAction("um_member_directory_on_init",e,r);var t=!1;if(!(t=wp.hooks.applyFilters("um_member_directory_ignore_after_search",t,e))&&1===e.data("must-search")){var a=um_get_search(e);if(!um_get_filters_data(e).length&&!a)return}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,e,r)||(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===(s=um_get_data_for_directory(d,"search"))&&(s=""),d.data("general_search",s),d.find(".um-search-line").val(s));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,d))&&1===d.data("must-search")){var s=um_get_search(d);if(!um_get_filters_data(d).length&&!s)return d.data("searched",0),void um_members_hide_preloader(d);d.data("searched",1)}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,d,e)||(um_ajax_get_members(d),um_change_tag(d))})})});
|
assets/js/um-modal.js
CHANGED
@@ -102,6 +102,7 @@ jQuery(document).ready(function() {
|
|
102 |
user_id = jQuery(this).parents('#um_upload_single').data('user_id');
|
103 |
}
|
104 |
|
|
|
105 |
var form_id = 0;
|
106 |
var mode = '';
|
107 |
if ( jQuery('div.um-field-image[data-key="' + key + '"]').length === 1 ) {
|
102 |
user_id = jQuery(this).parents('#um_upload_single').data('user_id');
|
103 |
}
|
104 |
|
105 |
+
var d;
|
106 |
var form_id = 0;
|
107 |
var mode = '';
|
108 |
if ( jQuery('div.um-field-image[data-key="' + key + '"]').length === 1 ) {
|
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:not(:has(.um-form)) 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),
|
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:not(:has(.um-form)) 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,t=jQuery(this),i=jQuery(this).attr("data-key"),e=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),r=e.find("img").attr("src"),u=e.attr("data-coord"),d=e.find("img").data("file"),m=0;jQuery(this).parents("#um_upload_single").data("user_id")&&(m=jQuery(this).parents("#um_upload_single").data("user_id"));var n=0,o="";if(1===jQuery('div.um-field-image[data-key="'+i+'"]').length){var s=jQuery('div.um-field-image[data-key="'+i+'"]').closest(".um-form");n=s.find('input[name="form_id"]').val(),o=s.attr("data-mode")}u?(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:r,coord:u,user_id:m,key:i,set_id:n,set_mode:o,nonce:um_scripts.nonce},success:function(e){e.success&&(a=new Date,"profile_photo"===i?jQuery(".um-profile-photo-img img").attr("src",e.data.image.source_url+"?"+a.getTime()):"cover_photo"===i&&(jQuery(".um-cover-e").empty().html('<img src="'+e.data.image.source_url+"?"+a.getTime()+'" alt="" />'),jQuery(".um").hasClass("um-editing")&&jQuery(".um-cover-overlay").show()),jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",e.data.image.source_url+"?"+a.getTime()),um_remove_modal(),jQuery("img.cropper-invisible").remove(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find('input[type="hidden"]').val(e.data.image.filename))}})):(a=new Date,jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",r+"?"+a.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find("input[type=hidden]").val(d))}),jQuery(document.body).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal"),t="normal";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
@@ -9,6 +9,13 @@ function um_sanitize_value( value, el ) {
|
|
9 |
return sanitized_value;
|
10 |
}
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
function um_init_datetimepicker() {
|
14 |
jQuery('.um-datepicker:not(.picker__input)').each(function(){
|
9 |
return sanitized_value;
|
10 |
}
|
11 |
|
12 |
+
function um_unsanitize_value( input ) {
|
13 |
+
var e = document.createElement( 'textarea' );
|
14 |
+
e.innerHTML = input;
|
15 |
+
// handle case of empty input
|
16 |
+
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
|
17 |
+
}
|
18 |
+
|
19 |
|
20 |
function um_init_datetimepicker() {
|
21 |
jQuery('.um-datepicker:not(.picker__input)').each(function(){
|
assets/js/um-scripts.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function um_sanitize_value(e,t){var a=document.createElement("div");a.innerText=e;var i=a.innerHTML;return t&&jQuery(t).val(i),i}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,d=n.length?new Date(u):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var s=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(s))}if(d&&"Invalid Date"==d.toString()&&3==u.length){var l=u[1]+"/"+u[2]+"/"+u[0];d=new Date(Date.parse(l))}var c={disable:t,format:e.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}};null!==a&&(c.selectYears=a),null!==o&&(c.min=o),null!==d&&(c.max=d),e.pickadate(c)}),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(){function a(e){var a=jQuery(e.currentTarget),t=a.find(":selected");1<t.length&&t.each(function(e,t){""===t.value&&(t.selected=!1,a.trigger("change"))})}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(){var e=jQuery(this).find(".um-dropdown");return UM.dropdown.show(e),!1}),jQuery(document.body).on("click",".um-dropdown-hide",function(){return UM.dropdown.hideAll(),!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.dropdown.hideAll(),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),"function"==typeof jQuery.fn.select2&&(jQuery(".um-s1").each(function(e){var t=jQuery(this);t.select2({allowClear:!0,dropdownParent:t.parent()}).on("change",a)}),jQuery(".um-s2").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:10,dropdownParent:t.parent()}).on("change",a)}),jQuery(".um-s3").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:-1,dropdownParent:t.parent()}).on("change",a)})),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"]').prop("disabled",!1),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").trigger("submit")});var o={};function d(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.prop("disabled",!1);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,d(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(d,10,r,o[t],t),void 0===t&&""!==t||(r.find('option[value!=""]').remove(),r.val("").trigger("change"))}),jQuery('select[name="'+n+'"]').trigger("change")})});
|
1 |
+
function um_sanitize_value(e,t){var a=document.createElement("div");a.innerText=e;var i=a.innerHTML;return t&&jQuery(t).val(i),i}function um_unsanitize_value(e){var t=document.createElement("textarea");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue}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,d=n.length?new Date(u):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var s=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(s))}if(d&&"Invalid Date"==d.toString()&&3==u.length){var l=u[1]+"/"+u[2]+"/"+u[0];d=new Date(Date.parse(l))}var c={disable:t,format:e.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}};null!==a&&(c.selectYears=a),null!==o&&(c.min=o),null!==d&&(c.max=d),e.pickadate(c)}),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(){function a(e){var a=jQuery(e.currentTarget),t=a.find(":selected");1<t.length&&t.each(function(e,t){""===t.value&&(t.selected=!1,a.trigger("change"))})}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(){var e=jQuery(this).find(".um-dropdown");return UM.dropdown.show(e),!1}),jQuery(document.body).on("click",".um-dropdown-hide",function(){return UM.dropdown.hideAll(),!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.dropdown.hideAll(),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),"function"==typeof jQuery.fn.select2&&(jQuery(".um-s1").each(function(e){var t=jQuery(this);t.select2({allowClear:!0,dropdownParent:t.parent()}).on("change",a)}),jQuery(".um-s2").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:10,dropdownParent:t.parent()}).on("change",a)}),jQuery(".um-s3").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:-1,dropdownParent:t.parent()}).on("change",a)})),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"]').prop("disabled",!1),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").trigger("submit")});var o={};function d(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.prop("disabled",!1);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,d(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(d,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/core/class-admin-dragdrop.php
CHANGED
@@ -1,249 +1,249 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um\admin\core;
|
3 |
-
|
4 |
-
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
-
|
7 |
-
|
8 |
-
if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Class Admin_DragDrop
|
13 |
-
* @package um\admin\core
|
14 |
-
*/
|
15 |
-
class Admin_DragDrop {
|
16 |
-
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Admin_DragDrop constructor.
|
20 |
-
*/
|
21 |
-
function __construct() {
|
22 |
-
add_action( 'admin_footer', array( &$this, 'load_field_order' ), 9 );
|
23 |
-
}
|
24 |
-
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Update order of fields
|
28 |
-
*/
|
29 |
-
public function update_order() {
|
30 |
-
UM()->admin()->check_ajax_nonce();
|
31 |
-
|
32 |
-
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
33 |
-
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @var $form_id
|
38 |
-
*/
|
39 |
-
extract( $_POST );
|
40 |
-
|
41 |
-
if ( isset( $form_id ) ) {
|
42 |
-
$form_id = absint( $form_id );
|
43 |
-
}
|
44 |
-
|
45 |
-
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
46 |
-
|
47 |
-
$this->row_data = get_option( 'um_form_rowdata_' . $form_id, array() );
|
48 |
-
$this->exist_rows = array();
|
49 |
-
|
50 |
-
if ( ! empty( $fields ) ) {
|
51 |
-
foreach ( $fields as $key => $array ) {
|
52 |
-
if ( 'row' === $array['type'] ) {
|
53 |
-
$this->row_data[ $key ] = $array;
|
54 |
-
unset( $fields[ $key ] );
|
55 |
-
}
|
56 |
-
}
|
57 |
-
} else {
|
58 |
-
$fields = array();
|
59 |
-
}
|
60 |
-
|
61 |
-
foreach ( $_POST as $key => $value ) {
|
62 |
-
|
63 |
-
$key =
|
64 |
-
|
65 |
-
// adding rows
|
66 |
-
if ( 0 === strpos( $key, '_um_row_' ) ) {
|
67 |
-
|
68 |
-
$update_args = null;
|
69 |
-
|
70 |
-
$row_id = str_replace( '_um_row_', '', $key );
|
71 |
-
|
72 |
-
if ( strstr( $_POST[ '_um_rowcols_' . $row_id . '_cols' ], ':' ) ) {
|
73 |
-
$cols = sanitize_text_field( $_POST[ '_um_rowcols_' . $row_id . '_cols' ] );
|
74 |
-
} else {
|
75 |
-
$cols = absint( $_POST[ '_um_rowcols_' . $row_id . '_cols' ] );
|
76 |
-
}
|
77 |
-
|
78 |
-
$row_array = array(
|
79 |
-
'type' => 'row',
|
80 |
-
'id' => sanitize_key( $value ),
|
81 |
-
'sub_rows' => absint( $_POST[ '_um_rowsub_' . $row_id . '_rows' ] ),
|
82 |
-
'cols' => $cols,
|
83 |
-
'origin' => sanitize_key( $_POST[ '_um_roworigin_' . $row_id . '_val' ] ),
|
84 |
-
);
|
85 |
-
|
86 |
-
$row_args = $row_array;
|
87 |
-
|
88 |
-
if ( isset( $this->row_data[ $row_array['origin'] ] ) ) {
|
89 |
-
foreach ( $this->row_data[ $row_array['origin'] ] as $k => $v ) {
|
90 |
-
if ( 'position' !== $k && 'metakey' !== $k ) {
|
91 |
-
$update_args[ $k ] = $v;
|
92 |
-
}
|
93 |
-
}
|
94 |
-
if ( isset( $update_args ) ) {
|
95 |
-
$row_args = array_merge( $update_args, $row_array );
|
96 |
-
}
|
97 |
-
$this->exist_rows[] = $key;
|
98 |
-
}
|
99 |
-
|
100 |
-
$fields[ $key ] = $row_args;
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
// change field position
|
105 |
-
if ( 0 === strpos( $key, 'um_position_' ) ) {
|
106 |
-
$field_key = str_replace( 'um_position_', '', $key );
|
107 |
-
if ( isset( $fields[ $field_key ] ) ) {
|
108 |
-
$fields[ $field_key ]['position'] = absint( $value );
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
// change field master row
|
113 |
-
if ( 0 === strpos( $key, 'um_row_' ) ) {
|
114 |
-
$field_key = str_replace( 'um_row_', '', $key );
|
115 |
-
if ( isset( $fields[ $field_key ] ) ) {
|
116 |
-
$fields[ $field_key ]['in_row'] = sanitize_key( $value );
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
// change field sub row
|
121 |
-
if ( 0 === strpos( $key, 'um_subrow_' ) ) {
|
122 |
-
$field_key = str_replace( 'um_subrow_', '', $key );
|
123 |
-
if ( isset( $fields[ $field_key ] ) ) {
|
124 |
-
$fields[ $field_key ]['in_sub_row'] = sanitize_key( $value );
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
// change field column
|
129 |
-
if ( 0 === strpos( $key, 'um_col_' ) ) {
|
130 |
-
$field_key = str_replace( 'um_col_', '', $key );
|
131 |
-
if ( isset( $fields[ $field_key ] ) ) {
|
132 |
-
$fields[ $field_key ]['in_column'] = absint( $value );
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
// add field to group
|
137 |
-
if ( 0 === strpos( $key, 'um_group_' ) ) {
|
138 |
-
$field_key = str_replace( 'um_group_', '', $key );
|
139 |
-
if ( isset( $fields[ $field_key ] ) ) {
|
140 |
-
$fields[ $field_key ]['in_group'] = ! empty( $value ) ? absint( $value ) : '';
|
141 |
-
}
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
foreach ( $this->row_data as $k => $v ) {
|
146 |
-
if ( ! in_array( $k, $this->exist_rows, true ) ) {
|
147 |
-
unset( $this->row_data[ $k ] );
|
148 |
-
}
|
149 |
-
}
|
150 |
-
|
151 |
-
update_option( 'um_existing_rows_' . $form_id, $this->exist_rows );
|
152 |
-
|
153 |
-
update_option( 'um_form_rowdata_' . $form_id, $this->row_data );
|
154 |
-
|
155 |
-
UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
|
156 |
-
|
157 |
-
}
|
158 |
-
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Load form to maintain form order
|
162 |
-
*/
|
163 |
-
public function load_field_order() {
|
164 |
-
|
165 |
-
$screen = get_current_screen();
|
166 |
-
|
167 |
-
if ( ! isset( $screen->id ) || 'um_form' !== $screen->id ) {
|
168 |
-
return;
|
169 |
-
} ?>
|
170 |
-
|
171 |
-
<div class="um-col-demon-settings" data-in_row="" data-in_sub_row="" data-in_column="" data-in_group=""></div>
|
172 |
-
|
173 |
-
<div class="um-col-demon-row" style="display:none;">
|
174 |
-
|
175 |
-
<div class="um-admin-drag-row-icons">
|
176 |
-
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
177 |
-
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( get_the_ID() ); ?>"><i class="um-faicon-pencil"></i></a>
|
178 |
-
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
|
179 |
-
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
|
180 |
-
</div>
|
181 |
-
<div class="um-admin-clear"></div>
|
182 |
-
|
183 |
-
<div class="um-admin-drag-rowsubs">
|
184 |
-
<div class="um-admin-drag-rowsub">
|
185 |
-
|
186 |
-
<div class="um-admin-drag-ctrls columns">
|
187 |
-
<a href="javascript:void(0);" class="active" data-cols="1"></a>
|
188 |
-
<a href="javascript:void(0);" data-cols="2"></a>
|
189 |
-
<a href="javascript:void(0);" data-cols="3"></a>
|
190 |
-
</div>
|
191 |
-
|
192 |
-
<div class="um-admin-drag-rowsub-icons">
|
193 |
-
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
194 |
-
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
|
195 |
-
</div><div class="um-admin-clear"></div>
|
196 |
-
|
197 |
-
<div class="um-admin-drag-col">
|
198 |
-
</div>
|
199 |
-
|
200 |
-
<div class="um-admin-drag-col-dynamic"></div>
|
201 |
-
|
202 |
-
<div class="um-admin-clear"></div>
|
203 |
-
|
204 |
-
</div>
|
205 |
-
</div>
|
206 |
-
|
207 |
-
</div>
|
208 |
-
|
209 |
-
<div class="um-col-demon-subrow" style="display:none;">
|
210 |
-
|
211 |
-
<div class="um-admin-drag-ctrls columns">
|
212 |
-
<a href="javascript:void(0);" class="active" data-cols="1"></a>
|
213 |
-
<a href="javascript:void(0);" data-cols="2"></a>
|
214 |
-
<a href="javascript:void(0);" data-cols="3"></a>
|
215 |
-
</div>
|
216 |
-
|
217 |
-
<div class="um-admin-drag-rowsub-icons">
|
218 |
-
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
219 |
-
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
|
220 |
-
</div><div class="um-admin-clear"></div>
|
221 |
-
|
222 |
-
<div class="um-admin-drag-col">
|
223 |
-
</div>
|
224 |
-
|
225 |
-
<div class="um-admin-drag-col-dynamic"></div>
|
226 |
-
|
227 |
-
<div class="um-admin-clear"></div>
|
228 |
-
|
229 |
-
</div>
|
230 |
-
|
231 |
-
|
232 |
-
<form action="" method="post" class="um_update_order">
|
233 |
-
|
234 |
-
<input type="hidden" name="form_id" id="form_id" value="<?php echo esc_attr( get_the_ID() ); ?>" />
|
235 |
-
<input type="hidden" name="action" value="um_update_order" />
|
236 |
-
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'um-admin-nonce' ) ) ?>" />
|
237 |
-
|
238 |
-
<div class="um_update_order_fields">
|
239 |
-
|
240 |
-
</div>
|
241 |
-
|
242 |
-
</form>
|
243 |
-
|
244 |
-
<?php
|
245 |
-
|
246 |
-
}
|
247 |
-
|
248 |
-
}
|
249 |
-
}
|
1 |
+
<?php
|
2 |
+
namespace um\admin\core;
|
3 |
+
|
4 |
+
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
+
|
7 |
+
|
8 |
+
if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Admin_DragDrop
|
13 |
+
* @package um\admin\core
|
14 |
+
*/
|
15 |
+
class Admin_DragDrop {
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Admin_DragDrop constructor.
|
20 |
+
*/
|
21 |
+
function __construct() {
|
22 |
+
add_action( 'admin_footer', array( &$this, 'load_field_order' ), 9 );
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Update order of fields
|
28 |
+
*/
|
29 |
+
public function update_order() {
|
30 |
+
UM()->admin()->check_ajax_nonce();
|
31 |
+
|
32 |
+
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
33 |
+
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var $form_id
|
38 |
+
*/
|
39 |
+
extract( $_POST );
|
40 |
+
|
41 |
+
if ( isset( $form_id ) ) {
|
42 |
+
$form_id = absint( $form_id );
|
43 |
+
}
|
44 |
+
|
45 |
+
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
46 |
+
|
47 |
+
$this->row_data = get_option( 'um_form_rowdata_' . $form_id, array() );
|
48 |
+
$this->exist_rows = array();
|
49 |
+
|
50 |
+
if ( ! empty( $fields ) ) {
|
51 |
+
foreach ( $fields as $key => $array ) {
|
52 |
+
if ( 'row' === $array['type'] ) {
|
53 |
+
$this->row_data[ $key ] = $array;
|
54 |
+
unset( $fields[ $key ] );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
} else {
|
58 |
+
$fields = array();
|
59 |
+
}
|
60 |
+
|
61 |
+
foreach ( $_POST as $key => $value ) {
|
62 |
+
// don't use sanitize_key here because of a key can be in Uppercase
|
63 |
+
$key = sanitize_text_field( $key );
|
64 |
+
|
65 |
+
// adding rows
|
66 |
+
if ( 0 === strpos( $key, '_um_row_' ) ) {
|
67 |
+
|
68 |
+
$update_args = null;
|
69 |
+
|
70 |
+
$row_id = str_replace( '_um_row_', '', $key );
|
71 |
+
|
72 |
+
if ( strstr( $_POST[ '_um_rowcols_' . $row_id . '_cols' ], ':' ) ) {
|
73 |
+
$cols = sanitize_text_field( $_POST[ '_um_rowcols_' . $row_id . '_cols' ] );
|
74 |
+
} else {
|
75 |
+
$cols = absint( $_POST[ '_um_rowcols_' . $row_id . '_cols' ] );
|
76 |
+
}
|
77 |
+
|
78 |
+
$row_array = array(
|
79 |
+
'type' => 'row',
|
80 |
+
'id' => sanitize_key( $value ),
|
81 |
+
'sub_rows' => absint( $_POST[ '_um_rowsub_' . $row_id . '_rows' ] ),
|
82 |
+
'cols' => $cols,
|
83 |
+
'origin' => sanitize_key( $_POST[ '_um_roworigin_' . $row_id . '_val' ] ),
|
84 |
+
);
|
85 |
+
|
86 |
+
$row_args = $row_array;
|
87 |
+
|
88 |
+
if ( isset( $this->row_data[ $row_array['origin'] ] ) ) {
|
89 |
+
foreach ( $this->row_data[ $row_array['origin'] ] as $k => $v ) {
|
90 |
+
if ( 'position' !== $k && 'metakey' !== $k ) {
|
91 |
+
$update_args[ $k ] = $v;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
if ( isset( $update_args ) ) {
|
95 |
+
$row_args = array_merge( $update_args, $row_array );
|
96 |
+
}
|
97 |
+
$this->exist_rows[] = $key;
|
98 |
+
}
|
99 |
+
|
100 |
+
$fields[ $key ] = $row_args;
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
// change field position
|
105 |
+
if ( 0 === strpos( $key, 'um_position_' ) ) {
|
106 |
+
$field_key = str_replace( 'um_position_', '', $key );
|
107 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
108 |
+
$fields[ $field_key ]['position'] = absint( $value );
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
// change field master row
|
113 |
+
if ( 0 === strpos( $key, 'um_row_' ) ) {
|
114 |
+
$field_key = str_replace( 'um_row_', '', $key );
|
115 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
116 |
+
$fields[ $field_key ]['in_row'] = sanitize_key( $value );
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
// change field sub row
|
121 |
+
if ( 0 === strpos( $key, 'um_subrow_' ) ) {
|
122 |
+
$field_key = str_replace( 'um_subrow_', '', $key );
|
123 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
124 |
+
$fields[ $field_key ]['in_sub_row'] = sanitize_key( $value );
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
// change field column
|
129 |
+
if ( 0 === strpos( $key, 'um_col_' ) ) {
|
130 |
+
$field_key = str_replace( 'um_col_', '', $key );
|
131 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
132 |
+
$fields[ $field_key ]['in_column'] = absint( $value );
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
// add field to group
|
137 |
+
if ( 0 === strpos( $key, 'um_group_' ) ) {
|
138 |
+
$field_key = str_replace( 'um_group_', '', $key );
|
139 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
140 |
+
$fields[ $field_key ]['in_group'] = ! empty( $value ) ? absint( $value ) : '';
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
foreach ( $this->row_data as $k => $v ) {
|
146 |
+
if ( ! in_array( $k, $this->exist_rows, true ) ) {
|
147 |
+
unset( $this->row_data[ $k ] );
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
update_option( 'um_existing_rows_' . $form_id, $this->exist_rows );
|
152 |
+
|
153 |
+
update_option( 'um_form_rowdata_' . $form_id, $this->row_data );
|
154 |
+
|
155 |
+
UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Load form to maintain form order
|
162 |
+
*/
|
163 |
+
public function load_field_order() {
|
164 |
+
|
165 |
+
$screen = get_current_screen();
|
166 |
+
|
167 |
+
if ( ! isset( $screen->id ) || 'um_form' !== $screen->id ) {
|
168 |
+
return;
|
169 |
+
} ?>
|
170 |
+
|
171 |
+
<div class="um-col-demon-settings" data-in_row="" data-in_sub_row="" data-in_column="" data-in_group=""></div>
|
172 |
+
|
173 |
+
<div class="um-col-demon-row" style="display:none;">
|
174 |
+
|
175 |
+
<div class="um-admin-drag-row-icons">
|
176 |
+
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
177 |
+
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( get_the_ID() ); ?>"><i class="um-faicon-pencil"></i></a>
|
178 |
+
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
|
179 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
|
180 |
+
</div>
|
181 |
+
<div class="um-admin-clear"></div>
|
182 |
+
|
183 |
+
<div class="um-admin-drag-rowsubs">
|
184 |
+
<div class="um-admin-drag-rowsub">
|
185 |
+
|
186 |
+
<div class="um-admin-drag-ctrls columns">
|
187 |
+
<a href="javascript:void(0);" class="active" data-cols="1"></a>
|
188 |
+
<a href="javascript:void(0);" data-cols="2"></a>
|
189 |
+
<a href="javascript:void(0);" data-cols="3"></a>
|
190 |
+
</div>
|
191 |
+
|
192 |
+
<div class="um-admin-drag-rowsub-icons">
|
193 |
+
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
194 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
|
195 |
+
</div><div class="um-admin-clear"></div>
|
196 |
+
|
197 |
+
<div class="um-admin-drag-col">
|
198 |
+
</div>
|
199 |
+
|
200 |
+
<div class="um-admin-drag-col-dynamic"></div>
|
201 |
+
|
202 |
+
<div class="um-admin-clear"></div>
|
203 |
+
|
204 |
+
</div>
|
205 |
+
</div>
|
206 |
+
|
207 |
+
</div>
|
208 |
+
|
209 |
+
<div class="um-col-demon-subrow" style="display:none;">
|
210 |
+
|
211 |
+
<div class="um-admin-drag-ctrls columns">
|
212 |
+
<a href="javascript:void(0);" class="active" data-cols="1"></a>
|
213 |
+
<a href="javascript:void(0);" data-cols="2"></a>
|
214 |
+
<a href="javascript:void(0);" data-cols="3"></a>
|
215 |
+
</div>
|
216 |
+
|
217 |
+
<div class="um-admin-drag-rowsub-icons">
|
218 |
+
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
219 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
|
220 |
+
</div><div class="um-admin-clear"></div>
|
221 |
+
|
222 |
+
<div class="um-admin-drag-col">
|
223 |
+
</div>
|
224 |
+
|
225 |
+
<div class="um-admin-drag-col-dynamic"></div>
|
226 |
+
|
227 |
+
<div class="um-admin-clear"></div>
|
228 |
+
|
229 |
+
</div>
|
230 |
+
|
231 |
+
|
232 |
+
<form action="" method="post" class="um_update_order">
|
233 |
+
|
234 |
+
<input type="hidden" name="form_id" id="form_id" value="<?php echo esc_attr( get_the_ID() ); ?>" />
|
235 |
+
<input type="hidden" name="action" value="um_update_order" />
|
236 |
+
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'um-admin-nonce' ) ) ?>" />
|
237 |
+
|
238 |
+
<div class="um_update_order_fields">
|
239 |
+
|
240 |
+
</div>
|
241 |
+
|
242 |
+
</form>
|
243 |
+
|
244 |
+
<?php
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
+
}
|
249 |
+
}
|
includes/admin/core/class-admin-metabox.php
CHANGED
@@ -1,2427 +1,2427 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um\admin\core;
|
3 |
-
|
4 |
-
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
-
|
7 |
-
|
8 |
-
if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Class Admin_Metabox
|
13 |
-
*
|
14 |
-
* @package um\admin\core
|
15 |
-
*/
|
16 |
-
class Admin_Metabox {
|
17 |
-
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @var bool
|
21 |
-
*/
|
22 |
-
private $form_nonce_added = false;
|
23 |
-
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var bool
|
27 |
-
*/
|
28 |
-
private $directory_nonce_added = false;
|
29 |
-
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @var bool
|
33 |
-
*/
|
34 |
-
private $custom_nonce_added = false;
|
35 |
-
|
36 |
-
|
37 |
-
var $init_icon = false;
|
38 |
-
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Admin_Metabox constructor.
|
42 |
-
*/
|
43 |
-
function __construct() {
|
44 |
-
$this->in_edit = false;
|
45 |
-
$this->edit_mode_value = null;
|
46 |
-
$this->edit_array = [];
|
47 |
-
|
48 |
-
add_action( 'admin_head', array( &$this, 'admin_head' ), 9);
|
49 |
-
add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9 );
|
50 |
-
|
51 |
-
add_action( 'load-post.php', array( &$this, 'add_metabox' ), 9 );
|
52 |
-
add_action( 'load-post-new.php', array( &$this, 'add_metabox' ), 9 );
|
53 |
-
|
54 |
-
add_action( 'admin_init', array( &$this, 'add_taxonomy_metabox' ), 9 );
|
55 |
-
|
56 |
-
//roles metaboxes
|
57 |
-
add_action( 'um_roles_add_meta_boxes', array( &$this, 'add_metabox_role' ) );
|
58 |
-
|
59 |
-
add_filter( 'um_builtin_validation_types_continue_loop', array( &$this, 'validation_types_continue_loop' ), 1, 4 );
|
60 |
-
add_filter( 'um_restrict_content_hide_metabox', array( &$this, 'hide_metabox_restrict_content_shop' ), 10, 1 );
|
61 |
-
|
62 |
-
add_filter( 'um_member_directory_meta_value_before_save', array( UM()->member_directory(), 'before_save_data' ), 10, 3 );
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Hide Woocommerce Shop page restrict content metabox
|
68 |
-
* @param $hide
|
69 |
-
*
|
70 |
-
* @return bool
|
71 |
-
*/
|
72 |
-
function hide_metabox_restrict_content_shop( $hide ) {
|
73 |
-
if ( function_exists( 'wc_get_page_id' ) && ! empty( $_GET['post'] ) &&
|
74 |
-
absint( $_GET['post'] ) == wc_get_page_id( 'shop' ) ) {
|
75 |
-
return true;
|
76 |
-
}
|
77 |
-
|
78 |
-
return $hide;
|
79 |
-
}
|
80 |
-
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Filter validation types on loop
|
84 |
-
*
|
85 |
-
* @param $break
|
86 |
-
* @param $key
|
87 |
-
* @param $form_id
|
88 |
-
* @param $field_array
|
89 |
-
*
|
90 |
-
* @return bool
|
91 |
-
*/
|
92 |
-
function validation_types_continue_loop( $break, $key, $form_id, $field_array ) {
|
93 |
-
|
94 |
-
// show unique username validation only for user_login field
|
95 |
-
if ( isset( $field_array['metakey'] ) && $field_array['metakey'] == 'user_login' && $key !== 'unique_username' ) {
|
96 |
-
return false;
|
97 |
-
}
|
98 |
-
|
99 |
-
return $break;
|
100 |
-
}
|
101 |
-
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Gets the role meta
|
105 |
-
*
|
106 |
-
* @param $id
|
107 |
-
*
|
108 |
-
* @return mixed
|
109 |
-
*/
|
110 |
-
function get_custom_post_meta( $id ) {
|
111 |
-
$all_meta = get_post_custom( $id );
|
112 |
-
foreach ( $all_meta as $k => $v ) {
|
113 |
-
if ( strstr( $k, '_um_' ) ) {
|
114 |
-
$um_meta[ $k ] = $v;
|
115 |
-
}
|
116 |
-
}
|
117 |
-
if ( isset( $um_meta ) ) {
|
118 |
-
return $um_meta;
|
119 |
-
}
|
120 |
-
|
121 |
-
return false;
|
122 |
-
}
|
123 |
-
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Runs on admin head
|
127 |
-
*/
|
128 |
-
function admin_head(){
|
129 |
-
global $post;
|
130 |
-
if ( UM()->admin()->is_plugin_post_type() && isset($post->ID) ){
|
131 |
-
$this->postmeta = $this->get_custom_post_meta($post->ID);
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Init the metaboxes
|
138 |
-
*/
|
139 |
-
function add_metabox() {
|
140 |
-
global $current_screen;
|
141 |
-
|
142 |
-
if ( $current_screen->id == 'um_form' ) {
|
143 |
-
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_form'), 1 );
|
144 |
-
add_action( 'save_post', array(&$this, 'save_metabox_form'), 10, 2 );
|
145 |
-
}
|
146 |
-
|
147 |
-
if ( $current_screen->id == 'um_directory' ) {
|
148 |
-
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_directory'), 1 );
|
149 |
-
add_action( 'save_post', array(&$this, 'save_metabox_directory'), 10, 2 );
|
150 |
-
}
|
151 |
-
|
152 |
-
//restrict content metabox
|
153 |
-
$post_types = UM()->options()->get( 'restricted_access_post_metabox' );
|
154 |
-
if ( ! empty( $post_types[ $current_screen->id ] ) ) {
|
155 |
-
|
156 |
-
/**
|
157 |
-
* UM hook
|
158 |
-
*
|
159 |
-
* @type filter
|
160 |
-
* @title um_restrict_content_hide_metabox
|
161 |
-
* @description Show/Hide Restrict content metabox
|
162 |
-
* @input_vars
|
163 |
-
* [{"var":"$show","type":"bool","desc":"Show Metabox"}]
|
164 |
-
* @change_log
|
165 |
-
* ["Since: 2.0"]
|
166 |
-
* @usage add_filter( 'um_restrict_content_hide_metabox', 'function_name', 10, 1 );
|
167 |
-
* @example
|
168 |
-
* <?php
|
169 |
-
* add_filter( 'um_restrict_content_hide_metabox', 'my_restrict_content_hide_metabox', 10, 1 );
|
170 |
-
* function my_restrict_content_hide_metabox( $show ) {
|
171 |
-
* // your code here
|
172 |
-
* return $show;
|
173 |
-
* }
|
174 |
-
* ?>
|
175 |
-
*/
|
176 |
-
$hide_metabox = apply_filters( 'um_restrict_content_hide_metabox', false );
|
177 |
-
|
178 |
-
if ( ! $hide_metabox ) {
|
179 |
-
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_restrict_content'), 1 );
|
180 |
-
add_action( 'save_post', array( &$this, 'save_metabox_restrict_content' ), 10, 2 );
|
181 |
-
}
|
182 |
-
|
183 |
-
if ( $current_screen->id == 'attachment' ) {
|
184 |
-
add_action( 'add_attachment', array( &$this, 'save_attachment_metabox_restrict_content' ), 10, 2 );
|
185 |
-
add_action( 'edit_attachment', array( &$this, 'save_attachment_metabox_restrict_content' ), 10, 2 );
|
186 |
-
}
|
187 |
-
}
|
188 |
-
|
189 |
-
|
190 |
-
add_action( 'save_post', array( &$this, 'save_metabox_custom' ), 10, 2 );
|
191 |
-
}
|
192 |
-
|
193 |
-
|
194 |
-
/**
|
195 |
-
* @param $post_id
|
196 |
-
* @param $post
|
197 |
-
*/
|
198 |
-
public function save_metabox_custom( $post_id, $post ) {
|
199 |
-
// validate nonce
|
200 |
-
if ( ! isset( $_POST['um_admin_save_metabox_custom_nonce'] ) ||
|
201 |
-
! wp_verify_nonce( $_POST['um_admin_save_metabox_custom_nonce'], basename( __FILE__ ) ) ) {
|
202 |
-
return;
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* UM hook
|
207 |
-
*
|
208 |
-
* @type action
|
209 |
-
* @title um_admin_custom_restrict_content_metaboxes
|
210 |
-
* @description Save metabox custom with restrict content
|
211 |
-
* @input_vars
|
212 |
-
* [{"var":"$post_id","type":"int","desc":"Post ID"},
|
213 |
-
* {"var":"$post","type":"array","desc":"Post data"}]
|
214 |
-
* @change_log
|
215 |
-
* ["Since: 2.0"]
|
216 |
-
* @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10, 2 );
|
217 |
-
* @example
|
218 |
-
* <?php
|
219 |
-
* add_action( 'um_admin_custom_restrict_content_metaboxes', 'my_admin_custom_restrict_content', 10, 2 );
|
220 |
-
* function my_admin_custom_restrict_content( $post_id, $post ) {
|
221 |
-
* // your code here
|
222 |
-
* }
|
223 |
-
* ?>
|
224 |
-
*/
|
225 |
-
do_action( 'um_admin_custom_restrict_content_metaboxes', $post_id, $post );
|
226 |
-
}
|
227 |
-
|
228 |
-
|
229 |
-
/**
|
230 |
-
*
|
231 |
-
*/
|
232 |
-
function add_metabox_restrict_content() {
|
233 |
-
global $current_screen;
|
234 |
-
|
235 |
-
add_meta_box(
|
236 |
-
'um-admin-restrict-content',
|
237 |
-
__( 'Ultimate Member: Content Restriction', 'ultimate-member' ),
|
238 |
-
array( &$this, 'restrict_content_cb' ),
|
239 |
-
$current_screen->id,
|
240 |
-
'normal',
|
241 |
-
'default'
|
242 |
-
);
|
243 |
-
|
244 |
-
/**
|
245 |
-
* UM hook
|
246 |
-
*
|
247 |
-
* @type action
|
248 |
-
* @title um_admin_custom_restrict_content_metaboxes
|
249 |
-
* @description Add restrict content custom metabox
|
250 |
-
* @change_log
|
251 |
-
* ["Since: 2.0"]
|
252 |
-
* @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10 );
|
253 |
-
* @example
|
254 |
-
* <?php
|
255 |
-
* add_action( 'um_admin_custom_restrict_content_metaboxes', 'my_admin_custom_restrict_content', 10 );
|
256 |
-
* function my_admin_custom_restrict_content() {
|
257 |
-
* // your code here
|
258 |
-
* }
|
259 |
-
* ?>
|
260 |
-
*/
|
261 |
-
do_action( 'um_admin_custom_restrict_content_metaboxes' );
|
262 |
-
}
|
263 |
-
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Content restriction metabox
|
267 |
-
*
|
268 |
-
* @param $object
|
269 |
-
* @param $box
|
270 |
-
*/
|
271 |
-
function restrict_content_cb( $object, $box ) {
|
272 |
-
include_once UM()->admin()->templates_path . 'access/restrict_content.php';
|
273 |
-
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_restrict_content_nonce' );
|
274 |
-
}
|
275 |
-
|
276 |
-
|
277 |
-
/**
|
278 |
-
* Init the metaboxes
|
279 |
-
*/
|
280 |
-
function add_taxonomy_metabox() {
|
281 |
-
//restrict content metabox
|
282 |
-
$all_taxonomies = get_taxonomies( array( 'public' => true ) );
|
283 |
-
$tax_types = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
|
284 |
-
$exclude_taxonomies = UM()->excluded_taxonomies();
|
285 |
-
|
286 |
-
foreach ( $all_taxonomies as $key => $taxonomy ) {
|
287 |
-
if ( in_array( $key, $exclude_taxonomies ) || empty( $tax_types[$key] ) )
|
288 |
-
continue;
|
289 |
-
|
290 |
-
add_action( $taxonomy . '_add_form_fields', array( &$this, 'um_category_access_fields_create' ) );
|
291 |
-
add_action( $taxonomy . '_edit_form_fields', array( &$this, 'um_category_access_fields_edit' ) );
|
292 |
-
add_action( 'create_' . $taxonomy, array( &$this, 'um_category_access_fields_save' ) );
|
293 |
-
add_action( 'edited_' . $taxonomy, array( &$this, 'um_category_access_fields_save' ) );
|
294 |
-
}
|
295 |
-
}
|
296 |
-
|
297 |
-
|
298 |
-
/**
|
299 |
-
* @param $post_id
|
300 |
-
* @param $post
|
301 |
-
*/
|
302 |
-
function save_metabox_restrict_content( $post_id, $post ) {
|
303 |
-
// validate nonce
|
304 |
-
if ( ! isset( $_POST['um_admin_save_metabox_restrict_content_nonce'] ) ||
|
305 |
-
! wp_verify_nonce( $_POST['um_admin_save_metabox_restrict_content_nonce'], basename( __FILE__ ) ) ) {
|
306 |
-
return;
|
307 |
-
}
|
308 |
-
|
309 |
-
// validate user
|
310 |
-
$post_type = get_post_type_object( $post->post_type );
|
311 |
-
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
312 |
-
return;
|
313 |
-
}
|
314 |
-
|
315 |
-
if ( ! empty( $_POST['um_content_restriction'] ) && is_array( $_POST['um_content_restriction'] ) ) {
|
316 |
-
$restriction_meta = UM()->admin()->sanitize_post_restriction_meta( $_POST['um_content_restriction'] );
|
317 |
-
|
318 |
-
update_post_meta( $post_id, 'um_content_restriction', $restriction_meta );
|
319 |
-
} else {
|
320 |
-
delete_post_meta( $post_id, 'um_content_restriction' );
|
321 |
-
}
|
322 |
-
}
|
323 |
-
|
324 |
-
|
325 |
-
/**
|
326 |
-
* @param $post_id
|
327 |
-
*
|
328 |
-
*/
|
329 |
-
function save_attachment_metabox_restrict_content( $post_id ) {
|
330 |
-
// validate nonce
|
331 |
-
if ( ! isset( $_POST['um_admin_save_metabox_restrict_content_nonce'] )
|
332 |
-
|| ! wp_verify_nonce( $_POST['um_admin_save_metabox_restrict_content_nonce'], basename( __FILE__ ) ) ) {
|
333 |
-
return;
|
334 |
-
}
|
335 |
-
|
336 |
-
$post = get_post( $post_id );
|
337 |
-
|
338 |
-
// validate user
|
339 |
-
$post_type = get_post_type_object( $post->post_type );
|
340 |
-
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
341 |
-
return;
|
342 |
-
}
|
343 |
-
|
344 |
-
if ( ! empty( $_POST['um_content_restriction'] ) && is_array( $_POST['um_content_restriction'] ) ) {
|
345 |
-
$restriction_meta = UM()->admin()->sanitize_post_restriction_meta( $_POST['um_content_restriction'] );
|
346 |
-
|
347 |
-
update_post_meta( $post_id, 'um_content_restriction', $restriction_meta );
|
348 |
-
} else {
|
349 |
-
delete_post_meta( $post_id, 'um_content_restriction' );
|
350 |
-
}
|
351 |
-
}
|
352 |
-
|
353 |
-
|
354 |
-
/**
|
355 |
-
*
|
356 |
-
*/
|
357 |
-
function um_category_access_fields_create() {
|
358 |
-
/**
|
359 |
-
* UM hook
|
360 |
-
*
|
361 |
-
* @type filter
|
362 |
-
* @title um_admin_category_access_settings_fields
|
363 |
-
* @description Settings fields for terms
|
364 |
-
* @input_vars
|
365 |
-
* [{"var":"$access_settings_fields","type":"array","desc":"Settings Fields"},
|
366 |
-
* {"var":"$data","type":"array","desc":"Settings Data"},
|
367 |
-
* {"var":"$screen","type":"string","desc":"Category Screen"}]
|
368 |
-
* @change_log
|
369 |
-
* ["Since: 2.0"]
|
370 |
-
* @usage add_filter( 'um_admin_category_access_settings_fields', 'function_name', 10, 3 );
|
371 |
-
* @example
|
372 |
-
* <?php
|
373 |
-
* add_filter( 'um_admin_category_access_settings_fields', 'my_admin_category_access_settings_fields', 10, 3 );
|
374 |
-
* function my_admin_category_access_settings_fields( $access_settings_fields, $data, $screen ) {
|
375 |
-
* // your code here
|
376 |
-
* $access_settings_fields[] = array(
|
377 |
-
* 'id' => 'my-field-key',
|
378 |
-
* 'type' => 'my-field-type',
|
379 |
-
* 'label' => __( 'My field Label', 'ultimate-member' ),
|
380 |
-
* 'description' => __( 'My Field Description', 'ultimate-member' ),
|
381 |
-
* 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
382 |
-
* );
|
383 |
-
* return $access_settings_fields;
|
384 |
-
* }
|
385 |
-
* ?>
|
386 |
-
*/
|
387 |
-
$fields = apply_filters( 'um_admin_category_access_settings_fields', array(
|
388 |
-
array(
|
389 |
-
'id' => '_um_custom_access_settings',
|
390 |
-
'type' => 'checkbox',
|
391 |
-
'label' => __( 'Restrict access to this term and its posts?', 'ultimate-member' ),
|
392 |
-
'description' => __( 'Activate content restriction for this term and its posts. Affects only posts that do not have individual Restriction Content settings', 'ultimate-member' ),
|
393 |
-
'value' => 0,
|
394 |
-
),
|
395 |
-
array(
|
396 |
-
'id' => '_um_accessible',
|
397 |
-
'type' => 'select',
|
398 |
-
'label' => __( 'Who can access this term and its posts?', 'ultimate-member' ),
|
399 |
-
'value' => '0',
|
400 |
-
'options' => array(
|
401 |
-
'0' => __( 'Everyone', 'ultimate-member' ),
|
402 |
-
'1' => __( 'Logged out users', 'ultimate-member' ),
|
403 |
-
'2' => __( 'Logged in users', 'ultimate-member' ),
|
404 |
-
),
|
405 |
-
'conditional' => array( '_um_custom_access_settings', '=', '1' ),
|
406 |
-
),
|
407 |
-
array(
|
408 |
-
'id' => '_um_access_roles',
|
409 |
-
'type' => 'multi_checkbox',
|
410 |
-
'label' => __( 'Select which roles can access this term and its posts', 'ultimate-member' ),
|
411 |
-
'description' => __( 'Leave empty if you want to display a term for all logged in users', 'ultimate-member' ),
|
412 |
-
'options' => UM()->roles()->get_roles( false ),
|
413 |
-
'columns' => 3,
|
414 |
-
'conditional' => array( '_um_accessible', '=', '2' ),
|
415 |
-
),
|
416 |
-
array(
|
417 |
-
'id' => '_um_access_hide_from_queries',
|
418 |
-
'type' => 'checkbox',
|
419 |
-
'label' => __( 'Would you like to display 404 error on the term\'s archive page and terms\' posts single pages when users haven\'t access?', 'ultimate-member' ),
|
420 |
-
'description' => __( 'Recommended to be enabled. Restricted term\'s archive page and all terms\' posts will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
|
421 |
-
'value' => 1,
|
422 |
-
'conditional' => array( '_um_accessible', '!=', '0' ),
|
423 |
-
),
|
424 |
-
array(
|
425 |
-
'id' => '_um_noaccess_action',
|
426 |
-
'type' => 'select',
|
427 |
-
'label' => __( 'What happens when users without access try to view the term\'s post?', 'ultimate-member' ),
|
428 |
-
'description' => __( 'Action when users without access tries to view the term\'s post', 'ultimate-member' ),
|
429 |
-
'value' => '0',
|
430 |
-
'options' => array(
|
431 |
-
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
432 |
-
'1' => __( 'Redirect user', 'ultimate-member' ),
|
433 |
-
),
|
434 |
-
'conditional' => array( '_um_access_hide_from_queries', '=', '0' ),
|
435 |
-
),
|
436 |
-
array(
|
437 |
-
'id' => '_um_restrict_by_custom_message',
|
438 |
-
'type' => 'select',
|
439 |
-
'label' => __( 'Restricted access message type', 'ultimate-member' ),
|
440 |
-
'description' => __( 'Would you like to use the global default message or apply a custom message to this term\'s post?', 'ultimate-member' ),
|
441 |
-
'value' => '0',
|
442 |
-
'options' => array(
|
443 |
-
'0' => __( 'Global default message', 'ultimate-member' ),
|
444 |
-
'1' => __( 'Custom message', 'ultimate-member' ),
|
445 |
-
),
|
446 |
-
'conditional' => array( '_um_noaccess_action', '=', '0' ),
|
447 |
-
),
|
448 |
-
array(
|
449 |
-
'id' => '_um_restrict_custom_message',
|
450 |
-
'type' => 'wp_editor',
|
451 |
-
'label' => __( 'Custom restricted access message', 'ultimate-member' ),
|
452 |
-
'description' => __( 'You may replace global restricted access message here', 'ultimate-member' ),
|
453 |
-
'value' => '',
|
454 |
-
'conditional' => array( '_um_restrict_by_custom_message', '=', '1' ),
|
455 |
-
),
|
456 |
-
array(
|
457 |
-
'id' => '_um_access_redirect',
|
458 |
-
'type' => 'select',
|
459 |
-
'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
|
460 |
-
'description' => __( 'Select redirect to page when user hasn\'t access to the term\'s post', 'ultimate-member' ),
|
461 |
-
'value' => '0',
|
462 |
-
'conditional' => array( '_um_noaccess_action', '=', '1' ),
|
463 |
-
'options' => array(
|
464 |
-
'0' => __( 'Login page', 'ultimate-member' ),
|
465 |
-
'1' => __( 'Custom URL', 'ultimate-member' ),
|
466 |
-
),
|
467 |
-
),
|
468 |
-
array(
|
469 |
-
'id' => '_um_access_redirect_url',
|
470 |
-
'type' => 'text',
|
471 |
-
'label' => __( 'Redirect URL', 'ultimate-member' ),
|
472 |
-
'description' => __( 'Set full URL where do you want to redirect the user', 'ultimate-member' ),
|
473 |
-
'value' => '',
|
474 |
-
'conditional' => array( '_um_access_redirect', '=', '1' ),
|
475 |
-
),
|
476 |
-
), array(), 'create' );
|
477 |
-
|
478 |
-
UM()->admin_forms(
|
479 |
-
array(
|
480 |
-
'class' => 'um-restrict-content um-third-column',
|
481 |
-
'prefix_id' => 'um_content_restriction',
|
482 |
-
'without_wrapper' => true,
|
483 |
-
'div_line' => true,
|
484 |
-
'fields' => $fields,
|
485 |
-
)
|
486 |
-
)->render_form();
|
487 |
-
|
488 |
-
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_taxonomy_restrict_content_nonce' );
|
489 |
-
}
|
490 |
-
|
491 |
-
|
492 |
-
/**
|
493 |
-
* @param $term
|
494 |
-
*/
|
495 |
-
function um_category_access_fields_edit( $term ) {
|
496 |
-
$termID = $term->term_id;
|
497 |
-
|
498 |
-
$data = get_term_meta( $termID, 'um_content_restriction', true );
|
499 |
-
|
500 |
-
$_um_access_roles_value = array();
|
501 |
-
if ( ! empty( $data['_um_access_roles'] ) ) {
|
502 |
-
foreach ( $data['_um_access_roles'] as $key => $value ) {
|
503 |
-
if ( $value ) {
|
504 |
-
$_um_access_roles_value[] = $key;
|
505 |
-
}
|
506 |
-
}
|
507 |
-
}
|
508 |
-
|
509 |
-
/**
|
510 |
-
* UM hook
|
511 |
-
*
|
512 |
-
* @type filter
|
513 |
-
* @title um_admin_category_access_settings_fields
|
514 |
-
* @description Settings fields for terms
|
515 |
-
* @input_vars
|
516 |
-
* [{"var":"$access_settings_fields","type":"array","desc":"Settings Fields"},
|
517 |
-
* {"var":"$data","type":"array","desc":"Settings Data"},
|
518 |
-
* {"var":"$screen","type":"string","desc":"Category Screen"}]
|
519 |
-
* @change_log
|
520 |
-
* ["Since: 2.0"]
|
521 |
-
* @usage add_filter( 'um_admin_category_access_settings_fields', 'function_name', 10, 3 );
|
522 |
-
* @example
|
523 |
-
* <?php
|
524 |
-
* add_filter( 'um_admin_category_access_settings_fields', 'my_admin_category_access_settings_fields', 10, 3 );
|
525 |
-
* function my_admin_category_access_settings_fields( $access_settings_fields, $data, $screen ) {
|
526 |
-
* // your code here
|
527 |
-
* $access_settings_fields[] = array(
|
528 |
-
* 'id' => 'my-field-key',
|
529 |
-
* 'type' => 'my-field-type',
|
530 |
-
* 'label' => __( 'My field Label', 'ultimate-member' ),
|
531 |
-
* 'description' => __( 'My Field Description', 'ultimate-member' ),
|
532 |
-
* 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
533 |
-
* );
|
534 |
-
* return $access_settings_fields;
|
535 |
-
* }
|
536 |
-
* ?>
|
537 |
-
*/
|
538 |
-
$fields = apply_filters( 'um_admin_category_access_settings_fields', array(
|
539 |
-
array(
|
540 |
-
'id' => '_um_custom_access_settings',
|
541 |
-
'type' => 'checkbox',
|
542 |
-
'label' => __( 'Restrict access to this term and its posts?', 'ultimate-member' ),
|
543 |
-
'description' => __( 'Activate content restriction for this term and its posts. Affects only posts that do not have individual Restriction Content settings', 'ultimate-member' ),
|
544 |
-
'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
545 |
-
),
|
546 |
-
array(
|
547 |
-
'id' => '_um_accessible',
|
548 |
-
'type' => 'select',
|
549 |
-
'label' => __( 'Who can access this term and its posts?', 'ultimate-member' ),
|
550 |
-
'value' => ! empty( $data['_um_accessible'] ) ? $data['_um_accessible'] : '0',
|
551 |
-
'options' => array(
|
552 |
-
'0' => __( 'Everyone', 'ultimate-member' ),
|
553 |
-
'1' => __( 'Logged out users', 'ultimate-member' ),
|
554 |
-
'2' => __( 'Logged in users', 'ultimate-member' ),
|
555 |
-
),
|
556 |
-
'conditional' => array( '_um_custom_access_settings', '=', '1' ),
|
557 |
-
),
|
558 |
-
array(
|
559 |
-
'id' => '_um_access_roles',
|
560 |
-
'type' => 'multi_checkbox',
|
561 |
-
'label' => __( 'Select which roles can access this term and its posts', 'ultimate-member' ),
|
562 |
-
'description' => __( 'Leave empty if you want to display a term for all logged in users', 'ultimate-member' ),
|
563 |
-
'value' => $_um_access_roles_value,
|
564 |
-
'options' => UM()->roles()->get_roles( false ),
|
565 |
-
'columns' => 3,
|
566 |
-
'conditional' => array( '_um_accessible', '=', '2' ),
|
567 |
-
),
|
568 |
-
array(
|
569 |
-
'id' => '_um_access_hide_from_queries',
|
570 |
-
'type' => 'checkbox',
|
571 |
-
'label' => __( 'Would you like to display 404 error on the term\'s archive page and terms\' posts single pages when users haven\'t access?', 'ultimate-member' ),
|
572 |
-
'description' => __( 'Recommended to be enabled. Restricted term\'s archive page and all terms\' posts will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
|
573 |
-
'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
|
574 |
-
'conditional' => array( '_um_accessible', '!=', '0' ),
|
575 |
-
),
|
576 |
-
array(
|
577 |
-
'id' => '_um_noaccess_action',
|
578 |
-
'type' => 'select',
|
579 |
-
'label' => __( 'What happens when users without access try to view the term\'s post?', 'ultimate-member' ),
|
580 |
-
'description' => __( 'Action when users without access tries to view the term\'s post', 'ultimate-member' ),
|
581 |
-
'value' => ! empty( $data['_um_noaccess_action'] ) ? $data['_um_noaccess_action'] : '0',
|
582 |
-
'options' => array(
|
583 |
-
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
584 |
-
'1' => __( 'Redirect user', 'ultimate-member' ),
|
585 |
-
),
|
586 |
-
'conditional' => array( '_um_access_hide_from_queries', '=', '0' ),
|
587 |
-
),
|
588 |
-
array(
|
589 |
-
'id' => '_um_restrict_by_custom_message',
|
590 |
-
'type' => 'select',
|
591 |
-
'label' => __( 'Restricted access message type', 'ultimate-member' ),
|
592 |
-
'description' => __( 'Would you like to use the global default message or apply a custom message to this term\'s post?', 'ultimate-member' ),
|
593 |
-
'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
|
594 |
-
'options' => array(
|
595 |
-
'0' => __( 'Global default message', 'ultimate-member' ),
|
596 |
-
'1' => __( 'Custom message', 'ultimate-member' ),
|
597 |
-
),
|
598 |
-
'conditional' => array( '_um_noaccess_action', '=', '0' ),
|
599 |
-
),
|
600 |
-
array(
|
601 |
-
'id' => '_um_restrict_custom_message',
|
602 |
-
'type' => 'wp_editor',
|
603 |
-
'label' => __( 'Custom restricted access message', 'ultimate-member' ),
|
604 |
-
'description' => __( 'You may replace global restricted access message here', 'ultimate-member' ),
|
605 |
-
'value' => ! empty( $data['_um_restrict_custom_message'] ) ? $data['_um_restrict_custom_message'] : '',
|
606 |
-
'conditional' => array( '_um_restrict_by_custom_message', '=', '1' ),
|
607 |
-
),
|
608 |
-
array(
|
609 |
-
'id' => '_um_access_redirect',
|
610 |
-
'type' => 'select',
|
611 |
-
'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
|
612 |
-
'description' => __( 'Select redirect to page when user hasn\'t access to the term\'s post', 'ultimate-member' ),
|
613 |
-
'value' => ! empty( $data['_um_access_redirect'] ) ? $data['_um_access_redirect'] : '0',
|
614 |
-
'options' => array(
|
615 |
-
'0' => __( 'Login page', 'ultimate-member' ),
|
616 |
-
'1' => __( 'Custom URL', 'ultimate-member' ),
|
617 |
-
),
|
618 |
-
'conditional' => array( '_um_noaccess_action', '=', '1' ),
|
619 |
-
),
|
620 |
-
array(
|
621 |
-
'id' => '_um_access_redirect_url',
|
622 |
-
'type' => 'text',
|
623 |
-
'label' => __( 'Redirect URL', 'ultimate-member' ),
|
624 |
-
'description' => __( 'Set full URL where do you want to redirect the user', 'ultimate-member' ),
|
625 |
-
'value' => ! empty( $data['_um_access_redirect_url'] ) ? $data['_um_access_redirect_url'] : '',
|
626 |
-
'conditional' => array( '_um_access_redirect', '=', '1' ),
|
627 |
-
),
|
628 |
-
), $data, 'edit' );
|
629 |
-
|
630 |
-
UM()->admin_forms(
|
631 |
-
array(
|
632 |
-
'class' => 'um-restrict-content um-third-column',
|
633 |
-
'prefix_id' => 'um_content_restriction',
|
634 |
-
'without_wrapper' => true,
|
635 |
-
'fields' => $fields,
|
636 |
-
)
|
637 |
-
)->render_form();
|
638 |
-
|
639 |
-
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_taxonomy_restrict_content_nonce' );
|
640 |
-
}
|
641 |
-
|
642 |
-
|
643 |
-
/**
|
644 |
-
* @param $termID
|
645 |
-
*
|
646 |
-
* @return mixed
|
647 |
-
*/
|
648 |
-
function um_category_access_fields_save( $termID ) {
|
649 |
-
|
650 |
-
// validate nonce
|
651 |
-
if ( ! isset( $_REQUEST['um_admin_save_taxonomy_restrict_content_nonce'] ) || ! wp_verify_nonce( $_REQUEST['um_admin_save_taxonomy_restrict_content_nonce'], basename( __FILE__ ) ) ) {
|
652 |
-
return $termID;
|
653 |
-
}
|
654 |
-
|
655 |
-
// validate user
|
656 |
-
$term = get_term( $termID );
|
657 |
-
$taxonomy = get_taxonomy( $term->taxonomy );
|
658 |
-
|
659 |
-
if ( ! current_user_can( $taxonomy->cap->edit_terms, $termID ) ) {
|
660 |
-
return $termID;
|
661 |
-
}
|
662 |
-
|
663 |
-
if ( ! empty( $_REQUEST['um_content_restriction'] ) && is_array( $_REQUEST['um_content_restriction'] ) ) {
|
664 |
-
$restriction_meta = UM()->admin()->sanitize_term_restriction_meta( $_REQUEST['um_content_restriction'] );
|
665 |
-
|
666 |
-
update_term_meta( $termID, 'um_content_restriction', $restriction_meta );
|
667 |
-
} else {
|
668 |
-
delete_term_meta( $termID, 'um_content_restriction' );
|
669 |
-
}
|
670 |
-
|
671 |
-
return $termID;
|
672 |
-
}
|
673 |
-
|
674 |
-
|
675 |
-
/**
|
676 |
-
* Load a directory metabox
|
677 |
-
*
|
678 |
-
* @param $object
|
679 |
-
* @param $box
|
680 |
-
*/
|
681 |
-
function load_metabox_directory( $object, $box ) {
|
682 |
-
$box['id'] = str_replace( 'um-admin-form-', '', $box['id'] );
|
683 |
-
|
684 |
-
preg_match('#\{.*?\}#s', $box['id'], $matches );
|
685 |
-
|
686 |
-
if ( isset( $matches[0] ) ) {
|
687 |
-
$path = $matches[0];
|
688 |
-
$box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
|
689 |
-
} else {
|
690 |
-
$path = um_path;
|
691 |
-
}
|
692 |
-
|
693 |
-
$path = str_replace('{','', $path );
|
694 |
-
$path = str_replace('}','', $path );
|
695 |
-
|
696 |
-
|
697 |
-
include_once $path . 'includes/admin/templates/directory/'. $box['id'] . '.php';
|
698 |
-
if ( ! $this->directory_nonce_added ) {
|
699 |
-
$this->directory_nonce_added = true;
|
700 |
-
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_directory_nonce' );
|
701 |
-
}
|
702 |
-
}
|
703 |
-
|
704 |
-
|
705 |
-
/**
|
706 |
-
* Load a role metabox
|
707 |
-
*
|
708 |
-
* @param $object
|
709 |
-
* @param $box
|
710 |
-
*/
|
711 |
-
function load_metabox_role( $object, $box ) {
|
712 |
-
global $post;
|
713 |
-
|
714 |
-
$box['id'] = str_replace( 'um-admin-form-', '', $box['id'] );
|
715 |
-
|
716 |
-
if ( $box['id'] == 'builder' ) {
|
717 |
-
UM()->builder()->form_id = get_the_ID();
|
718 |
-
}
|
719 |
-
|
720 |
-
preg_match('#\{.*?\}#s', $box['id'], $matches);
|
721 |
-
|
722 |
-
if ( isset($matches[0]) ){
|
723 |
-
$path = $matches[0];
|
724 |
-
$box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
|
725 |
-
} else {
|
726 |
-
$path = um_path;
|
727 |
-
}
|
728 |
-
|
729 |
-
$path = str_replace('{','', $path );
|
730 |
-
$path = str_replace('}','', $path );
|
731 |
-
|
732 |
-
include_once $path . 'includes/admin/templates/role/'. $box['id'] . '.php';
|
733 |
-
//wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_role_nonce' );
|
734 |
-
}
|
735 |
-
|
736 |
-
|
737 |
-
/**
|
738 |
-
* Load a form metabox
|
739 |
-
*
|
740 |
-
* @param $object
|
741 |
-
* @param $box
|
742 |
-
*/
|
743 |
-
function load_metabox_form( $object, $box ) {
|
744 |
-
global $post;
|
745 |
-
|
746 |
-
$box['id'] = str_replace( 'um-admin-form-','', $box['id'] );
|
747 |
-
|
748 |
-
if ( $box['id'] == 'builder' ) {
|
749 |
-
UM()->builder()->form_id = get_the_ID();
|
750 |
-
}
|
751 |
-
|
752 |
-
preg_match('#\{.*?\}#s', $box['id'], $matches);
|
753 |
-
|
754 |
-
if ( isset( $matches[0] ) ) {
|
755 |
-
$path = $matches[0];
|
756 |
-
$box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
|
757 |
-
} else {
|
758 |
-
$path = um_path;
|
759 |
-
}
|
760 |
-
|
761 |
-
$path = str_replace('{','', $path );
|
762 |
-
$path = str_replace('}','', $path );
|
763 |
-
|
764 |
-
include_once $path . 'includes/admin/templates/form/'. $box['id'] . '.php';
|
765 |
-
|
766 |
-
if ( ! $this->form_nonce_added ) {
|
767 |
-
$this->form_nonce_added = true;
|
768 |
-
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_form_nonce' );
|
769 |
-
}
|
770 |
-
}
|
771 |
-
|
772 |
-
|
773 |
-
/**
|
774 |
-
* Load admin custom metabox
|
775 |
-
*
|
776 |
-
* @param $object
|
777 |
-
* @param $box
|
778 |
-
*/
|
779 |
-
function load_metabox_custom( $object, $box ) {
|
780 |
-
global $post;
|
781 |
-
|
782 |
-
$box['id'] = str_replace('um-admin-custom-','', $box['id']);
|
783 |
-
|
784 |
-
preg_match('#\{.*?\}#s', $box['id'], $matches);
|
785 |
-
|
786 |
-
if ( isset($matches[0]) ){
|
787 |
-
$path = $matches[0];
|
788 |
-
$box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
|
789 |
-
} else {
|
790 |
-
$path = um_path;
|
791 |
-
}
|
792 |
-
|
793 |
-
$path = str_replace('{','', $path );
|
794 |
-
$path = str_replace('}','', $path );
|
795 |
-
|
796 |
-
include_once $path . 'includes/admin/templates/'. $box['id'] . '.php';
|
797 |
-
if ( ! $this->custom_nonce_added ) {
|
798 |
-
$this->custom_nonce_added = true;
|
799 |
-
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_custom_nonce' );
|
800 |
-
}
|
801 |
-
}
|
802 |
-
|
803 |
-
|
804 |
-
/**
|
805 |
-
* Add directory metabox
|
806 |
-
*/
|
807 |
-
function add_metabox_directory() {
|
808 |
-
add_meta_box( 'um-admin-form-general', __( 'General Options', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
809 |
-
add_meta_box( 'um-admin-form-sorting', __( 'Sorting', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
810 |
-
add_meta_box( 'um-admin-form-profile', __( 'Profile Card', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
811 |
-
add_meta_box( 'um-admin-form-search', __( 'Search Options', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
812 |
-
add_meta_box( 'um-admin-form-pagination', __( 'Results & Pagination', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
813 |
-
add_meta_box( 'um-admin-form-shortcode', __( 'Shortcode', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'side', 'default' );
|
814 |
-
add_meta_box( 'um-admin-form-appearance', __( 'Styling: General', 'ultimate-member' ), array( &$this, 'load_metabox_directory'), 'um_directory', 'side', 'default' );
|
815 |
-
}
|
816 |
-
|
817 |
-
|
818 |
-
/**
|
819 |
-
* Add role metabox
|
820 |
-
*/
|
821 |
-
function add_metabox_role() {
|
822 |
-
$callback = array( &$this, 'load_metabox_role' );
|
823 |
-
|
824 |
-
$roles_metaboxes = array(
|
825 |
-
array(
|
826 |
-
'id' => 'um-admin-form-admin-permissions',
|
827 |
-
'title' => __( 'Administrative Permissions', 'ultimate-member' ),
|
828 |
-
'callback' => $callback,
|
829 |
-
'screen' => 'um_role_meta',
|
830 |
-
'context' => 'normal',
|
831 |
-
'priority' => 'default'
|
832 |
-
),
|
833 |
-
array(
|
834 |
-
'id' => 'um-admin-form-general',
|
835 |
-
'title' => __( 'General Permissions', 'ultimate-member' ),
|
836 |
-
'callback' => $callback,
|
837 |
-
'screen' => 'um_role_meta',
|
838 |
-
'context' => 'normal',
|
839 |
-
'priority' => 'default'
|
840 |
-
),
|
841 |
-
array(
|
842 |
-
'id' => 'um-admin-form-profile',
|
843 |
-
'title' => __( 'Profile Access', 'ultimate-member' ),
|
844 |
-
'callback' => $callback,
|
845 |
-
'screen' => 'um_role_meta',
|
846 |
-
'context' => 'normal',
|
847 |
-
'priority' => 'default'
|
848 |
-
)
|
849 |
-
);
|
850 |
-
|
851 |
-
if ( ! isset( $_GET['id'] ) || 'administrator' !== sanitize_key( $_GET['id'] ) ) {
|
852 |
-
$roles_metaboxes[] = array(
|
853 |
-
'id' => 'um-admin-form-home',
|
854 |
-
'title' => __( 'Homepage Options', 'ultimate-member' ),
|
855 |
-
'callback' => $callback,
|
856 |
-
'screen' => 'um_role_meta',
|
857 |
-
'context' => 'normal',
|
858 |
-
'priority' => 'default'
|
859 |
-
);
|
860 |
-
}
|
861 |
-
|
862 |
-
$roles_metaboxes = array_merge( $roles_metaboxes, array(
|
863 |
-
array(
|
864 |
-
'id' => 'um-admin-form-register',
|
865 |
-
'title' => __( 'Registration Options', 'ultimate-member' ),
|
866 |
-
'callback' => $callback,
|
867 |
-
'screen' => 'um_role_meta',
|
868 |
-
'context' => 'normal',
|
869 |
-
'priority' => 'default'
|
870 |
-
),
|
871 |
-
array(
|
872 |
-
'id' => 'um-admin-form-login',
|
873 |
-
'title' => __( 'Login Options', 'ultimate-member' ),
|
874 |
-
'callback' => $callback,
|
875 |
-
'screen' => 'um_role_meta',
|
876 |
-
'context' => 'normal',
|
877 |
-
'priority' => 'default'
|
878 |
-
),
|
879 |
-
array(
|
880 |
-
'id' => 'um-admin-form-logout',
|
881 |
-
'title' => __( 'Logout Options', 'ultimate-member' ),
|
882 |
-
'callback' => $callback,
|
883 |
-
'screen' => 'um_role_meta',
|
884 |
-
'context' => 'normal',
|
885 |
-
'priority' => 'default'
|
886 |
-
),
|
887 |
-
array(
|
888 |
-
'id' => 'um-admin-form-delete',
|
889 |
-
'title' => __( 'Delete Options', 'ultimate-member' ),
|
890 |
-
'callback' => $callback,
|
891 |
-
'screen' => 'um_role_meta',
|
892 |
-
'context' => 'normal',
|
893 |
-
'priority' => 'default'
|
894 |
-
),
|
895 |
-
array(
|
896 |
-
'id' => 'um-admin-form-publish',
|
897 |
-
'title' => __( 'Publish', 'ultimate-member' ),
|
898 |
-
'callback' => $callback,
|
899 |
-
'screen' => 'um_role_meta',
|
900 |
-
'context' => 'side',
|
901 |
-
'priority' => 'default'
|
902 |
-
)
|
903 |
-
) );
|
904 |
-
|
905 |
-
/**
|
906 |
-
* UM hook
|
907 |
-
*
|
908 |
-
* @type filter
|
909 |
-
* @title um_admin_role_metaboxes
|
910 |
-
* @description Extend metaboxes at Add/Edit User Role
|
911 |
-
* @input_vars
|
912 |
-
* [{"var":"$roles_metaboxes","type":"array","desc":"Metaboxes at Add/Edit UM Role"}]
|
913 |
-
* @change_log
|
914 |
-
* ["Since: 2.0"]
|
915 |
-
* @usage add_filter( 'um_admin_role_metaboxes', 'function_name', 10, 1 );
|
916 |
-
* @example
|
917 |
-
* <?php
|
918 |
-
* add_filter( 'um_admin_role_metaboxes', 'my_admin_role_metaboxes', 10, 1 );
|
919 |
-
* function my_admin_role_metaboxes( $roles_metaboxes ) {
|
920 |
-
* // your code here
|
921 |
-
* $roles_metaboxes[] = array(
|
922 |
-
* 'id' => 'um-admin-form-your-custom',
|
923 |
-
* 'title' => __( 'My Roles Metabox', 'ultimate-member' ),
|
924 |
-
* 'callback' => 'my-metabox-callback',
|
925 |
-
* 'screen' => 'um_role_meta',
|
926 |
-
* 'context' => 'side',
|
927 |
-
* 'priority' => 'default'
|
928 |
-
* );
|
929 |
-
*
|
930 |
-
* return $roles_metaboxes;
|
931 |
-
* }
|
932 |
-
* ?>
|
933 |
-
*/
|
934 |
-
$roles_metaboxes = apply_filters( 'um_admin_role_metaboxes', $roles_metaboxes );
|
935 |
-
|
936 |
-
$wp_caps_metabox = false;
|
937 |
-
if ( ! empty( $_GET['id'] ) ) {
|
938 |
-
$data = get_option( 'um_role_' . sanitize_key( $_GET['id'] ) . '_meta' );
|
939 |
-
if ( ! empty( $data['_um_is_custom'] ) ) {
|
940 |
-
$wp_caps_metabox = true;
|
941 |
-
}
|
942 |
-
}
|
943 |
-
if ( 'add' == sanitize_key( $_GET['tab'] ) || $wp_caps_metabox ) {
|
944 |
-
$roles_metaboxes[] = array(
|
945 |
-
'id' => 'um-admin-form-wp-capabilities',
|
946 |
-
'title' => __( 'WP Capabilities', 'ultimate-member' ),
|
947 |
-
'callback' => $callback,
|
948 |
-
'screen' => 'um_role_meta',
|
949 |
-
'context' => 'normal',
|
950 |
-
'priority' => 'default'
|
951 |
-
);
|
952 |
-
}
|
953 |
-
|
954 |
-
|
955 |
-
foreach ( $roles_metaboxes as $metabox ) {
|
956 |
-
add_meta_box(
|
957 |
-
$metabox['id'],
|
958 |
-
$metabox['title'],
|
959 |
-
$metabox['callback'],
|
960 |
-
$metabox['screen'],
|
961 |
-
$metabox['context'],
|
962 |
-
$metabox['priority']
|
963 |
-
);
|
964 |
-
}
|
965 |
-
}
|
966 |
-
|
967 |
-
|
968 |
-
/**
|
969 |
-
* Add form metabox
|
970 |
-
*/
|
971 |
-
function add_metabox_form() {
|
972 |
-
|
973 |
-
add_meta_box( 'um-admin-form-mode', __( 'Select Form Type', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
|
974 |
-
add_meta_box( 'um-admin-form-builder', __( 'Form Builder', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
|
975 |
-
add_meta_box( 'um-admin-form-shortcode', __( 'Shortcode', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
976 |
-
|
977 |
-
add_meta_box( 'um-admin-form-register_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
978 |
-
|
979 |
-
/**
|
980 |
-
* UM hook
|
981 |
-
*
|
982 |
-
* @type action
|
983 |
-
* @title um_admin_custom_register_metaboxes
|
984 |
-
* @description Add custom metaboxes for register form
|
985 |
-
* @change_log
|
986 |
-
* ["Since: 2.0"]
|
987 |
-
* @usage add_action( 'um_admin_custom_register_metaboxes', 'function_name', 10 );
|
988 |
-
* @example
|
989 |
-
* <?php
|
990 |
-
* add_action( 'um_admin_custom_register_metaboxes', 'my_admin_custom_register_metaboxes', 10 );
|
991 |
-
* function my_admin_custom_register_metaboxes() {
|
992 |
-
* // your code here
|
993 |
-
* }
|
994 |
-
* ?>
|
995 |
-
*/
|
996 |
-
do_action( 'um_admin_custom_register_metaboxes' );
|
997 |
-
|
998 |
-
add_meta_box( 'um-admin-form-profile_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
999 |
-
add_meta_box( 'um-admin-form-profile_settings', __( 'User Meta', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
1000 |
-
|
1001 |
-
/**
|
1002 |
-
* UM hook
|
1003 |
-
*
|
1004 |
-
* @type action
|
1005 |
-
* @title um_admin_custom_profile_metaboxes
|
1006 |
-
* @description Add custom metaboxes for profile form
|
1007 |
-
* @change_log
|
1008 |
-
* ["Since: 2.0"]
|
1009 |
-
* @usage add_action( 'um_admin_custom_profile_metaboxes', 'function_name', 10 );
|
1010 |
-
* @example
|
1011 |
-
* <?php
|
1012 |
-
* add_action( 'um_admin_custom_profile_metaboxes', 'my_admin_custom_profile_metaboxes', 10 );
|
1013 |
-
* function my_admin_custom_profile_metaboxes() {
|
1014 |
-
* // your code here
|
1015 |
-
* }
|
1016 |
-
* ?>
|
1017 |
-
*/
|
1018 |
-
do_action( 'um_admin_custom_profile_metaboxes' );
|
1019 |
-
|
1020 |
-
add_meta_box( 'um-admin-form-login_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
1021 |
-
add_meta_box( 'um-admin-form-login_settings', __( 'Options', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
1022 |
-
|
1023 |
-
/**
|
1024 |
-
* UM hook
|
1025 |
-
*
|
1026 |
-
* @type action
|
1027 |
-
* @title um_admin_custom_login_metaboxes
|
1028 |
-
* @description Add custom metaboxes for login form
|
1029 |
-
* @change_log
|
1030 |
-
* ["Since: 2.0"]
|
1031 |
-
* @usage add_action( 'um_admin_custom_login_metaboxes', 'function_name', 10 );
|
1032 |
-
* @example
|
1033 |
-
* <?php
|
1034 |
-
* add_action( 'um_admin_custom_login_metaboxes', 'my_admin_custom_login_metaboxes', 10 );
|
1035 |
-
* function my_admin_custom_login_metaboxes() {
|
1036 |
-
* // your code here
|
1037 |
-
* }
|
1038 |
-
* ?>
|
1039 |
-
*/
|
1040 |
-
do_action( 'um_admin_custom_login_metaboxes' );
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
|
1044 |
-
/**
|
1045 |
-
* Save directory metabox
|
1046 |
-
*
|
1047 |
-
* @param $post_id
|
1048 |
-
* @param $post
|
1049 |
-
*/
|
1050 |
-
function save_metabox_directory( $post_id, $post ) {
|
1051 |
-
global $wpdb;
|
1052 |
-
|
1053 |
-
// validate nonce
|
1054 |
-
if ( ! isset( $_POST['um_admin_save_metabox_directory_nonce'] ) ||
|
1055 |
-
! wp_verify_nonce( $_POST['um_admin_save_metabox_directory_nonce'], basename( __FILE__ ) ) ) {
|
1056 |
-
return;
|
1057 |
-
}
|
1058 |
-
|
1059 |
-
// validate post type
|
1060 |
-
if ( $post->post_type != 'um_directory' ) {
|
1061 |
-
return;
|
1062 |
-
}
|
1063 |
-
|
1064 |
-
// validate user
|
1065 |
-
$post_type = get_post_type_object( $post->post_type );
|
1066 |
-
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
1067 |
-
return;
|
1068 |
-
}
|
1069 |
-
|
1070 |
-
$where = array( 'ID' => $post_id );
|
1071 |
-
|
1072 |
-
if ( empty( $_POST['post_title'] ) ) {
|
1073 |
-
$_POST['post_title'] = sprintf( __( 'Directory #%s', 'ultimate-member' ), $post_id );
|
1074 |
-
}
|
1075 |
-
|
1076 |
-
$wpdb->update( $wpdb->posts, array( 'post_title' => sanitize_text_field( $_POST['post_title'] ) ), $where );
|
1077 |
-
|
1078 |
-
do_action( 'um_before_member_directory_save', $post_id );
|
1079 |
-
|
1080 |
-
// save
|
1081 |
-
delete_post_meta( $post_id, '_um_roles' );
|
1082 |
-
delete_post_meta( $post_id, '_um_tagline_fields' );
|
1083 |
-
delete_post_meta( $post_id, '_um_reveal_fields' );
|
1084 |
-
delete_post_meta( $post_id, '_um_search_fields' );
|
1085 |
-
delete_post_meta( $post_id, '_um_roles_can_search' );
|
1086 |
-
delete_post_meta( $post_id, '_um_roles_can_filter' );
|
1087 |
-
delete_post_meta( $post_id, '_um_show_these_users' );
|
1088 |
-
delete_post_meta( $post_id, '_um_exclude_these_users' );
|
1089 |
-
|
1090 |
-
delete_post_meta( $post_id, '_um_search_filters' );
|
1091 |
-
delete_post_meta( $post_id, '_um_search_filters_gmt' );
|
1092 |
-
|
1093 |
-
delete_post_meta( $post_id, '_um_sorting_fields' );
|
1094 |
-
|
1095 |
-
//save metadata
|
1096 |
-
$metadata = UM()->admin()->sanitize_member_directory_meta( $_POST['um_metadata'] );
|
1097 |
-
foreach ( $metadata as $k => $v ) {
|
1098 |
-
|
1099 |
-
if ( $k == '_um_show_these_users' && trim( $v ) ) {
|
1100 |
-
$v = preg_split( '/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY );
|
1101 |
-
}
|
1102 |
-
|
1103 |
-
if ( $k == '_um_exclude_these_users' && trim( $v ) ) {
|
1104 |
-
$v = preg_split( '/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY );
|
1105 |
-
}
|
1106 |
-
|
1107 |
-
if ( strstr( $k, '_um_' ) ) {
|
1108 |
-
|
1109 |
-
if ( $k === '_um_is_default' ) {
|
1110 |
-
|
1111 |
-
$mode = UM()->query()->get_attr( 'mode', $post_id );
|
1112 |
-
|
1113 |
-
if ( ! empty( $mode ) ) {
|
1114 |
-
|
1115 |
-
$posts = $wpdb->get_col(
|
1116 |
-
"SELECT post_id
|
1117 |
-
FROM {$wpdb->postmeta}
|
1118 |
-
WHERE meta_key = '_um_mode' AND
|
1119 |
-
meta_value = 'directory'"
|
1120 |
-
);
|
1121 |
-
|
1122 |
-
foreach ( $posts as $p_id ) {
|
1123 |
-
delete_post_meta( $p_id, '_um_is_default' );
|
1124 |
-
}
|
1125 |
-
|
1126 |
-
}
|
1127 |
-
|
1128 |
-
}
|
1129 |
-
|
1130 |
-
$v = apply_filters( 'um_member_directory_meta_value_before_save', $v, $k, $post_id );
|
1131 |
-
|
1132 |
-
update_post_meta( $post_id, $k, $v );
|
1133 |
-
|
1134 |
-
}
|
1135 |
-
}
|
1136 |
-
|
1137 |
-
update_post_meta( $post_id, '_um_search_filters_gmt', (int) $_POST['um-gmt-offset'] );
|
1138 |
-
}
|
1139 |
-
|
1140 |
-
|
1141 |
-
/**
|
1142 |
-
* Save form metabox
|
1143 |
-
*
|
1144 |
-
* @param $post_id
|
1145 |
-
* @param $post
|
1146 |
-
*/
|
1147 |
-
function save_metabox_form( $post_id, $post ) {
|
1148 |
-
global $wpdb;
|
1149 |
-
|
1150 |
-
// validate nonce
|
1151 |
-
if ( ! isset( $_POST['um_admin_save_metabox_form_nonce'] ) ||
|
1152 |
-
! wp_verify_nonce( $_POST['um_admin_save_metabox_form_nonce'], basename( __FILE__ ) ) ) {
|
1153 |
-
return;
|
1154 |
-
}
|
1155 |
-
|
1156 |
-
// validate post type
|
1157 |
-
if ( $post->post_type != 'um_form' ) {
|
1158 |
-
return;
|
1159 |
-
}
|
1160 |
-
|
1161 |
-
// validate user
|
1162 |
-
$post_type = get_post_type_object( $post->post_type );
|
1163 |
-
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
1164 |
-
return;
|
1165 |
-
}
|
1166 |
-
|
1167 |
-
$where = array( 'ID' => $post_id );
|
1168 |
-
if ( empty( $_POST['post_title'] ) ) {
|
1169 |
-
$_POST['post_title'] = sprintf( __( 'Form #%s', 'ultimate-member' ), $post_id );
|
1170 |
-
}
|
1171 |
-
$wpdb->update( $wpdb->posts, array( 'post_title' => sanitize_text_field( $_POST['post_title'] ) ), $where );
|
1172 |
-
|
1173 |
-
// save
|
1174 |
-
delete_post_meta( $post_id, '_um_profile_metafields' );
|
1175 |
-
|
1176 |
-
$form_meta = UM()->admin()->sanitize_form_meta( $_POST['form'] );
|
1177 |
-
|
1178 |
-
foreach ( $form_meta as $k => $v ) {
|
1179 |
-
if ( strstr( $k, '_um_' ) ) {
|
1180 |
-
if ( $k === '_um_is_default' ) {
|
1181 |
-
$mode = UM()->query()->get_attr( 'mode', $post_id );
|
1182 |
-
if ( ! empty( $mode ) ) {
|
1183 |
-
$posts = $wpdb->get_col( $wpdb->prepare(
|
1184 |
-
"SELECT post_id
|
1185 |
-
FROM {$wpdb->postmeta}
|
1186 |
-
WHERE meta_key = '_um_mode' AND
|
1187 |
-
meta_value = %s",
|
1188 |
-
$mode
|
1189 |
-
) );
|
1190 |
-
foreach ( $posts as $p_id ) {
|
1191 |
-
delete_post_meta( $p_id, '_um_is_default' );
|
1192 |
-
}
|
1193 |
-
}
|
1194 |
-
}
|
1195 |
-
|
1196 |
-
update_post_meta( $post_id, $k, $v );
|
1197 |
-
}
|
1198 |
-
}
|
1199 |
-
|
1200 |
-
}
|
1201 |
-
|
1202 |
-
|
1203 |
-
/**
|
1204 |
-
* Load modal content
|
1205 |
-
*/
|
1206 |
-
function load_modal_content() {
|
1207 |
-
$screen = get_current_screen();
|
1208 |
-
|
1209 |
-
if ( isset( $screen->id ) && strstr( $screen->id, 'um_form' ) ) {
|
1210 |
-
foreach ( glob( um_path . 'includes/admin/templates/modal/forms/*.php' ) as $modal_content ) {
|
1211 |
-
include_once $modal_content;
|
1212 |
-
}
|
1213 |
-
}
|
1214 |
-
|
1215 |
-
if ( $this->init_icon ) {
|
1216 |
-
include_once um_path . 'includes/admin/templates/modal/forms/fonticons.php';
|
1217 |
-
}
|
1218 |
-
|
1219 |
-
if ( $screen->id == 'users' ) {
|
1220 |
-
include_once um_path . 'includes/admin/templates/modal/dynamic_registration_preview.php';
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
// needed on forms only
|
1224 |
-
if ( ! isset( $this->is_loaded ) && isset( $screen->id ) && strstr( $screen->id, 'um_form' ) ) {
|
1225 |
-
$settings['textarea_rows'] = 8;
|
1226 |
-
|
1227 |
-
echo '<div class="um-hidden-editor-edit" style="display:none;">';
|
1228 |
-
wp_editor( '', 'um_editor_edit', $settings );
|
1229 |
-
echo '</div>';
|
1230 |
-
|
1231 |
-
echo '<div class="um-hidden-editor-new" style="display:none;">';
|
1232 |
-
wp_editor( '', 'um_editor_new', $settings );
|
1233 |
-
echo '</div>';
|
1234 |
-
|
1235 |
-
$this->is_loaded = true;
|
1236 |
-
}
|
1237 |
-
}
|
1238 |
-
|
1239 |
-
|
1240 |
-
/**
|
1241 |
-
* Show field input for edit at modal field
|
1242 |
-
*
|
1243 |
-
* @param $attribute
|
1244 |
-
* @param null $form_id
|
1245 |
-
* @param array $field_args
|
1246 |
-
*/
|
1247 |
-
function field_input( $attribute, $form_id = null, $field_args = array() ) {
|
1248 |
-
|
1249 |
-
if ( $this->in_edit == true ) { // we're editing a field
|
1250 |
-
$real_attr = substr( $attribute, 1 );
|
1251 |
-
$this->edit_mode_value = isset( $this->edit_array[ $real_attr ] ) ? $this->edit_array[ $real_attr ] : null;
|
1252 |
-
}
|
1253 |
-
|
1254 |
-
switch ( $attribute ) {
|
1255 |
-
|
1256 |
-
default:
|
1257 |
-
|
1258 |
-
/**
|
1259 |
-
* UM hook
|
1260 |
-
*
|
1261 |
-
* @type action
|
1262 |
-
* @title um_admin_field_edit_hook{$attribute}
|
1263 |
-
* @description Integration for 3-d party fields at wp-admin
|
1264 |
-
* @input_vars
|
1265 |
-
* [{"var":"$edit_mode_value","type":"string","desc":"Post ID"}]
|
1266 |
-
* @change_log
|
1267 |
-
* ["Since: 2.0"]
|
1268 |
-
* @usage add_action( 'um_admin_field_edit_hook{$attribute}', 'function_name', 10, 1 );
|
1269 |
-
* @example
|
1270 |
-
* <?php
|
1271 |
-
* add_action( 'um_admin_field_edit_hook{$attribute}', 'my_admin_field_edit', 10, 1 );
|
1272 |
-
* function my_admin_field_edit( $edit_mode_value ) {
|
1273 |
-
* // your code here
|
1274 |
-
* }
|
1275 |
-
* ?>
|
1276 |
-
*/
|
1277 |
-
do_action( "um_admin_field_edit_hook{$attribute}", $this->edit_mode_value, $form_id, $this->edit_array );
|
1278 |
-
|
1279 |
-
break;
|
1280 |
-
|
1281 |
-
case '_visibility':
|
1282 |
-
?>
|
1283 |
-
|
1284 |
-
<p><label for="_visibility"><?php _e( 'Visibility', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select where this field should appear. This option should only be changed on the profile form and allows you to show a field in one mode only (edit or view) or in both modes.','ultimate-member' ) ); ?></label>
|
1285 |
-
<select name="_visibility" id="_visibility" style="width: 100%">
|
1286 |
-
<option value="all" <?php selected( 'all', $this->edit_mode_value ); ?>><?php _e( 'View everywhere', 'ultimate-member' ) ?></option>
|
1287 |
-
<option value="edit" <?php selected( 'edit', $this->edit_mode_value ); ?>><?php _e( 'Edit mode only', 'ultimate-member' ) ?></option>
|
1288 |
-
<option value="view" <?php selected( 'view', $this->edit_mode_value ); ?>><?php _e( 'View mode only', 'ultimate-member' ) ?></option>
|
1289 |
-
</select>
|
1290 |
-
</p>
|
1291 |
-
|
1292 |
-
<?php
|
1293 |
-
break;
|
1294 |
-
|
1295 |
-
case '_conditional_action':
|
1296 |
-
case '_conditional_action1':
|
1297 |
-
case '_conditional_action2':
|
1298 |
-
case '_conditional_action3':
|
1299 |
-
case '_conditional_action4':
|
1300 |
-
?>
|
1301 |
-
|
1302 |
-
<p>
|
1303 |
-
<select name="<?php echo esc_attr( $attribute ); ?>" id="<?php echo esc_attr( $attribute ); ?>" style="width: 90px">
|
1304 |
-
|
1305 |
-
<option></option>
|
1306 |
-
|
1307 |
-
<?php $actions = array( 'show', 'hide' );
|
1308 |
-
foreach ( $actions as $action ) { ?>
|
1309 |
-
|
1310 |
-
<option value="<?php echo esc_attr( $action ); ?>" <?php selected( $action, $this->edit_mode_value ); ?>><?php echo $action; ?></option>
|
1311 |
-
|
1312 |
-
<?php } ?>
|
1313 |
-
|
1314 |
-
</select>
|
1315 |
-
|
1316 |
-
<?php _e( 'If' ); ?>
|
1317 |
-
</p>
|
1318 |
-
|
1319 |
-
<?php
|
1320 |
-
break;
|
1321 |
-
|
1322 |
-
case '_conditional_field':
|
1323 |
-
case '_conditional_field1':
|
1324 |
-
case '_conditional_field2':
|
1325 |
-
case '_conditional_field3':
|
1326 |
-
case '_conditional_field4':
|
1327 |
-
?>
|
1328 |
-
|
1329 |
-
<p>
|
1330 |
-
<select name="<?php echo esc_attr( $attribute ); ?>" id="<?php echo esc_attr( $attribute ); ?>" style="width: 150px">
|
1331 |
-
|
1332 |
-
<option></option>
|
1333 |
-
|
1334 |
-
<?php $fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
1335 |
-
|
1336 |
-
foreach ( $fields as $key => $array ) {
|
1337 |
-
if ( isset( $array['title'] ) &&
|
1338 |
-
( ! isset( $this->edit_array['metakey'] ) || $key != $this->edit_array['metakey'] ) ) { ?>
|
1339 |
-
|
1340 |
-
<option value="<?php echo esc_attr( $key ) ?>" <?php selected( $key, $this->edit_mode_value ) ?>><?php echo $array['title'] ?></option>
|
1341 |
-
|
1342 |
-
<?php }
|
1343 |
-
} ?>
|
1344 |
-
|
1345 |
-
</select>
|
1346 |
-
</p>
|
1347 |
-
|
1348 |
-
<?php
|
1349 |
-
break;
|
1350 |
-
|
1351 |
-
case '_conditional_operator':
|
1352 |
-
case '_conditional_operator1':
|
1353 |
-
case '_conditional_operator2':
|
1354 |
-
case '_conditional_operator3':
|
1355 |
-
case '_conditional_operator4':
|
1356 |
-
?>
|
1357 |
-
|
1358 |
-
<p>
|
1359 |
-
<select name="<?php echo esc_attr( $attribute ); ?>" id="<?php echo esc_attr( $attribute ); ?>" style="width: 150px">
|
1360 |
-
|
1361 |
-
<option></option>
|
1362 |
-
|
1363 |
-
<?php $operators = array(
|
1364 |
-
'empty',
|
1365 |
-
'not empty',
|
1366 |
-
'equals to',
|
1367 |
-
'not equals',
|
1368 |
-
'greater than',
|
1369 |
-
'less than',
|
1370 |
-
'contains'
|
1371 |
-
);
|
1372 |
-
|
1373 |
-
foreach ( $operators as $operator ) { ?>
|
1374 |
-
|
1375 |
-
<option value="<?php echo esc_attr( $operator ); ?>" <?php selected( $operator, $this->edit_mode_value ); ?>><?php echo $operator; ?></option>
|
1376 |
-
|
1377 |
-
<?php } ?>
|
1378 |
-
|
1379 |
-
</select>
|
1380 |
-
</p>
|
1381 |
-
|
1382 |
-
<?php
|
1383 |
-
break;
|
1384 |
-
|
1385 |
-
case '_conditional_value':
|
1386 |
-
case '_conditional_value1':
|
1387 |
-
case '_conditional_value2':
|
1388 |
-
case '_conditional_value3':
|
1389 |
-
case '_conditional_value4':
|
1390 |
-
?>
|
1391 |
-
|
1392 |
-
<p>
|
1393 |
-
<input type="text" name="<?php echo esc_attr( $attribute ); ?>" id="<?php echo esc_attr( $attribute ); ?>" value="<?php echo isset( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" placeholder="<?php esc_attr_e( 'Value', 'ultimate-member' ); ?>" style="width: 150px!important;position: relative;top: -1px;" />
|
1394 |
-
</p>
|
1395 |
-
|
1396 |
-
<?php
|
1397 |
-
break;
|
1398 |
-
|
1399 |
-
case '_validate':
|
1400 |
-
?>
|
1401 |
-
|
1402 |
-
<p><label for="_validate"><?php _e( 'Validate', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Does this field require a special validation', 'ultimate-member' ) ); ?></label>
|
1403 |
-
<select name="_validate" id="_validate" data-placeholder="<?php esc_attr_e( 'Select a validation type...', 'ultimate-member' ) ?>" class="um-adm-conditional" data-cond1="custom" data-cond1-show="_custom_validate" style="width: 100%">
|
1404 |
-
|
1405 |
-
<option value="" <?php selected( '', $this->edit_mode_value ); ?>></option>
|
1406 |
-
|
1407 |
-
<?php foreach( UM()->builtin()->validation_types() as $key => $name ) { ?>
|
1408 |
-
<?php
|
1409 |
-
/**
|
1410 |
-
* UM hook
|
1411 |
-
*
|
1412 |
-
* @type filter
|
1413 |
-
* @title um_builtin_validation_types_continue_loop
|
1414 |
-
* @description Builtin Validation Types
|
1415 |
-
* @input_vars
|
1416 |
-
* [{"var":"$continue","type":"bool","desc":"Validate?"},
|
1417 |
-
* {"var":"$key","type":"string","desc":"Field Key"},
|
1418 |
-
* {"var":"$form_id","type":"int","desc":"Form ID"},
|
1419 |
-
* {"var":"$field_args","type":"array","desc":"Field Settings"}]
|
1420 |
-
* @change_log
|
1421 |
-
* ["Since: 2.0"]
|
1422 |
-
* @usage add_filter( 'um_builtin_validation_types_continue_loop', 'function_name', 10, 4 );
|
1423 |
-
* @example
|
1424 |
-
* <?php
|
1425 |
-
* add_filter( 'um_builtin_validation_types_continue_loop', 'my_builtin_validation_types', 10, 4 );
|
1426 |
-
* function my_builtin_validation_types( $continue, $key, $form_id, $field_args ) {
|
1427 |
-
* // your code here
|
1428 |
-
* return $continue;
|
1429 |
-
* }
|
1430 |
-
* ?>
|
1431 |
-
*/
|
1432 |
-
$continue = apply_filters( "um_builtin_validation_types_continue_loop", true, $key, $form_id, $field_args );
|
1433 |
-
if ( $continue ) { ?>
|
1434 |
-
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $this->edit_mode_value ); ?>><?php echo $name; ?></option>
|
1435 |
-
<?php } ?>
|
1436 |
-
<?php } ?>
|
1437 |
-
|
1438 |
-
</select>
|
1439 |
-
</p>
|
1440 |
-
|
1441 |
-
<?php
|
1442 |
-
break;
|
1443 |
-
|
1444 |
-
case '_custom_validate':
|
1445 |
-
?>
|
1446 |
-
|
1447 |
-
<p class="_custom_validate"><label for="_custom_validate"><?php _e( 'Custom Action', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'If you want to apply your custom validation, you can use action hooks to add custom validation. Please refer to documentation for further details.', 'ultimate-member' ) ); ?></label>
|
1448 |
-
<input type="text" name="_custom_validate" id="_custom_validate" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1449 |
-
</p>
|
1450 |
-
|
1451 |
-
<?php
|
1452 |
-
break;
|
1453 |
-
|
1454 |
-
case '_icon':
|
1455 |
-
|
1456 |
-
if ( $this->set_field_type == 'row' ) {
|
1457 |
-
$back = 'UM_edit_row';
|
1458 |
-
|
1459 |
-
?>
|
1460 |
-
|
1461 |
-
<p class="_heading_text"><label for="_icon"><?php _e( 'Icon', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
|
1462 |
-
|
1463 |
-
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php _e( 'Choose Icon', 'ultimate-member' ) ?></a>
|
1464 |
-
|
1465 |
-
<span class="um-admin-icon-value"><?php if ( $this->edit_mode_value ) { ?><i class="<?php echo $this->edit_mode_value; ?>"></i><?php } else { ?><?php _e( 'No Icon', 'ultimate-member' ) ?><?php } ?></span>
|
1466 |
-
|
1467 |
-
<input type="hidden" name="_icon" id="_icon" value="<?php echo (isset( $this->edit_mode_value ) ) ? $this->edit_mode_value : ''; ?>" />
|
1468 |
-
|
1469 |
-
<?php if ( $this->edit_mode_value ) { ?>
|
1470 |
-
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
|
1471 |
-
<?php } else { ?>
|
1472 |
-
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
|
1473 |
-
<?php } ?>
|
1474 |
-
|
1475 |
-
</p>
|
1476 |
-
|
1477 |
-
<?php } else {
|
1478 |
-
|
1479 |
-
if ( $this->in_edit ) {
|
1480 |
-
$back = 'UM_edit_field';
|
1481 |
-
} else {
|
1482 |
-
$back = 'UM_add_field';
|
1483 |
-
}
|
1484 |
-
|
1485 |
-
?>
|
1486 |
-
|
1487 |
-
<div class="um-admin-tri">
|
1488 |
-
|
1489 |
-
<p><label for="_icon"><?php _e( 'Icon', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
|
1490 |
-
|
1491 |
-
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php _e( 'Choose Icon', 'ultimate-member' ) ?></a>
|
1492 |
-
|
1493 |
-
<span class="um-admin-icon-value"><?php if ( $this->edit_mode_value ) { ?><i class="<?php echo $this->edit_mode_value; ?>"></i><?php } else { ?><?php _e( 'No Icon', 'ultimate-member' ) ?><?php } ?></span>
|
1494 |
-
|
1495 |
-
<input type="hidden" name="_icon" id="_icon" value="<?php echo (isset( $this->edit_mode_value ) ) ? $this->edit_mode_value : ''; ?>" />
|
1496 |
-
|
1497 |
-
<?php if ( $this->edit_mode_value ) { ?>
|
1498 |
-
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
|
1499 |
-
<?php } else { ?>
|
1500 |
-
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
|
1501 |
-
<?php } ?>
|
1502 |
-
|
1503 |
-
</p>
|
1504 |
-
|
1505 |
-
</div>
|
1506 |
-
|
1507 |
-
<?php
|
1508 |
-
|
1509 |
-
}
|
1510 |
-
|
1511 |
-
break;
|
1512 |
-
|
1513 |
-
case '_css_class':
|
1514 |
-
?>
|
1515 |
-
|
1516 |
-
<p><label for="_css_class"><?php _e( 'CSS Class', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Specify a custom CSS class to be applied to this element', 'ultimate-member' ) ); ?></label>
|
1517 |
-
<input type="text" name="_css_class" id="_css_class" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1518 |
-
</p>
|
1519 |
-
|
1520 |
-
<?php
|
1521 |
-
break;
|
1522 |
-
|
1523 |
-
case '_width':
|
1524 |
-
?>
|
1525 |
-
|
1526 |
-
<p><label for="_width"><?php _e( 'Thickness (in pixels)', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the width in pixels, e.g. 4 or 2, etc', 'ultimate-member' ) ); ?></label>
|
1527 |
-
<input type="text" name="_width" id="_width" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 4; ?>" />
|
1528 |
-
</p>
|
1529 |
-
|
1530 |
-
<?php
|
1531 |
-
break;
|
1532 |
-
|
1533 |
-
case '_divider_text':
|
1534 |
-
?>
|
1535 |
-
|
1536 |
-
<p><label for="_divider_text"><?php _e( 'Optional Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Optional text to include with the divider', 'ultimate-member' ) ); ?></label>
|
1537 |
-
<input type="text" name="_divider_text" id="_divider_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1538 |
-
</p>
|
1539 |
-
|
1540 |
-
<?php
|
1541 |
-
break;
|
1542 |
-
|
1543 |
-
case '_padding':
|
1544 |
-
?>
|
1545 |
-
|
1546 |
-
<p><label for="_padding"><?php _e( 'Padding', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Set padding for this section', 'ultimate-member' ) ); ?></label>
|
1547 |
-
<input type="text" name="_padding" id="_padding" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px 0px 0px 0px'; ?>" />
|
1548 |
-
</p>
|
1549 |
-
|
1550 |
-
<?php
|
1551 |
-
break;
|
1552 |
-
|
1553 |
-
case '_margin':
|
1554 |
-
?>
|
1555 |
-
|
1556 |
-
<p><label for="_margin"><?php _e( 'Margin', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Set margin for this section', 'ultimate-member' ) ); ?></label>
|
1557 |
-
<input type="text" name="_margin" id="_margin" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px 0px 30px 0px'; ?>" />
|
1558 |
-
</p>
|
1559 |
-
|
1560 |
-
<?php
|
1561 |
-
break;
|
1562 |
-
|
1563 |
-
case '_border':
|
1564 |
-
?>
|
1565 |
-
|
1566 |
-
<p><label for="_border"><?php _e( 'Border', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Set border for this section', 'ultimate-member' ) ); ?></label>
|
1567 |
-
<input type="text" name="_border" id="_border" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px 0px 0px 0px'; ?>" />
|
1568 |
-
</p>
|
1569 |
-
|
1570 |
-
<?php
|
1571 |
-
break;
|
1572 |
-
|
1573 |
-
case '_borderstyle':
|
1574 |
-
?>
|
1575 |
-
|
1576 |
-
<p><label for="_borderstyle"><?php _e( 'Style', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Choose the border style', 'ultimate-member' ) ); ?></label>
|
1577 |
-
<select name="_borderstyle" id="_borderstyle" style="width: 100%">
|
1578 |
-
<option value="solid" <?php selected( 'solid', $this->edit_mode_value ); ?>><?php _e( 'Solid', 'ultimate-member' ) ?></option>
|
1579 |
-
<option value="dotted" <?php selected( 'dotted', $this->edit_mode_value ); ?>><?php _e( 'Dotted', 'ultimate-member' ) ?></option>
|
1580 |
-
<option value="dashed" <?php selected( 'dashed', $this->edit_mode_value ); ?>><?php _e( 'Dashed', 'ultimate-member' ) ?></option>
|
1581 |
-
<option value="double" <?php selected( 'double', $this->edit_mode_value ); ?>><?php _e( 'Double', 'ultimate-member' ) ?></option>
|
1582 |
-
</select>
|
1583 |
-
</p>
|
1584 |
-
|
1585 |
-
<?php
|
1586 |
-
break;
|
1587 |
-
|
1588 |
-
case '_borderradius':
|
1589 |
-
?>
|
1590 |
-
|
1591 |
-
<p><label for="_borderradius"><?php _e( 'Border Radius', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Rounded corners can be applied by setting a pixels value here. e.g. 5px', 'ultimate-member' ) ); ?></label>
|
1592 |
-
<input type="text" name="_borderradius" id="_borderradius" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px'; ?>" />
|
1593 |
-
</p>
|
1594 |
-
|
1595 |
-
<?php
|
1596 |
-
break;
|
1597 |
-
|
1598 |
-
case '_bordercolor':
|
1599 |
-
?>
|
1600 |
-
|
1601 |
-
<p><label for="_bordercolor"><?php _e( 'Border Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Give a color to this border', 'ultimate-member' ) ); ?></label>
|
1602 |
-
<input type="text" name="_bordercolor" id="_bordercolor" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1603 |
-
</p>
|
1604 |
-
|
1605 |
-
<?php
|
1606 |
-
break;
|
1607 |
-
|
1608 |
-
case '_heading':
|
1609 |
-
?>
|
1610 |
-
|
1611 |
-
<p><label for="_heading"><?php _e( 'Enable Row Heading', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Whether to enable a heading for this row', 'ultimate-member' ) ); ?></label>
|
1612 |
-
<input type="checkbox" name="_heading" id="_heading" value="1" <?php checked( isset( $this->edit_mode_value ) ? $this->edit_mode_value : 0 ) ?> class="um-adm-conditional" data-cond1="1" data-cond1-show="_heading_text" data-cond1-hide="xxx" />
|
1613 |
-
</p>
|
1614 |
-
|
1615 |
-
<?php
|
1616 |
-
break;
|
1617 |
-
|
1618 |
-
case '_heading_text':
|
1619 |
-
?>
|
1620 |
-
|
1621 |
-
<p class="_heading_text"><label for="_heading_text"><?php _e( 'Heading Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Enter the row heading text here', 'ultimate-member' ) ); ?></label>
|
1622 |
-
<input type="text" name="_heading_text" id="_heading_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1623 |
-
</p>
|
1624 |
-
|
1625 |
-
<?php
|
1626 |
-
break;
|
1627 |
-
|
1628 |
-
case '_background':
|
1629 |
-
?>
|
1630 |
-
|
1631 |
-
<p><label for="_background"><?php _e( 'Background Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the background of entire section', 'ultimate-member' ) ); ?></label>
|
1632 |
-
<input type="text" name="_background" id="_background" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1633 |
-
</p>
|
1634 |
-
|
1635 |
-
<?php
|
1636 |
-
break;
|
1637 |
-
|
1638 |
-
case '_heading_background_color':
|
1639 |
-
?>
|
1640 |
-
|
1641 |
-
<p class="_heading_text"><label for="_heading_background_color"><?php _e( 'Heading Background Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the background of the heading section', 'ultimate-member' ) ); ?></label>
|
1642 |
-
<input type="text" name="_heading_background_color" id="_heading_background_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1643 |
-
</p>
|
1644 |
-
|
1645 |
-
<?php
|
1646 |
-
break;
|
1647 |
-
|
1648 |
-
case '_heading_text_color':
|
1649 |
-
?>
|
1650 |
-
|
1651 |
-
<p class="_heading_text"><label for="_heading_text_color"><?php _e( 'Heading Text Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the text color of heading part only', 'ultimate-member' ) ); ?></label>
|
1652 |
-
<input type="text" name="_heading_text_color" id="_heading_text_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1653 |
-
</p>
|
1654 |
-
|
1655 |
-
<?php
|
1656 |
-
break;
|
1657 |
-
|
1658 |
-
case '_text_color':
|
1659 |
-
?>
|
1660 |
-
|
1661 |
-
<p><label for="_text_color"><?php _e( 'Text Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the text color of entire section', 'ultimate-member' ) ); ?></label>
|
1662 |
-
<input type="text" name="_text_color" id="_text_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1663 |
-
</p>
|
1664 |
-
|
1665 |
-
<?php
|
1666 |
-
break;
|
1667 |
-
|
1668 |
-
case '_icon_color':
|
1669 |
-
?>
|
1670 |
-
|
1671 |
-
<p class="_heading_text"><label for="_icon_color"><?php _e( 'Icon Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the color of selected icon. By default It will be the same color as heading text color', 'ultimate-member' ) ); ?></label>
|
1672 |
-
<input type="text" name="_icon_color" id="_icon_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1673 |
-
</p>
|
1674 |
-
|
1675 |
-
<?php
|
1676 |
-
break;
|
1677 |
-
|
1678 |
-
case '_color':
|
1679 |
-
?>
|
1680 |
-
|
1681 |
-
<p><label for="_color"><?php _e( 'Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select a color for this divider', 'ultimate-member' ) ); ?></label>
|
1682 |
-
<input type="text" name="_color" id="_color" class="um-admin-colorpicker" data-default-color="#eeeeee" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '#eeeeee'; ?>" />
|
1683 |
-
</p>
|
1684 |
-
|
1685 |
-
<?php
|
1686 |
-
break;
|
1687 |
-
|
1688 |
-
case '_url_text':
|
1689 |
-
?>
|
1690 |
-
|
1691 |
-
<p><label for="_url_text"><?php _e( 'URL Alt Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Entering custom text here will replace the url with a text link', 'ultimate-member' ) ); ?></label>
|
1692 |
-
<input type="text" name="_url_text" id="_url_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1693 |
-
</p>
|
1694 |
-
|
1695 |
-
<?php
|
1696 |
-
break;
|
1697 |
-
|
1698 |
-
case '_url_target':
|
1699 |
-
?>
|
1700 |
-
|
1701 |
-
<p><label for="_url_target"><?php _e( 'Link Target', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Choose whether to open this link in same window or in a new window', 'ultimate-member' ) ); ?></label>
|
1702 |
-
<select name="_url_target" id="_url_target" style="width: 100%">
|
1703 |
-
<option value="_blank" <?php selected( '_blank', $this->edit_mode_value ); ?>><?php _e( 'Open in new window', 'ultimate-member' ) ?></option>
|
1704 |
-
<option value="_self" <?php selected( '_self', $this->edit_mode_value ); ?>><?php _e( 'Same window', 'ultimate-member' ) ?></option>
|
1705 |
-
</select>
|
1706 |
-
</p>
|
1707 |
-
|
1708 |
-
<?php
|
1709 |
-
break;
|
1710 |
-
|
1711 |
-
case '_url_rel':
|
1712 |
-
?>
|
1713 |
-
|
1714 |
-
<p><label for="_url_rel"><?php _e( 'SEO Follow', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Whether to follow or nofollow this link by search engines', 'ultimate-member' ) ); ?></label>
|
1715 |
-
<select name="_url_rel" id="_url_rel" style="width: 100%">
|
1716 |
-
<option value="follow" <?php selected( 'follow', $this->edit_mode_value ); ?>><?php _e( 'Follow', 'ultimate-member' ) ?></option>
|
1717 |
-
<option value="nofollow" <?php selected( 'nofollow', $this->edit_mode_value ); ?>><?php _e( 'No-Follow', 'ultimate-member' ) ?></option>
|
1718 |
-
</select>
|
1719 |
-
</p>
|
1720 |
-
|
1721 |
-
<?php
|
1722 |
-
break;
|
1723 |
-
|
1724 |
-
case '_force_good_pass':
|
1725 |
-
?>
|
1726 |
-
|
1727 |
-
<p><label for="_force_good_pass"><?php _e( 'Force strong password?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Turn on to force users to create a strong password (A combination of one lowercase letter, one uppercase letter, and one number). If turned on this option is only applied to register forms and not to login forms.', 'ultimate-member' ) ); ?></label>
|
1728 |
-
<input type="checkbox" name="_force_good_pass" id="_force_good_pass" value="1" <?php checked( isset( $this->edit_mode_value ) ? $this->edit_mode_value : 0 ) ?> />
|
1729 |
-
</p>
|
1730 |
-
|
1731 |
-
<?php
|
1732 |
-
break;
|
1733 |
-
|
1734 |
-
case '_force_confirm_pass':
|
1735 |
-
?>
|
1736 |
-
|
1737 |
-
<p><label for="_force_confirm_pass"><?php _e( 'Automatically add a confirm password field?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Turn on to add a confirm password field. If turned on the confirm password field will only show on register forms and not on login forms.', 'ultimate-member' ) ); ?></label>
|
1738 |
-
<input type="checkbox" name="_force_confirm_pass" id="_force_confirm_pass" value="1" <?php checked( isset( $this->edit_mode_value ) ? $this->edit_mode_value : 0 ) ?> class="um-adm-conditional" data-cond1="1" data-cond1-show="_label_confirm_pass" data-cond1-hide="xxx" />
|
1739 |
-
</p>
|
1740 |
-
|
1741 |
-
<?php
|
1742 |
-
break;
|
1743 |
-
|
1744 |
-
case '_style':
|
1745 |
-
?>
|
1746 |
-
|
1747 |
-
<p><label for="_style"><?php _e( 'Style', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the line-style of divider', 'ultimate-member' ) ); ?></label>
|
1748 |
-
<select name="_style" id="_style" style="width: 100%">
|
1749 |
-
<option value="solid" <?php selected( 'solid', $this->edit_mode_value ); ?>><?php _e( 'Solid', 'ultimate-member' ) ?></option>
|
1750 |
-
<option value="dotted" <?php selected( 'dotted', $this->edit_mode_value ); ?>><?php _e( 'Dotted', 'ultimate-member' ) ?></option>
|
1751 |
-
<option value="dashed" <?php selected( 'dashed', $this->edit_mode_value ); ?>><?php _e( 'Dashed', 'ultimate-member' ) ?></option>
|
1752 |
-
<option value="double" <?php selected( 'double', $this->edit_mode_value ); ?>><?php _e( 'Double', 'ultimate-member' ) ?></option>
|
1753 |
-
</select>
|
1754 |
-
</p>
|
1755 |
-
|
1756 |
-
<?php
|
1757 |
-
break;
|
1758 |
-
|
1759 |
-
case '_intervals':
|
1760 |
-
|
1761 |
-
?>
|
1762 |
-
|
1763 |
-
<p><label for="_intervals"><?php _e( 'Time Intervals (in minutes)', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Choose the minutes interval between each time in the time picker.', 'ultimate-member' ) ); ?></label>
|
1764 |
-
<input type="text" name="_intervals" id="_intervals" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 60; ?>" placeholder="<?php esc_attr_e( 'e.g. 30, 60, 120', 'ultimate-member' ) ?>" />
|
1765 |
-
</p>
|
1766 |
-
|
1767 |
-
<?php
|
1768 |
-
break;
|
1769 |
-
|
1770 |
-
|
1771 |
-
case '_format':
|
1772 |
-
|
1773 |
-
if ( $this->set_field_type == 'date' ) {
|
1774 |
-
?>
|
1775 |
-
|
1776 |
-
<p><label for="_format"><?php _e( 'Date User-Friendly Format', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'The display format of the date which is visible to user.', 'ultimate-member' ) ); ?></label>
|
1777 |
-
<select name="_format" id="_format" style="width: 100%">
|
1778 |
-
<option value="j M Y" <?php selected( 'j M Y', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('j M Y'); ?></option>
|
1779 |
-
<option value="M j Y" <?php selected( 'M j Y', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('M j Y'); ?></option>
|
1780 |
-
<option value="j F Y" <?php selected( 'j F Y', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('j F Y'); ?></option>
|
1781 |
-
<option value="F j Y" <?php selected( 'F j Y', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('F j Y'); ?></option>
|
1782 |
-
</select>
|
1783 |
-
</p>
|
1784 |
-
|
1785 |
-
<?php } else { ?>
|
1786 |
-
|
1787 |
-
<p><label for="_format"><?php _e( 'Time Format', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Choose the displayed time-format for this field', 'ultimate-member' ) ); ?></label>
|
1788 |
-
<select name="_format" id="_format" style="width: 100%">
|
1789 |
-
<option value="g:i a" <?php selected( 'g:i a', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('g:i a'); ?><?php _e( '( 12-hr format )', 'ultimate-member' ) ?></option>
|
1790 |
-
<option value="g:i A" <?php selected( 'g:i A', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('g:i A'); ?><?php _e( '( 12-hr format )', 'ultimate-member' ) ?></option>
|
1791 |
-
<option value="H:i" <?php selected( 'H:i', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('H:i'); ?><?php _e( '( 24-hr format )', 'ultimate-member' ) ?></option>
|
1792 |
-
</select>
|
1793 |
-
</p>
|
1794 |
-
|
1795 |
-
<?php
|
1796 |
-
}
|
1797 |
-
break;
|
1798 |
-
|
1799 |
-
case '_format_custom':
|
1800 |
-
?>
|
1801 |
-
|
1802 |
-
<p><label for="_format_custom"><?php _e( 'Use custom Date format', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'This option overrides "Date User-Friendly Format" option. See https://www.php.net/manual/en/function.date.php', 'ultimate-member' ) ); ?></label>
|
1803 |
-
<input type="text" name="_format_custom" id="_format_custom" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" placeholder="j M Y" />
|
1804 |
-
</p>
|
1805 |
-
|
1806 |
-
<?php
|
1807 |
-
break;
|
1808 |
-
|
1809 |
-
case '_pretty_format':
|
1810 |
-
?>
|
1811 |
-
|
1812 |
-
<p><label for="_pretty_format"><?php _e( 'Displayed Date Format', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Whether you wish to show the date in full or only show the years e.g. 25 Years', 'ultimate-member' ) ); ?></label>
|
1813 |
-
<select name="_pretty_format" id="_pretty_format" style="width: 100%">
|
1814 |
-
<option value="0" <?php selected( 0, $this->edit_mode_value ); ?>><?php _e( 'Show full date', 'ultimate-member' ) ?></option>
|
1815 |
-
<option value="1" <?php selected( 1, $this->edit_mode_value ); ?>><?php _e( 'Show years only', 'ultimate-member' ) ?></option>
|
1816 |
-
</select>
|
1817 |
-
</p>
|
1818 |
-
|
1819 |
-
<?php
|
1820 |
-
break;
|
1821 |
-
|
1822 |
-
case '_disabled_weekdays':
|
1823 |
-
|
1824 |
-
if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) {
|
1825 |
-
$values = $this->edit_mode_value;
|
1826 |
-
} else {
|
1827 |
-
$values = array('');
|
1828 |
-
}
|
1829 |
-
?>
|
1830 |
-
|
1831 |
-
<p><label for="_disabled_weekdays"><?php _e( 'Disable specific weekdays', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Disable specific week days from being available for selection in this date picker', 'ultimate-member' ) ); ?></label>
|
1832 |
-
<select name="_disabled_weekdays[]" id="_disabled_weekdays" multiple="multiple" style="width: 100%">
|
1833 |
-
<option value="1" <?php if ( in_array( 1, $values ) ) { echo 'selected'; } ?>><?php _e( 'Sunday', 'ultimate-member' ) ?></option>
|
1834 |
-
<option value="2" <?php if ( in_array( 2, $values ) ) { echo 'selected'; } ?>><?php _e( 'Monday', 'ultimate-member' ) ?></option>
|
1835 |
-
<option value="3" <?php if ( in_array( 3, $values ) ) { echo 'selected'; } ?>><?php _e( 'Tuesday', 'ultimate-member' ) ?></option>
|
1836 |
-
<option value="4" <?php if ( in_array( 4, $values ) ) { echo 'selected'; } ?>><?php _e( 'Wednesday', 'ultimate-member' ) ?></option>
|
1837 |
-
<option value="5" <?php if ( in_array( 5, $values ) ) { echo 'selected'; } ?>><?php _e( 'Thursday', 'ultimate-member' ) ?></option>
|
1838 |
-
<option value="6" <?php if ( in_array( 6, $values ) ) { echo 'selected'; } ?>><?php _e( 'Friday', 'ulti |