Version Description
Download this release
Release Info
Developer | nsinelnikov |
Plugin | Ultimate Member – User Profile & Membership Plugin |
Version | 2.0.17 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.17
- assets/css/um-profile.css +25 -13
- assets/css/um-responsive.css +8 -0
- assets/js/um-functions.js +1 -1
- assets/js/um-functions.min.js +1 -1
- assets/js/um-gdpr.js +22 -0
- assets/js/um-gdpr.min.js +1 -0
- assets/js/um-members.js +1 -1
- assets/js/um-members.min.js +1 -1
- assets/js/um-scripts.js +4 -0
- includes/admin/class-admin.php +24 -0
- includes/admin/core/class-admin-gdpr.php +316 -0
- includes/admin/core/class-admin-menu.php +15 -0
- includes/admin/core/class-admin-notices.php +34 -3
- includes/admin/core/class-admin-settings.php +21 -3
- includes/admin/core/class-admin-upgrade.php +72 -6
- includes/admin/core/class-admin-users.php +48 -55
- includes/admin/core/packages/2.0-beta1/email_templates.php +2 -2
- includes/admin/core/packages/2.0-beta1/menus.php +7 -1
- includes/admin/core/packages/2.0.10/functions.php +18 -0
- includes/admin/core/packages/2.0.10/hooks.php +6 -0
- includes/admin/core/packages/2.0.10/init.php +54 -0
- includes/admin/core/packages/2.0.10/styles.php +89 -0
- includes/admin/templates/dashboard/cache.php +6 -7
- includes/admin/templates/dashboard/upgrade-request.php +6 -0
- includes/admin/templates/form/login_customize.php +1 -1
- includes/admin/templates/form/profile_customize.php +1 -1
- includes/admin/templates/form/register_customize.php +1 -1
- includes/admin/templates/form/register_gdpr.php +71 -0
- includes/admin/templates/gdpr.php +40 -0
- includes/class-dependencies.php +1 -0
- includes/class-init.php +133 -32
- includes/core/class-access.php +106 -12
- includes/core/class-account.php +2 -3
- includes/core/class-builtin.php +1 -1
- includes/core/class-enqueue.php +3 -1
- includes/core/class-fields.php +91 -36
- includes/core/class-form.php +2 -14
- includes/core/class-gdpr.php +86 -0
- includes/core/class-mail.php +6 -18
- includes/core/class-permalinks.php +4 -18
- includes/core/class-profile.php +7 -0
- includes/core/class-rest-api.php +9 -9
- includes/core/class-rewrite.php +76 -54
- includes/core/class-roles-capabilities.php +11 -4
- includes/core/class-shortcodes.php +12 -6
- includes/core/class-user.php +104 -63
- includes/core/um-actions-account.php +1 -1
- includes/core/um-actions-core.php +3 -1
- includes/core/um-actions-form.php +6 -5
- includes/core/um-actions-password.php +0 -19
- includes/core/um-actions-profile.php +35 -24
- includes/core/um-actions-register.php +47 -8
- includes/core/um-filters-avatars.php +0 -59
- includes/core/um-filters-fields.php +63 -11
- includes/core/um-filters-login.php +17 -1
- includes/core/um-filters-navmenu.php +41 -14
- includes/core/um-navmenu.php +4 -3
- includes/um-short-functions.php +175 -146
- readme.txt +154 -2
- templates/gdpr-register.php +44 -0
- templates/members-grid.php +2 -2
- templates/restricted-taxonomy.php +53 -0
- ultimate-member.php +1 -1
assets/css/um-profile.css
CHANGED
@@ -53,7 +53,6 @@
|
|
53 |
background-color: #eee;
|
54 |
box-sizing: border-box;
|
55 |
position: relative;
|
56 |
-
overflow: hidden;
|
57 |
}
|
58 |
|
59 |
.um-cover-add {
|
@@ -75,6 +74,7 @@
|
|
75 |
.um-cover-e {
|
76 |
text-align: center;
|
77 |
box-sizing: border-box;
|
|
|
78 |
}
|
79 |
|
80 |
.um-cover-e img {width: 100% !important}
|
@@ -393,13 +393,31 @@ font-weight: normal;
|
|
393 |
border-bottom: 0 !important;
|
394 |
}
|
395 |
|
396 |
-
.um-profile-nav-item.without-icon a {
|
397 |
-
|
398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
|
400 |
-
.um-profile-nav-item a:hover {
|
401 |
-
|
402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
.um-profile-nav-item span.count {
|
404 |
font-size: 12px;
|
405 |
font-weight: 300;
|
@@ -545,10 +563,4 @@ font-weight: normal;
|
|
545 |
|
546 |
.um-profile.um-viewing .um-field-checkbox, .um-profile.um-viewing .um-field-radio{
|
547 |
cursor: default !important;
|
548 |
-
}
|
549 |
-
|
550 |
-
@media (min-width: 880px) {
|
551 |
-
.um-profile-nav-item .um-tip-n {
|
552 |
-
display: none;
|
553 |
-
}
|
554 |
}
|
53 |
background-color: #eee;
|
54 |
box-sizing: border-box;
|
55 |
position: relative;
|
|
|
56 |
}
|
57 |
|
58 |
.um-cover-add {
|
74 |
.um-cover-e {
|
75 |
text-align: center;
|
76 |
box-sizing: border-box;
|
77 |
+
overflow: hidden;
|
78 |
}
|
79 |
|
80 |
.um-cover-e img {width: 100% !important}
|
393 |
border-bottom: 0 !important;
|
394 |
}
|
395 |
|
396 |
+
.um-profile-nav-item.without-icon a {
|
397 |
+
padding-left: 10px;
|
398 |
+
}
|
399 |
+
.um-profile-nav-item.without-icon span.title {
|
400 |
+
padding-left: 0;
|
401 |
+
}
|
402 |
+
.um-profile-nav-item.without-icon i {
|
403 |
+
display: none;
|
404 |
+
}
|
405 |
|
406 |
+
.um-profile-nav-item a:hover {
|
407 |
+
background: #555;
|
408 |
+
}
|
409 |
+
.um-profile-nav-item i {
|
410 |
+
font-size: 18px;
|
411 |
+
height: 18px;
|
412 |
+
line-height: 18px;
|
413 |
+
position: absolute;
|
414 |
+
display: block;
|
415 |
+
top: 8px;
|
416 |
+
left: 10px;
|
417 |
+
}
|
418 |
+
.um-profile-nav-item span.title {
|
419 |
+
padding-left: 5px;
|
420 |
+
}
|
421 |
.um-profile-nav-item span.count {
|
422 |
font-size: 12px;
|
423 |
font-weight: 300;
|
563 |
|
564 |
.um-profile.um-viewing .um-field-checkbox, .um-profile.um-viewing .um-field-radio{
|
565 |
cursor: default !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
}
|
assets/css/um-responsive.css
CHANGED
@@ -6,6 +6,14 @@
|
|
6 |
display: none;
|
7 |
}
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
div.uimob340 .uimob340-show,
|
10 |
div.uimob500 .uimob500-show,
|
11 |
div.uimob800 .uimob800-show,
|
6 |
display: none;
|
7 |
}
|
8 |
|
9 |
+
.um-profile-nav-item a.uimob340-show,
|
10 |
+
.um-profile-nav-item a.uimob500-show,
|
11 |
+
.um-profile-nav-item a.uimob800-show,
|
12 |
+
.um-profile-nav-item a.uimob960-show
|
13 |
+
{
|
14 |
+
display: none;
|
15 |
+
}
|
16 |
+
|
17 |
div.uimob340 .uimob340-show,
|
18 |
div.uimob500 .uimob500-show,
|
19 |
div.uimob800 .uimob800-show,
|
assets/js/um-functions.js
CHANGED
@@ -184,7 +184,7 @@ function um_responsive(){
|
|
184 |
|
185 |
});
|
186 |
|
187 |
-
jQuery('.um-cover, .um-member-cover').each(function(){
|
188 |
|
189 |
var elem = jQuery(this);
|
190 |
var ratio = elem.data('ratio');
|
184 |
|
185 |
});
|
186 |
|
187 |
+
jQuery('.um-cover, .um-member-cover, .um-cover-e').each(function(){
|
188 |
|
189 |
var elem = jQuery(this);
|
190 |
var ratio = elem.data('ratio');
|
assets/js/um-functions.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function UM_check_password_matched(){jQuery(document).on("keyup","input[data-key=user_password],input[data-key=confirm_user_password]",function(e){var t=jQuery("input[data-key=user_password]").val(),a=jQuery("input[data-key=confirm_user_password]").val(),o=jQuery("input[data-key=user_password],input[data-key=confirm_user_password]");t||a?t!==a?o.removeClass("um-validate-matched").addClass("um-validate-not-matched"):o.removeClass("um-validate-not-matched").addClass("um-validate-matched"):o.removeClass("um-validate-matched").removeClass("um-validate-not-matched")})}function UM_hide_menus(){menu=jQuery(".um-dropdown"),menu.parents("div").find("a").removeClass("active"),menu.hide()}function UM_domenus(){jQuery(".um-dropdown").each(function(){var e=jQuery(this),t=jQuery(this).attr("data-element"),a=jQuery(this).attr("data-position");jQuery(t).addClass("um-trigger-menu-on-"+e.attr("data-trigger")),jQuery(window).width()<=1200&&"div.um-profile-edit"==t&&(a="lc"),"lc"==a&&(200>jQuery(t).find("img").width()?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),gap_right=jQuery(t).width()+17,e.css({top:0,width:200,left:"auto",right:gap_right+"px","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-right-b"),e.find(".um-dropdown-arr").css({top:"4px",left:"auto",right:"-17px"})),"bc"==a&&(200>jQuery(t).find("img").width()?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),e.css({top:top_p,width:200,left:left_p+left_gap,right:"auto","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-up-b"),e.find(".um-dropdown-arr").css({top:"-17px",left:e.width()/2-12,right:"auto"}))})}function um_responsive(){jQuery(".um").each(function(){element_width=jQuery(this).width(),element_width<=340?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob340")):element_width<=500?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob500")):element_width<=800?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob800")):element_width<=960?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob960")):element_width>960&&(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960")),jQuery(".um-account-nav").length>0&&jQuery(".um-account-side").is(":visible")&&0==jQuery(".um-account-tab:visible").length&&jQuery(".um-account-side li a.current").trigger("click"),jQuery(this).css("opacity",1)}),jQuery(".um-cover, .um-member-cover").each(function(){var e=jQuery(this),t=e.data("ratio"),a=e.width(),o=t.split(":");calcHeight=Math.round(a/o[0])+"px",e.height(calcHeight),e.find(".um-cover-add").height(calcHeight)}),jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),UM_domenus()}function UM_Member_Grid(e){e.masonry({itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"})}function initImageUpload_UM(e){e.data("upload_help_text")?upload_help_text='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":upload_text="",e.uploadFile({url:um_scripts.imageupload,method:"POST",multiple:!1,formData:{key:e.data("key"),set_id:e.data("set_id"),set_mode:e.data("set_mode"),_wpnonce:e.data("nonce"),timestamp:e.data("timestamp")},fileName:e.data("key"),allowedTypes:e.data("allowed_types"),maxFileSize:e.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:e.data("max_size_error"),extErrorStr:e.data("extension_error"),maxFileCountErrorStr:e.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(t){e.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(t,a,o){e.selectedFiles=0;try{a=jQuery.parseJSON(a)}catch(e){return void console.log(e,a)}a.error&&""!=a.error?(e.parents(".um-modal-body").append('<div class="um-error-block">'+a.error+"</div>"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(a,function(t,a){var o=e.parents(".um-modal-body").find(".um-single-image-preview img"),i=e.parents(".um-modal-body").find(".um-single-image-preview");o.attr("src",a),o.load(function(){e.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),e.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),i.show(0),um_modal_responsive()})})}})}function initFileUpload_UM(e){e.data("upload_help_text")?upload_help_text='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":upload_text="",e.uploadFile({url:um_scripts.fileupload,method:"POST",multiple:!1,formData:{key:e.data("key"),set_id:e.data("set_id"),set_mode:e.data("set_mode"),_wpnonce:e.data("nonce"),timestamp:e.data("timestamp")},fileName:e.data("key"),allowedTypes:e.data("allowed_types"),maxFileSize:e.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:e.data("max_size_error"),extErrorStr:e.data("extension_error"),maxFileCountErrorStr:e.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(t){e.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(t,a,o){e.selectedFiles=0,a=jQuery.parseJSON(a),a.error&&""!=a.error?(e.parents(".um-modal-body").append('<div class="um-error-block">'+a.error+"</div>"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),setTimeout(function(){um_modal_responsive()},1e3)):(jQuery.each(a,function(t,a){e.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),e.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),e.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==t?e.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(a):"icon_bg"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":a}):"filename"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(a):e.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",a)}),setTimeout(function(){um_modal_responsive()},1e3))}})}function initCrop_UM(){var e=jQuery(".um-modal .um-single-image-preview img").first(),t=jQuery(".um-modal .um-single-image-preview"),a=e.parent().attr("data-crop"),o=e.parent().attr("data-min_width"),i=e.parent().attr("data-min_height"),r=e.parent().attr("data-ratio");if(jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"))var r=jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"),u=r.split(":"),r=u[0];if(e.length&&""!=e.attr("src")){var d=jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height();if(e.css({height:"auto"}),t.css({height:"auto"}),jQuery(window).height()<=400?(t.css({height:d+"px","max-height":d+"px"}),e.css({height:"auto"})):(e.css({height:"auto","max-height":d+"px"}),t.css({height:e.height(),"max-height":d+"px"})),"square"==a)var s={minWidth:o,minHeight:i,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}};else if("cover"==a){Math.round(o/r)>0&&(i=Math.round(o/r));var s={minWidth:o,minHeight:i,dragCrop:!1,aspectRatio:r,zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}}}else if("user"==a)var s={minWidth:o,minHeight:i,dragCrop:!0,aspectRatio:"auto",zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}};0!=a&&(e.cropper(s),jQuery(".um-single-image-preview img.cropper-hidden").cropper("destroy"),jQuery(".um-single-image-preview img.lazyloaded").addClass("cropper-hidden"),jQuery(".um-single-image-preview img.lazyloaded").removeClass("lazyloaded"),jQuery(".um-single-image-preview .cropper-container").append('<div class="um-clear"></div>'))}}function um_new_modal(e,t,a,o){var i=jQuery("body").find(".um-modal-overlay");if(0==i.length)if(jQuery(".tipsy").hide(),UM_hide_menus(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),a?jQuery("body").append('<div class="um-modal-overlay"></div><div class="um-modal is-photo"></div>'):jQuery("body").append('<div class="um-modal-overlay"></div><div class="um-modal no-photo"></div>'),jQuery("#"+e).prependTo(".um-modal"),a){jQuery(".um-modal").find(".um-modal-photo").html("<img />");var r=jQuery(".um-modal-photo img"),u=jQuery(window).width()-60,d=jQuery(window).height()-.25*jQuery(window).height();r.attr("src",o),r.load(function(){jQuery("#"+e).show(),jQuery(".um-modal").show(),r.css({opacity:0}),r.css({"max-width":u}),r.css({"max-height":d}),jQuery(".um-modal").css({width:r.width(),"margin-left":"-"+r.width()/2+"px"}),r.animate({opacity:1},1e3),um_modal_responsive()})}else jQuery("#"+e).show(),jQuery(".um-modal").show(),um_modal_size(t),initImageUpload_UM(jQuery(".um-modal:visible").find(".um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible").find(".um-single-file-upload")),um_modal_responsive()}function um_modal_responsive(){var e=jQuery(".um-modal:visible"),t=jQuery(".um-modal-body.photo:visible");if(t.length){e.removeClass("uimob340"),e.removeClass("uimob500");var a=jQuery(".um-modal-photo img"),o=jQuery(window).width()-60,i=jQuery(window).height()-.25*jQuery(window).height();a.css({opacity:0}),a.css({"max-width":o}),a.css({"max-height":i}),jQuery(".um-modal").css({width:a.width(),"margin-left":"-"+a.width()/2+"px"}),a.animate({opacity:1},1e3);var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(e.length){var u=jQuery(window).width();if(e.removeClass("uimob340"),e.removeClass("uimob500"),u<=340)e.addClass("uimob340"),initCrop_UM(),e.animate({bottom:0},300);else if(u<=500)e.addClass("uimob500"),initCrop_UM(),e.animate({bottom:0},300);else if(u<=800){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(u<=960){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(u>960){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}}}function um_remove_modal(){jQuery("img.cropper-hidden").cropper("destroy"),jQuery("body,html,textarea").css("overflow","auto"),jQuery(document).unbind("touchmove"),jQuery('.um-modal div[id^="um_"]').hide().appendTo("body"),jQuery(".um-modal,.um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").addClass(e)}function um_modal_add_attr(e,t){jQuery(".um-modal:visible").data(e,t)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append('<div class="um-popup-overlay"></div>'),jQuery("body").append('<div class="um-popup"></div>'),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(jQuery(".tipsy").remove(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,offset:3}))}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(ag_height=jQuery(window).height()-jQuery(".um-popup um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80,ag_height>350&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?(jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}),jQuery(".um-popup-autogrow:visible").mCustomScrollbar({theme:"dark-3",mouseWheelPixels:500}).mCustomScrollbar("scrollTo","bottom",{scrollInertia:0})):jQuery(".um-popup-autogrow2:visible").length&&(jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}),jQuery(".um-popup-autogrow2:visible").mCustomScrollbar({theme:"dark-3",mouseWheelPixels:500})))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").removeAttr("checked").removeAttr("selected")}function um_selected(e,t){if(e==t)return"selected='selected'"}jQuery(function(){jQuery(".um-search form *").keypress(function(e){if(13==e.which)return jQuery(".um-search form").submit(),!1}),2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()});
|
1 |
+
function UM_check_password_matched(){jQuery(document).on("keyup","input[data-key=user_password],input[data-key=confirm_user_password]",function(e){var t=jQuery("input[data-key=user_password]").val(),a=jQuery("input[data-key=confirm_user_password]").val(),o=jQuery("input[data-key=user_password],input[data-key=confirm_user_password]");t||a?t!==a?o.removeClass("um-validate-matched").addClass("um-validate-not-matched"):o.removeClass("um-validate-not-matched").addClass("um-validate-matched"):o.removeClass("um-validate-matched").removeClass("um-validate-not-matched")})}function UM_hide_menus(){menu=jQuery(".um-dropdown"),menu.parents("div").find("a").removeClass("active"),menu.hide()}function UM_domenus(){jQuery(".um-dropdown").each(function(){var e=jQuery(this),t=jQuery(this).attr("data-element"),a=jQuery(this).attr("data-position");jQuery(t).addClass("um-trigger-menu-on-"+e.attr("data-trigger")),jQuery(window).width()<=1200&&"div.um-profile-edit"==t&&(a="lc"),"lc"==a&&(200>jQuery(t).find("img").width()?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),gap_right=jQuery(t).width()+17,e.css({top:0,width:200,left:"auto",right:gap_right+"px","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-right-b"),e.find(".um-dropdown-arr").css({top:"4px",left:"auto",right:"-17px"})),"bc"==a&&(200>jQuery(t).find("img").width()?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),e.css({top:top_p,width:200,left:left_p+left_gap,right:"auto","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-up-b"),e.find(".um-dropdown-arr").css({top:"-17px",left:e.width()/2-12,right:"auto"}))})}function um_responsive(){jQuery(".um").each(function(){element_width=jQuery(this).width(),element_width<=340?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob340")):element_width<=500?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob500")):element_width<=800?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob800")):element_width<=960?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob960")):element_width>960&&(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960")),jQuery(".um-account-nav").length>0&&jQuery(".um-account-side").is(":visible")&&0==jQuery(".um-account-tab:visible").length&&jQuery(".um-account-side li a.current").trigger("click"),jQuery(this).css("opacity",1)}),jQuery(".um-cover, .um-member-cover, .um-cover-e").each(function(){var e=jQuery(this),t=e.data("ratio"),a=e.width(),o=t.split(":");calcHeight=Math.round(a/o[0])+"px",e.height(calcHeight),e.find(".um-cover-add").height(calcHeight)}),jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),UM_domenus()}function UM_Member_Grid(e){e.masonry({itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"})}function initImageUpload_UM(e){e.data("upload_help_text")?upload_help_text='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":upload_text="",e.uploadFile({url:um_scripts.imageupload,method:"POST",multiple:!1,formData:{key:e.data("key"),set_id:e.data("set_id"),set_mode:e.data("set_mode"),_wpnonce:e.data("nonce"),timestamp:e.data("timestamp")},fileName:e.data("key"),allowedTypes:e.data("allowed_types"),maxFileSize:e.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:e.data("max_size_error"),extErrorStr:e.data("extension_error"),maxFileCountErrorStr:e.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(t){e.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(t,a,o){e.selectedFiles=0;try{a=jQuery.parseJSON(a)}catch(e){return void console.log(e,a)}a.error&&""!=a.error?(e.parents(".um-modal-body").append('<div class="um-error-block">'+a.error+"</div>"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(a,function(t,a){var o=e.parents(".um-modal-body").find(".um-single-image-preview img"),i=e.parents(".um-modal-body").find(".um-single-image-preview");o.attr("src",a),o.load(function(){e.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),e.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),i.show(0),um_modal_responsive()})})}})}function initFileUpload_UM(e){e.data("upload_help_text")?upload_help_text='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":upload_text="",e.uploadFile({url:um_scripts.fileupload,method:"POST",multiple:!1,formData:{key:e.data("key"),set_id:e.data("set_id"),set_mode:e.data("set_mode"),_wpnonce:e.data("nonce"),timestamp:e.data("timestamp")},fileName:e.data("key"),allowedTypes:e.data("allowed_types"),maxFileSize:e.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:e.data("max_size_error"),extErrorStr:e.data("extension_error"),maxFileCountErrorStr:e.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(t){e.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(t,a,o){e.selectedFiles=0,a=jQuery.parseJSON(a),a.error&&""!=a.error?(e.parents(".um-modal-body").append('<div class="um-error-block">'+a.error+"</div>"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),setTimeout(function(){um_modal_responsive()},1e3)):(jQuery.each(a,function(t,a){e.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),e.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),e.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==t?e.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(a):"icon_bg"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":a}):"filename"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(a):e.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",a)}),setTimeout(function(){um_modal_responsive()},1e3))}})}function initCrop_UM(){var e=jQuery(".um-modal .um-single-image-preview img").first(),t=jQuery(".um-modal .um-single-image-preview"),a=e.parent().attr("data-crop"),o=e.parent().attr("data-min_width"),i=e.parent().attr("data-min_height"),r=e.parent().attr("data-ratio");if(jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"))var r=jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"),u=r.split(":"),r=u[0];if(e.length&&""!=e.attr("src")){var d=jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height();if(e.css({height:"auto"}),t.css({height:"auto"}),jQuery(window).height()<=400?(t.css({height:d+"px","max-height":d+"px"}),e.css({height:"auto"})):(e.css({height:"auto","max-height":d+"px"}),t.css({height:e.height(),"max-height":d+"px"})),"square"==a)var s={minWidth:o,minHeight:i,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}};else if("cover"==a){Math.round(o/r)>0&&(i=Math.round(o/r));var s={minWidth:o,minHeight:i,dragCrop:!1,aspectRatio:r,zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}}}else if("user"==a)var s={minWidth:o,minHeight:i,dragCrop:!0,aspectRatio:"auto",zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}};0!=a&&(e.cropper(s),jQuery(".um-single-image-preview img.cropper-hidden").cropper("destroy"),jQuery(".um-single-image-preview img.lazyloaded").addClass("cropper-hidden"),jQuery(".um-single-image-preview img.lazyloaded").removeClass("lazyloaded"),jQuery(".um-single-image-preview .cropper-container").append('<div class="um-clear"></div>'))}}function um_new_modal(e,t,a,o){var i=jQuery("body").find(".um-modal-overlay");if(0==i.length)if(jQuery(".tipsy").hide(),UM_hide_menus(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),a?jQuery("body").append('<div class="um-modal-overlay"></div><div class="um-modal is-photo"></div>'):jQuery("body").append('<div class="um-modal-overlay"></div><div class="um-modal no-photo"></div>'),jQuery("#"+e).prependTo(".um-modal"),a){jQuery(".um-modal").find(".um-modal-photo").html("<img />");var r=jQuery(".um-modal-photo img"),u=jQuery(window).width()-60,d=jQuery(window).height()-.25*jQuery(window).height();r.attr("src",o),r.load(function(){jQuery("#"+e).show(),jQuery(".um-modal").show(),r.css({opacity:0}),r.css({"max-width":u}),r.css({"max-height":d}),jQuery(".um-modal").css({width:r.width(),"margin-left":"-"+r.width()/2+"px"}),r.animate({opacity:1},1e3),um_modal_responsive()})}else jQuery("#"+e).show(),jQuery(".um-modal").show(),um_modal_size(t),initImageUpload_UM(jQuery(".um-modal:visible").find(".um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible").find(".um-single-file-upload")),um_modal_responsive()}function um_modal_responsive(){var e=jQuery(".um-modal:visible"),t=jQuery(".um-modal-body.photo:visible");if(t.length){e.removeClass("uimob340"),e.removeClass("uimob500");var a=jQuery(".um-modal-photo img"),o=jQuery(window).width()-60,i=jQuery(window).height()-.25*jQuery(window).height();a.css({opacity:0}),a.css({"max-width":o}),a.css({"max-height":i}),jQuery(".um-modal").css({width:a.width(),"margin-left":"-"+a.width()/2+"px"}),a.animate({opacity:1},1e3);var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(e.length){var u=jQuery(window).width();if(e.removeClass("uimob340"),e.removeClass("uimob500"),u<=340)e.addClass("uimob340"),initCrop_UM(),e.animate({bottom:0},300);else if(u<=500)e.addClass("uimob500"),initCrop_UM(),e.animate({bottom:0},300);else if(u<=800){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(u<=960){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(u>960){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}}}function um_remove_modal(){jQuery("img.cropper-hidden").cropper("destroy"),jQuery("body,html,textarea").css("overflow","auto"),jQuery(document).unbind("touchmove"),jQuery('.um-modal div[id^="um_"]').hide().appendTo("body"),jQuery(".um-modal,.um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").addClass(e)}function um_modal_add_attr(e,t){jQuery(".um-modal:visible").data(e,t)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append('<div class="um-popup-overlay"></div>'),jQuery("body").append('<div class="um-popup"></div>'),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(jQuery(".tipsy").remove(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,offset:3}))}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(ag_height=jQuery(window).height()-jQuery(".um-popup um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80,ag_height>350&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?(jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}),jQuery(".um-popup-autogrow:visible").mCustomScrollbar({theme:"dark-3",mouseWheelPixels:500}).mCustomScrollbar("scrollTo","bottom",{scrollInertia:0})):jQuery(".um-popup-autogrow2:visible").length&&(jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}),jQuery(".um-popup-autogrow2:visible").mCustomScrollbar({theme:"dark-3",mouseWheelPixels:500})))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").removeAttr("checked").removeAttr("selected")}function um_selected(e,t){if(e==t)return"selected='selected'"}jQuery(function(){jQuery(".um-search form *").keypress(function(e){if(13==e.which)return jQuery(".um-search form").submit(),!1}),2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()});
|
assets/js/um-gdpr.js
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
$(document).on('click', "a.um-toggle-gdpr" ,function() {
|
5 |
+
|
6 |
+
var me = jQuery(this);
|
7 |
+
|
8 |
+
$( ".um-gdpr-content" ).toggle( "fast", function() {
|
9 |
+
if( $( ".um-gdpr-content" ).is(':visible') ){
|
10 |
+
me.text( me.data('toggle-hide') );
|
11 |
+
}
|
12 |
+
|
13 |
+
if( $( ".um-gdpr-content" ).is(':hidden') ){
|
14 |
+
me.text( me.data('toggle-show') );
|
15 |
+
}
|
16 |
+
|
17 |
+
});
|
18 |
+
|
19 |
+
});
|
20 |
+
|
21 |
+
|
22 |
+
})( jQuery );
|
assets/js/um-gdpr.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t){"use strict";t(document).on("click","a.um-toggle-gdpr",function(){var e=jQuery(this);t(".um-gdpr-content").toggle("fast",function(){t(".um-gdpr-content").is(":visible")&&e.text(e.data("toggle-hide")),t(".um-gdpr-content").is(":hidden")&&e.text(e.data("toggle-show"))})})}(jQuery);
|
assets/js/um-members.js
CHANGED
@@ -4,7 +4,7 @@ jQuery(document).ready(function() {
|
|
4 |
UM_Member_Grid( jQuery(this) );
|
5 |
});
|
6 |
|
7 |
-
jQuery('.um-member-connect').each(function(){
|
8 |
if ( jQuery(this).find('a').length == 0 ) {
|
9 |
jQuery(this).remove();
|
10 |
}
|
4 |
UM_Member_Grid( jQuery(this) );
|
5 |
});
|
6 |
|
7 |
+
jQuery('.um-directory .um-member-connect').each(function(){
|
8 |
if ( jQuery(this).find('a').length == 0 ) {
|
9 |
jQuery(this).remove();
|
10 |
}
|
assets/js/um-members.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document).on("click",".um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),m=jQuery(this).parents(".um-members");return r.find(".um-member-more").hide(),r.find(".um-member-meta").slideDown(function(){UM_Member_Grid(m)}),r.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(m)},100),!1}),jQuery(document).on("click",".um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),m=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(m)}),!1}),jQuery(document).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").find("input").filter(function(e){if(0===this.value.length)return!0}).prop("disabled",!0),jQuery(this).parents("form").find("select").filter(function(e){if(0===this.value.length)return!0}).prop("disabled",!0),jQuery(this).parents("form").submit(),!1})});
|
1 |
+
jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-directory .um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document).on("click",".um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),m=jQuery(this).parents(".um-members");return r.find(".um-member-more").hide(),r.find(".um-member-meta").slideDown(function(){UM_Member_Grid(m)}),r.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(m)},100),!1}),jQuery(document).on("click",".um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),m=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(m)}),!1}),jQuery(document).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").find("input").filter(function(e){if(0===this.value.length)return!0}).prop("disabled",!0),jQuery(this).parents("form").find("select").filter(function(e){if(0===this.value.length)return!0}).prop("disabled",!0),jQuery(this).parents("form").submit(),!1})});
|
assets/js/um-scripts.js
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(document).ready(function() {
|
2 |
|
3 |
jQuery(document).on('click', '.um-dropdown a', function(e){
|
1 |
+
/*jQuery('body').on('error', '.um-avatar', function() {
|
2 |
+
if( jQuery(this).data('load-error') != undefined ) return;
|
3 |
+
jQuery(this).data('load-error', '1').attr('src', jQuery(this).data('default'));
|
4 |
+
});*/
|
5 |
jQuery(document).ready(function() {
|
6 |
|
7 |
jQuery(document).on('click', '.um-dropdown a', function(e){
|
includes/admin/class-admin.php
CHANGED
@@ -35,6 +35,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
|
35 |
|
36 |
add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) );
|
37 |
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
|
|
|
38 |
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
|
39 |
add_action( 'um_admin_do_action__um_language_downloader', array( &$this, 'um_language_downloader' ) );
|
40 |
add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) );
|
@@ -48,6 +49,29 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
|
48 |
}
|
49 |
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
/**
|
53 |
* Clear all users cache
|
35 |
|
36 |
add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) );
|
37 |
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
|
38 |
+
add_action( 'um_admin_do_action__manual_upgrades_request', array( &$this, 'manual_upgrades_request' ) );
|
39 |
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
|
40 |
add_action( 'um_admin_do_action__um_language_downloader', array( &$this, 'um_language_downloader' ) );
|
41 |
add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) );
|
49 |
}
|
50 |
|
51 |
|
52 |
+
function manual_upgrades_request() {
|
53 |
+
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
54 |
+
die();
|
55 |
+
}
|
56 |
+
|
57 |
+
$last_request = get_option( 'um_last_manual_upgrades_request', false );
|
58 |
+
|
59 |
+
if ( empty( $last_request ) || time() > $last_request + DAY_IN_SECONDS ) {
|
60 |
+
|
61 |
+
delete_transient( 'update_plugins' );
|
62 |
+
delete_site_transient( 'update_plugins' );
|
63 |
+
|
64 |
+
UM()->plugin_updater()->um_checklicenses();
|
65 |
+
|
66 |
+
update_option( 'um_last_manual_upgrades_request', time() );
|
67 |
+
|
68 |
+
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'got_updates' ), admin_url( 'admin.php' ) );
|
69 |
+
} else {
|
70 |
+
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'often_updates' ), admin_url( 'admin.php' ) );
|
71 |
+
}
|
72 |
+
exit( wp_redirect( $url ) );
|
73 |
+
}
|
74 |
+
|
75 |
|
76 |
/**
|
77 |
* Clear all users cache
|
includes/admin/core/class-admin-gdpr.php
ADDED
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace um\admin\core;
|
3 |
+
|
4 |
+
// Exit if accessed directly.
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
+
|
7 |
+
|
8 |
+
if ( ! class_exists( 'um\admin\core\Admin_GDPR' ) ) {
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Admin_GDPR
|
13 |
+
* @package um\admin\core
|
14 |
+
*/
|
15 |
+
class Admin_GDPR {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var array
|
19 |
+
*/
|
20 |
+
var $meta_associations = array();
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Admin_GDPR constructor.
|
25 |
+
*/
|
26 |
+
function __construct() {
|
27 |
+
add_action( 'init', array( &$this, 'init_fields' ), 10 );
|
28 |
+
add_action( 'admin_init', array( &$this, 'plugin_add_suggested_privacy_content' ), 20 );
|
29 |
+
add_filter( 'wp_privacy_personal_data_exporters', array( &$this, 'plugin_register_exporters' ) );
|
30 |
+
add_filter( 'wp_privacy_personal_data_erasers', array( &$this, 'plugin_register_erasers' ) );
|
31 |
+
|
32 |
+
add_action( 'um_admin_custom_register_metaboxes', array( &$this, 'add_metabox_register' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
/**
|
37 |
+
*
|
38 |
+
*/
|
39 |
+
function add_metabox_register() {
|
40 |
+
add_meta_box(
|
41 |
+
"um-admin-form-register_gdpr",
|
42 |
+
__( 'Privacy Policy', 'ultimate-member' ),
|
43 |
+
array( UM()->metabox(), 'load_metabox_form' ),
|
44 |
+
'um_form',
|
45 |
+
'side',
|
46 |
+
'default'
|
47 |
+
);
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
*
|
53 |
+
*/
|
54 |
+
function init_fields() {
|
55 |
+
$this->meta_associations = array(
|
56 |
+
|
57 |
+
'account_status' => __( 'Account Status', 'ultimate-member' ),
|
58 |
+
'submitted' => __( 'Submitted data on Registration', 'ultimate-member' ),
|
59 |
+
'form_id' => __( 'Registration Form ID', 'ultimate-member' ),
|
60 |
+
'timestamp' => __( 'Registration Timestamp', 'ultimate-member' ),
|
61 |
+
'request' => __( 'Registration Request', 'ultimate-member' ),
|
62 |
+
'_wpnonce' => __( 'Registration Nonce', 'ultimate-member' ),
|
63 |
+
'_wp_http_referer' => __( 'Registration HTTP referer', 'ultimate-member' ),
|
64 |
+
'role' => __( 'Community Role', 'ultimate-member' ),
|
65 |
+
'um_user_profile_url_slug_user_login' => __( 'Profile Slug "Username"', 'ultimate-member' ),
|
66 |
+
'um_user_profile_url_slug_name' => __( 'Profile Slug "First and Last Name with \'.\'"', 'ultimate-member' ),
|
67 |
+
'um_user_profile_url_slug_name_dash' => __( 'Profile Slug "First and Last Name with \'-\'"', 'ultimate-member' ),
|
68 |
+
'um_user_profile_url_slug_name_plus' => __( 'Profile Slug "First and Last Name with \'+\'"', 'ultimate-member' ),
|
69 |
+
'um_user_profile_url_slug_user_id' => __( 'Profile Slug "User ID"', 'ultimate-member' ),
|
70 |
+
'_um_last_login' => __( 'Last Login Timestamp', 'ultimate-member' ),
|
71 |
+
|
72 |
+
//Private content extension
|
73 |
+
'_um_private_content_post_id' => __( 'Private Content Post ID', 'ultimate-member' ),
|
74 |
+
|
75 |
+
//Verified Users extension
|
76 |
+
'_um_verified' => __( 'Verified Account', 'ultimate-member' ),
|
77 |
+
|
78 |
+
//Terms & Conditions extension
|
79 |
+
'use_terms_conditions_agreement' => __( 'Terms&Conditions Agreement', 'ultimate-member' ),
|
80 |
+
|
81 |
+
//GDPR extension
|
82 |
+
'use_gdpr_agreement' => __( 'Privacy Policy Agreement', 'ultimate-member' ),
|
83 |
+
|
84 |
+
|
85 |
+
);
|
86 |
+
|
87 |
+
$all_fields = UM()->builtin()->all_user_fields( null, true );
|
88 |
+
unset( $all_fields[0] );
|
89 |
+
|
90 |
+
$all_fields = array_map( function( $value ) {
|
91 |
+
return $value['title'];
|
92 |
+
}, $all_fields );
|
93 |
+
|
94 |
+
$this->meta_associations = array_merge( $this->meta_associations, $all_fields );
|
95 |
+
|
96 |
+
/**
|
97 |
+
* UM hook
|
98 |
+
*
|
99 |
+
* @type filter
|
100 |
+
* @title um_gdpr_meta_associations
|
101 |
+
* @description Exclude taxonomies for UM
|
102 |
+
* @input_vars
|
103 |
+
* [{"var":"$meta_associations","type":"array","desc":"Meta Keys Titles"}]
|
104 |
+
* @change_log
|
105 |
+
* ["Since: 2.0.14"]
|
106 |
+
* @usage
|
107 |
+
* <?php add_filter( 'um_gdpr_meta_associations', 'function_name', 10, 1 ); ?>
|
108 |
+
* @example
|
109 |
+
* <?php
|
110 |
+
* add_filter( 'um_gdpr_meta_associations', 'my_gdpr_meta_associations', 10, 1 );
|
111 |
+
* function my_gdpr_meta_associations( $meta_associations ) {
|
112 |
+
* // your code here
|
113 |
+
* return $meta_associations;
|
114 |
+
* }
|
115 |
+
* ?>
|
116 |
+
*/
|
117 |
+
$this->meta_associations = apply_filters( 'um_gdpr_meta_associations', $this->meta_associations );
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Return the default suggested privacy policy content.
|
123 |
+
*
|
124 |
+
* @return string The default policy content.
|
125 |
+
*/
|
126 |
+
function plugin_get_default_privacy_content() {
|
127 |
+
ob_start();
|
128 |
+
|
129 |
+
include UM()->admin()->templates_path . 'gdpr.php';
|
130 |
+
|
131 |
+
return ob_get_clean();
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Add the suggested privacy policy text to the policy postbox.
|
137 |
+
*/
|
138 |
+
function plugin_add_suggested_privacy_content() {
|
139 |
+
$content = $this->plugin_get_default_privacy_content();
|
140 |
+
wp_add_privacy_policy_content( ultimatemember_plugin_name, $content );
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Register exporter for Plugin user data.
|
146 |
+
*
|
147 |
+
* @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md
|
148 |
+
*
|
149 |
+
* @param $exporters
|
150 |
+
*
|
151 |
+
* @return array
|
152 |
+
*/
|
153 |
+
function plugin_register_exporters( $exporters ) {
|
154 |
+
$exporters[] = array(
|
155 |
+
'exporter_friendly_name' => ultimatemember_plugin_name,
|
156 |
+
'callback' => array( &$this, 'data_exporter' )
|
157 |
+
);
|
158 |
+
return $exporters;
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Get user metadata in key => value array
|
164 |
+
*
|
165 |
+
*
|
166 |
+
* @param $user_id
|
167 |
+
*
|
168 |
+
* @return array
|
169 |
+
*/
|
170 |
+
function get_metadata( $user_id ) {
|
171 |
+
global $wpdb;
|
172 |
+
|
173 |
+
$metadata = $wpdb->get_results( $wpdb->prepare(
|
174 |
+
"SELECT meta_key, meta_value
|
175 |
+
FROM {$wpdb->usermeta}
|
176 |
+
WHERE user_id = %d",
|
177 |
+
$user_id
|
178 |
+
), ARRAY_A );
|
179 |
+
|
180 |
+
$filtered = array();
|
181 |
+
foreach ( $metadata as $data ) {
|
182 |
+
if ( in_array( $data['meta_key'], array_keys( $this->meta_associations ) ) ) {
|
183 |
+
$filtered[] = array(
|
184 |
+
'key' => $data['meta_key'],
|
185 |
+
'name' => $this->meta_associations[ $data['meta_key'] ],
|
186 |
+
//'value' => maybe_unserialize( $data['meta_value'] ),
|
187 |
+
'value' => $data['meta_value'],
|
188 |
+
);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
return $filtered;
|
193 |
+
}
|
194 |
+
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Exporter for Plugin user data.
|
198 |
+
*
|
199 |
+
* @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md
|
200 |
+
*
|
201 |
+
* @param $email_address
|
202 |
+
* @param int $page
|
203 |
+
*
|
204 |
+
* @return array
|
205 |
+
*/
|
206 |
+
function data_exporter( $email_address, $page = 1 ) {
|
207 |
+
$export_items = array();
|
208 |
+
$user = get_user_by( 'email', $email_address );
|
209 |
+
|
210 |
+
if ( $user && $user->ID ) {
|
211 |
+
// Most item IDs should look like postType-postID
|
212 |
+
// If you don't have a post, comment or other ID to work with,
|
213 |
+
// use a unique value to avoid having this item's export
|
214 |
+
// combined in the final report with other items of the same id
|
215 |
+
$item_id = "ultimate-member-{$user->ID}";
|
216 |
+
|
217 |
+
// Core group IDs include 'comments', 'posts', etc.
|
218 |
+
// But you can add your own group IDs as needed
|
219 |
+
$group_id = 'ultimate-member';
|
220 |
+
|
221 |
+
// Optional group label. Core provides these for core groups.
|
222 |
+
// If you define your own group, the first exporter to
|
223 |
+
// include a label will be used as the group label in the
|
224 |
+
// final exported report
|
225 |
+
$group_label = ultimatemember_plugin_name;
|
226 |
+
|
227 |
+
// Plugins can add as many items in the item data array as they want
|
228 |
+
//$data = array();
|
229 |
+
|
230 |
+
$data = $this->get_metadata( $user->ID );
|
231 |
+
|
232 |
+
if ( ! empty( $data ) ) {
|
233 |
+
// Add this group of items to the exporters data array.
|
234 |
+
$export_items[] = array(
|
235 |
+
'group_id' => $group_id,
|
236 |
+
'group_label' => $group_label,
|
237 |
+
'item_id' => $item_id,
|
238 |
+
'data' => $data,
|
239 |
+
);
|
240 |
+
}
|
241 |
+
}
|
242 |
+
// Returns an array of exported items for this pass, but also a boolean whether this exporter is finished.
|
243 |
+
//If not it will be called again with $page increased by 1.
|
244 |
+
return array(
|
245 |
+
'data' => $export_items,
|
246 |
+
'done' => true,
|
247 |
+
);
|
248 |
+
}
|
249 |
+
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Register eraser for Plugin user data.
|
253 |
+
*
|
254 |
+
* @param array $erasers
|
255 |
+
*
|
256 |
+
* @return array
|
257 |
+
*/
|
258 |
+
function plugin_register_erasers( $erasers = array() ) {
|
259 |
+
$erasers[] = array(
|
260 |
+
'eraser_friendly_name' => ultimatemember_plugin_name,
|
261 |
+
'callback' => array( &$this, 'data_eraser' )
|
262 |
+
);
|
263 |
+
return $erasers;
|
264 |
+
}
|
265 |
+
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Eraser for Plugin user data.
|
269 |
+
*
|
270 |
+
* @param $email_address
|
271 |
+
* @param int $page
|
272 |
+
*
|
273 |
+
* @return array
|
274 |
+
*/
|
275 |
+
function data_eraser( $email_address, $page = 1 ) {
|
276 |
+
if ( empty( $email_address ) ) {
|
277 |
+
return array(
|
278 |
+
'items_removed' => false,
|
279 |
+
'items_retained' => false,
|
280 |
+
'messages' => array(),
|
281 |
+
'done' => true,
|
282 |
+
);
|
283 |
+
}
|
284 |
+
|
285 |
+
$user = get_user_by( 'email', $email_address );
|
286 |
+
$messages = array();
|
287 |
+
$items_removed = false;
|
288 |
+
$items_retained = false;
|
289 |
+
|
290 |
+
if ( $user && $user->ID ) {
|
291 |
+
$data = $this->get_metadata( $user->ID );
|
292 |
+
|
293 |
+
foreach ( $data as $metadata ) {
|
294 |
+
$deleted = delete_user_meta( $user->ID, $metadata['key'] );
|
295 |
+
if ( $deleted ) {
|
296 |
+
$items_removed = true;
|
297 |
+
} else {
|
298 |
+
$messages[] = sprintf( __( 'Your %s was unable to be removed at this time.', 'ultimate-member' ), $metadata['name'] );
|
299 |
+
$items_retained = true;
|
300 |
+
}
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
// Returns an array of exported items for this pass, but also a boolean whether this exporter is finished.
|
305 |
+
//If not it will be called again with $page increased by 1.
|
306 |
+
return array(
|
307 |
+
'items_removed' => $items_removed,
|
308 |
+
'items_retained' => $items_retained,
|
309 |
+
'messages' => $messages,
|
310 |
+
'done' => true,
|
311 |
+
);
|
312 |
+
}
|
313 |
+
|
314 |
+
}
|
315 |
+
|
316 |
+
}
|
includes/admin/core/class-admin-menu.php
CHANGED
@@ -206,6 +206,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
|
|
206 |
add_meta_box( 'um-metaboxes-mainbox-1', __( 'Latest from our blog', 'ultimate-member' ), array( &$this, 'um_news' ), $this->pagehook, 'normal', 'core' );
|
207 |
|
208 |
add_meta_box( 'um-metaboxes-sidebox-1', __( 'Purge Temp Files', 'ultimate-member' ), array( &$this, 'purge_temp' ), $this->pagehook, 'side', 'core' );
|
|
|
209 |
add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' );
|
210 |
|
211 |
if ( $this->language_avaialable_not_installed() ) {
|
@@ -215,6 +216,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
|
|
215 |
} else if ( $this->language_not_available() ) {
|
216 |
add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' );
|
217 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
}
|
219 |
|
220 |
|
@@ -269,6 +276,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
|
|
269 |
}
|
270 |
|
271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
/**
|
273 |
*
|
274 |
*/
|
206 |
add_meta_box( 'um-metaboxes-mainbox-1', __( 'Latest from our blog', 'ultimate-member' ), array( &$this, 'um_news' ), $this->pagehook, 'normal', 'core' );
|
207 |
|
208 |
add_meta_box( 'um-metaboxes-sidebox-1', __( 'Purge Temp Files', 'ultimate-member' ), array( &$this, 'purge_temp' ), $this->pagehook, 'side', 'core' );
|
209 |
+
|
210 |
add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' );
|
211 |
|
212 |
if ( $this->language_avaialable_not_installed() ) {
|
216 |
} else if ( $this->language_not_available() ) {
|
217 |
add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' );
|
218 |
}
|
219 |
+
|
220 |
+
//If there are active and licensed extensions - show metabox for upgrade it
|
221 |
+
$exts = UM()->plugin_updater()->um_get_active_plugins();
|
222 |
+
if ( 0 < count( $exts ) ) {
|
223 |
+
add_meta_box( 'um-metaboxes-sidebox-3', __( 'Upgrade\'s Manual Request', 'ultimate-member' ), array( &$this, 'upgrade_request' ), $this->pagehook, 'side', 'core' );
|
224 |
+
}
|
225 |
}
|
226 |
|
227 |
|
276 |
}
|
277 |
|
278 |
|
279 |
+
/**
|
280 |
+
*
|
281 |
+
*/
|
282 |
+
function upgrade_request() {
|
283 |
+
include_once UM()->admin()->templates_path . 'dashboard/upgrade-request.php';
|
284 |
+
}
|
285 |
+
|
286 |
+
|
287 |
/**
|
288 |
*
|
289 |
*/
|
includes/admin/core/class-admin-notices.php
CHANGED
@@ -38,7 +38,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
|
38 |
$this->localize_note();
|
39 |
$this->show_update_messages();
|
40 |
$this->check_wrong_install_folder();
|
41 |
-
|
42 |
$this->need_upgrade();
|
43 |
$this->check_wrong_licenses();
|
44 |
|
@@ -225,9 +225,32 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
|
225 |
function old_extensions_notice() {
|
226 |
$show = false;
|
227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
$slugs = array_map( function( $item ) {
|
229 |
return 'um-' . $item . '/um-' . $item . '.php';
|
230 |
-
},
|
231 |
|
232 |
$active_plugins = UM()->dependencies()->get_active_plugins();
|
233 |
foreach ( $slugs as $slug ) {
|
@@ -397,6 +420,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
|
397 |
$messages[0]['content'] = __( 'Your user cache is now removed.', 'ultimate-member' );
|
398 |
break;
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
case 'form_duplicated':
|
401 |
$messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' );
|
402 |
break;
|
@@ -540,7 +571,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
|
540 |
ob_start(); ?>
|
541 |
|
542 |
<p>
|
543 |
-
<?php printf( __( '<strong>%s version %s</strong> needs to be updated
|
544 |
</p>
|
545 |
|
546 |
<p>
|
38 |
$this->localize_note();
|
39 |
$this->show_update_messages();
|
40 |
$this->check_wrong_install_folder();
|
41 |
+
//$this->admin_notice_tracking();
|
42 |
$this->need_upgrade();
|
43 |
$this->check_wrong_licenses();
|
44 |
|
225 |
function old_extensions_notice() {
|
226 |
$show = false;
|
227 |
|
228 |
+
$old_extensions = array(
|
229 |
+
'bbpress',
|
230 |
+
'followers',
|
231 |
+
'friends',
|
232 |
+
'instagram',
|
233 |
+
'mailchimp',
|
234 |
+
'messaging',
|
235 |
+
'mycred',
|
236 |
+
'notices',
|
237 |
+
'notifications',
|
238 |
+
'online',
|
239 |
+
'private-content',
|
240 |
+
'profile-completeness',
|
241 |
+
'recaptcha',
|
242 |
+
'reviews',
|
243 |
+
'social-activity',
|
244 |
+
'social-login',
|
245 |
+
'terms-conditions',
|
246 |
+
'user-tags',
|
247 |
+
'verified-users',
|
248 |
+
'woocommerce',
|
249 |
+
);
|
250 |
+
|
251 |
$slugs = array_map( function( $item ) {
|
252 |
return 'um-' . $item . '/um-' . $item . '.php';
|
253 |
+
}, $old_extensions );
|
254 |
|
255 |
$active_plugins = UM()->dependencies()->get_active_plugins();
|
256 |
foreach ( $slugs as $slug ) {
|
420 |
$messages[0]['content'] = __( 'Your user cache is now removed.', 'ultimate-member' );
|
421 |
break;
|
422 |
|
423 |
+
case 'got_updates':
|
424 |
+
$messages[0]['content'] = __( 'You got the latest upgrades.', 'ultimate-member' );
|
425 |
+
break;
|
426 |
+
|
427 |
+
case 'often_updates':
|
428 |
+
$messages[0]['err_content'] = __( 'Try again later. You can run this action once daily.', 'ultimate-member' );
|
429 |
+
break;
|
430 |
+
|
431 |
case 'form_duplicated':
|
432 |
$messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' );
|
433 |
break;
|
571 |
ob_start(); ?>
|
572 |
|
573 |
<p>
|
574 |
+
<?php printf( __( '<strong>%s version %s</strong> needs to be updated to work correctly.<br />It is necessary to update the structure of the database and options that are associated with <strong>%s %s</strong>.<br />Please visit <a href="%s">"Upgrade"</a> page and run the upgrade process.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_version, ultimatemember_plugin_name, ultimatemember_version, $url ); ?>
|
575 |
</p>
|
576 |
|
577 |
<p>
|
includes/admin/core/class-admin-settings.php
CHANGED
@@ -1197,12 +1197,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
|
1197 |
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
1198 |
|
1199 |
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
|
|
1200 |
|
1201 |
/**
|
1202 |
* UM hook
|
1203 |
*
|
1204 |
* @type filter
|
1205 |
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
|
|
|
1206 |
* @description Render settings section
|
1207 |
* @input_vars
|
1208 |
* [{"var":"$content","type":"string","desc":"Section content"},
|
@@ -1220,7 +1222,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
|
1220 |
* ?>
|
1221 |
*/
|
1222 |
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
1223 |
-
$
|
1224 |
$section_fields
|
1225 |
);
|
1226 |
|
@@ -1258,6 +1260,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
|
1258 |
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
1259 |
|
1260 |
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
|
|
1261 |
|
1262 |
/**
|
1263 |
* UM hook
|
@@ -1281,13 +1284,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
|
1281 |
* ?>
|
1282 |
*/
|
1283 |
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
1284 |
-
$
|
1285 |
$section_fields
|
1286 |
);
|
1287 |
?>
|
1288 |
|
|
|
1289 |
<p class="submit">
|
1290 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'ultimate-member' ) ?>" />
|
|
|
|
|
1291 |
</p>
|
1292 |
</form>
|
1293 |
|
@@ -1397,7 +1403,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
|
1397 |
*
|
1398 |
*/
|
1399 |
function save_settings_handler() {
|
|
|
1400 |
if ( isset( $_POST['um-settings-action'] ) && 'save' == $_POST['um-settings-action'] && ! empty( $_POST['um_options'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1401 |
/**
|
1402 |
* UM hook
|
1403 |
*
|
@@ -1756,6 +1771,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
|
1756 |
|
1757 |
<div class="wrap-licenses">
|
1758 |
<input type="hidden" id="licenses_settings" name="licenses_settings" value="1">
|
|
|
|
|
1759 |
<table class="form-table um-settings-section">
|
1760 |
<tbody>
|
1761 |
<?php foreach ( $section_fields as $field_data ) {
|
@@ -2007,6 +2024,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
|
2007 |
<form method="post" action="" name="um-settings-form" class="um-settings-form">
|
2008 |
<input type="hidden" value="save" name="um-settings-action" />
|
2009 |
<input type="hidden" name="licenses_settings" value="1" />
|
|
|
|
|
2010 |
<input type="text" id="um_options_<?php echo $field_data['id'] ?>" name="um_options[<?php echo $field_data['id'] ?>]" value="<?php echo $value ?>" class="um-option-field um-long-field" data-field_id="<?php echo $field_data['id'] ?>" />
|
2011 |
<?php if ( ! empty( $field_data['description'] ) ) { ?>
|
2012 |
<div class="description"><?php echo $field_data['description'] ?></div>
|
@@ -2165,7 +2184,6 @@ Cache User Profile: <?php if( UM()->options()->get( 'um_profile_object_cache_s
|
|
2165 |
Generate Slugs on Directories: <?php if( UM()->options()->get( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
|
2166 |
Rewrite Rules: <?php if( UM()->options()->get( 'um_flush_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
|
2167 |
Force UTF-8 Encoding: <?php if( UM()->options()->get( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
2168 |
-
Time Check Security: <?php if( UM()->options()->get( 'enable_timebot' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
2169 |
JS/CSS Compression: <?php if ( defined('SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
2170 |
<?php if( is_multisite() ): ?>
|
2171 |
Network Structure: <?php echo UM()->options()->get( 'network_permalink_structure' ). "\n"; ?>
|
1197 |
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
1198 |
|
1199 |
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
1200 |
+
$settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
|
1201 |
|
1202 |
/**
|
1203 |
* UM hook
|
1204 |
*
|
1205 |
* @type filter
|
1206 |
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
|
1207 |
+
*
|
1208 |
* @description Render settings section
|
1209 |
* @input_vars
|
1210 |
* [{"var":"$content","type":"string","desc":"Section content"},
|
1222 |
* ?>
|
1223 |
*/
|
1224 |
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
1225 |
+
$settings_section,
|
1226 |
$section_fields
|
1227 |
);
|
1228 |
|
1260 |
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
1261 |
|
1262 |
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
1263 |
+
$settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
|
1264 |
|
1265 |
/**
|
1266 |
* UM hook
|
1284 |
* ?>
|
1285 |
*/
|
1286 |
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
1287 |
+
$settings_section,
|
1288 |
$section_fields
|
1289 |
);
|
1290 |
?>
|
1291 |
|
1292 |
+
|
1293 |
<p class="submit">
|
1294 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'ultimate-member' ) ?>" />
|
1295 |
+
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
|
1296 |
+
<input type="hidden" name="__umnonce" value="<?php echo $um_settings_nonce; ?>" />
|
1297 |
</p>
|
1298 |
</form>
|
1299 |
|
1403 |
*
|
1404 |
*/
|
1405 |
function save_settings_handler() {
|
1406 |
+
|
1407 |
if ( isset( $_POST['um-settings-action'] ) && 'save' == $_POST['um-settings-action'] && ! empty( $_POST['um_options'] ) ) {
|
1408 |
+
|
1409 |
+
$nonce = ! empty( $_POST['__umnonce'] ) ? $_POST['__umnonce'] : '';
|
1410 |
+
|
1411 |
+
if ( ( ! wp_verify_nonce( $nonce, 'um-settings-nonce' ) || empty( $nonce ) ) || ! current_user_can('manage_options') ) {
|
1412 |
+
// This nonce is not valid.
|
1413 |
+
wp_die( 'Security Check' );
|
1414 |
+
}
|
1415 |
+
|
1416 |
/**
|
1417 |
* UM hook
|
1418 |
*
|
1771 |
|
1772 |
<div class="wrap-licenses">
|
1773 |
<input type="hidden" id="licenses_settings" name="licenses_settings" value="1">
|
1774 |
+
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
|
1775 |
+
<input type="hidden" name="__umnonce" value="<?php echo $um_settings_nonce; ?>" />
|
1776 |
<table class="form-table um-settings-section">
|
1777 |
<tbody>
|
1778 |
<?php foreach ( $section_fields as $field_data ) {
|
2024 |
<form method="post" action="" name="um-settings-form" class="um-settings-form">
|
2025 |
<input type="hidden" value="save" name="um-settings-action" />
|
2026 |
<input type="hidden" name="licenses_settings" value="1" />
|
2027 |
+
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
|
2028 |
+
<input type="hidden" name="__umnonce" value="<?php echo $um_settings_nonce; ?>" />
|
2029 |
<input type="text" id="um_options_<?php echo $field_data['id'] ?>" name="um_options[<?php echo $field_data['id'] ?>]" value="<?php echo $value ?>" class="um-option-field um-long-field" data-field_id="<?php echo $field_data['id'] ?>" />
|
2030 |
<?php if ( ! empty( $field_data['description'] ) ) { ?>
|
2031 |
<div class="description"><?php echo $field_data['description'] ?></div>
|
2184 |
Generate Slugs on Directories: <?php if( UM()->options()->get( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
|
2185 |
Rewrite Rules: <?php if( UM()->options()->get( 'um_flush_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
|
2186 |
Force UTF-8 Encoding: <?php if( UM()->options()->get( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
|
|
2187 |
JS/CSS Compression: <?php if ( defined('SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
2188 |
<?php if( is_multisite() ): ?>
|
2189 |
Network Structure: <?php echo UM()->options()->get( 'network_permalink_structure' ). "\n"; ?>
|
includes/admin/core/class-admin-upgrade.php
CHANGED
@@ -17,6 +17,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
|
17 |
class Admin_Upgrade {
|
18 |
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* @var
|
22 |
*/
|
@@ -31,6 +37,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
|
31 |
var $packages_dir;
|
32 |
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* Admin_Upgrade constructor.
|
36 |
*/
|
@@ -39,14 +64,55 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
|
39 |
$this->necessary_packages = $this->need_run_upgrades();
|
40 |
|
41 |
if ( ! empty( $this->necessary_packages ) ) {
|
42 |
-
$this->init_packages_ajax();
|
43 |
add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 );
|
44 |
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
47 |
}
|
|
|
|
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
/**
|
52 |
* Get array of necessary upgrade packages
|
@@ -105,7 +171,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
|
105 |
foreach ( $this->necessary_packages as $package ) {
|
106 |
$hooks_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'hooks.php';
|
107 |
if ( file_exists( $hooks_file ) ) {
|
108 |
-
$pack_ajax_hooks =
|
109 |
|
110 |
foreach ( $pack_ajax_hooks as $action => $function ) {
|
111 |
add_action( 'wp_ajax_um_' . $action, "um_upgrade_$function" );
|
@@ -122,7 +188,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
|
122 |
foreach ( $this->necessary_packages as $package ) {
|
123 |
$handlers_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'functions.php';
|
124 |
if ( file_exists( $handlers_file ) ) {
|
125 |
-
|
126 |
}
|
127 |
}
|
128 |
}
|
@@ -252,7 +318,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
|
252 |
exit('');
|
253 |
} else {
|
254 |
ob_start();
|
255 |
-
|
256 |
ob_get_flush();
|
257 |
exit;
|
258 |
}
|
17 |
class Admin_Upgrade {
|
18 |
|
19 |
|
20 |
+
/**
|
21 |
+
* @var null
|
22 |
+
*/
|
23 |
+
protected static $instance = null;
|
24 |
+
|
25 |
+
|
26 |
/**
|
27 |
* @var
|
28 |
*/
|
37 |
var $packages_dir;
|
38 |
|
39 |
|
40 |
+
/**
|
41 |
+
* Main Admin_Upgrade Instance
|
42 |
+
*
|
43 |
+
* Ensures only one instance of UM is loaded or can be loaded.
|
44 |
+
*
|
45 |
+
* @since 1.0
|
46 |
+
* @static
|
47 |
+
* @see UM()
|
48 |
+
* @return Admin_Upgrade - Main instance
|
49 |
+
*/
|
50 |
+
static public function instance() {
|
51 |
+
if ( is_null( self::$instance ) ) {
|
52 |
+
self::$instance = new self();
|
53 |
+
}
|
54 |
+
|
55 |
+
return self::$instance;
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
/**
|
60 |
* Admin_Upgrade constructor.
|
61 |
*/
|
64 |
$this->necessary_packages = $this->need_run_upgrades();
|
65 |
|
66 |
if ( ! empty( $this->necessary_packages ) ) {
|
|
|
67 |
add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 );
|
68 |
|
69 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
70 |
+
$this->init_packages_ajax();
|
71 |
+
|
72 |
+
add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) );
|
73 |
+
add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) );
|
74 |
+
}
|
75 |
}
|
76 |
+
|
77 |
+
//add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
|
78 |
}
|
79 |
|
80 |
+
/**
|
81 |
+
* Function for major updates
|
82 |
+
*
|
83 |
+
*/
|
84 |
+
/*function in_plugin_update_message( $args ) {
|
85 |
+
|
86 |
+
$lastversion = get_option( '%UNIQUE_ID%_last_version', false );
|
87 |
+
if ( $lastversion && version_compare( $lastversion, %UNIQUE_ID%_current_version, '>' ) ) {
|
88 |
+
$upgrade_notice = get_option( '%UNIQUE_ID%_major_update' . $lastversion );
|
89 |
+
|
90 |
+
echo '<style type="text/css">
|
91 |
+
.%UNIQUE_ID%_plugin_upgrade_notice {
|
92 |
+
font-weight: 400;
|
93 |
+
color: #fff;
|
94 |
+
background: #d53221;
|
95 |
+
padding: 1em;
|
96 |
+
margin: 9px 0;
|
97 |
+
display: block;
|
98 |
+
box-sizing: border-box;
|
99 |
+
-webkit-box-sizing: border-box;
|
100 |
+
-moz-box-sizing: border-box;
|
101 |
+
}
|
102 |
+
.%UNIQUE_ID%_plugin_upgrade_notice:before {
|
103 |
+
content: "\f348";
|
104 |
+
display: inline-block;
|
105 |
+
font: 400 18px/1 dashicons;
|
106 |
+
speak: none;
|
107 |
+
margin: 0 8px 0 -2px;
|
108 |
+
-webkit-font-smoothing: antialiased;
|
109 |
+
-moz-osx-font-smoothing: grayscale;
|
110 |
+
vertical-align: top;
|
111 |
+
}
|
112 |
+
</style>' . wp_kses_post( $upgrade_notice );
|
113 |
+
}
|
114 |
+
}*/
|
115 |
+
|
116 |
|
117 |
/**
|
118 |
* Get array of necessary upgrade packages
|
171 |
foreach ( $this->necessary_packages as $package ) {
|
172 |
$hooks_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'hooks.php';
|
173 |
if ( file_exists( $hooks_file ) ) {
|
174 |
+
$pack_ajax_hooks = include_once $hooks_file;
|
175 |
|
176 |
foreach ( $pack_ajax_hooks as $action => $function ) {
|
177 |
add_action( 'wp_ajax_um_' . $action, "um_upgrade_$function" );
|
188 |
foreach ( $this->necessary_packages as $package ) {
|
189 |
$handlers_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'functions.php';
|
190 |
if ( file_exists( $handlers_file ) ) {
|
191 |
+
include_once $handlers_file;
|
192 |
}
|
193 |
}
|
194 |
}
|
318 |
exit('');
|
319 |
} else {
|
320 |
ob_start();
|
321 |
+
include_once $this->packages_dir . DIRECTORY_SEPARATOR . $_POST['pack'] . DIRECTORY_SEPARATOR . 'init.php';
|
322 |
ob_get_flush();
|
323 |
exit;
|
324 |
}
|
includes/admin/core/class-admin-users.php
CHANGED
@@ -44,7 +44,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
|
|
44 |
*/
|
45 |
function user_action_hook( $action ) {
|
46 |
switch ( $action ) {
|
47 |
-
|
48 |
default:
|
49 |
/**
|
50 |
* UM hook
|
@@ -74,6 +73,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
|
|
74 |
|
75 |
case 'um_approve_membership':
|
76 |
case 'um_reenable':
|
|
|
77 |
UM()->user()->approve();
|
78 |
break;
|
79 |
|
@@ -362,8 +362,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
|
|
362 |
* Bulk user editing actions
|
363 |
*/
|
364 |
function um_bulk_users_edit() {
|
365 |
-
$admin_err = 0;
|
366 |
-
|
367 |
// bulk edit users
|
368 |
if ( ! empty( $_REQUEST['users'] ) && ! empty( $_REQUEST['um_bulkedit'] ) && ! empty( $_REQUEST['um_bulk_action'] ) ) {
|
369 |
|
@@ -377,66 +375,61 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
|
|
377 |
|
378 |
foreach ( $users as $user_id ) {
|
379 |
UM()->user()->set( $user_id );
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
do_action( "um_admin_user_action_{$bulk_action}_hook" );
|
421 |
-
|
422 |
-
} else {
|
423 |
-
$admin_err = 1;
|
424 |
-
}
|
425 |
}
|
426 |
|
427 |
// Finished. redirect now
|
428 |
-
if ( $admin_err == 0 ) {
|
429 |
|
430 |
-
|
431 |
-
|
432 |
|
433 |
-
|
|
|
434 |
|
435 |
-
|
436 |
-
} else {
|
437 |
wp_redirect( admin_url( 'users.php?update=err_users_updated' ) );
|
438 |
exit;
|
439 |
-
}
|
440 |
|
441 |
} else if ( ! empty( $_REQUEST['um_bulkedit'] ) ) {
|
442 |
|
44 |
*/
|
45 |
function user_action_hook( $action ) {
|
46 |
switch ( $action ) {
|
|
|
47 |
default:
|
48 |
/**
|
49 |
* UM hook
|
73 |
|
74 |
case 'um_approve_membership':
|
75 |
case 'um_reenable':
|
76 |
+
|
77 |
UM()->user()->approve();
|
78 |
break;
|
79 |
|
362 |
* Bulk user editing actions
|
363 |
*/
|
364 |
function um_bulk_users_edit() {
|
|
|
|
|
365 |
// bulk edit users
|
366 |
if ( ! empty( $_REQUEST['users'] ) && ! empty( $_REQUEST['um_bulkedit'] ) && ! empty( $_REQUEST['um_bulk_action'] ) ) {
|
367 |
|
375 |
|
376 |
foreach ( $users as $user_id ) {
|
377 |
UM()->user()->set( $user_id );
|
378 |
+
|
379 |
+
/**
|
380 |
+
* UM hook
|
381 |
+
*
|
382 |
+
* @type action
|
383 |
+
* @title um_admin_user_action_hook
|
384 |
+
* @description Action on bulk user action
|
385 |
+
* @input_vars
|
386 |
+
* [{"var":"$bulk_action","type":"string","desc":"Bulk Action"}]
|
387 |
+
* @change_log
|
388 |
+
* ["Since: 2.0"]
|
389 |
+
* @usage add_action( 'um_admin_user_action_hook{$action}', 'function_name', 10, 1 );
|
390 |
+
* @example
|
391 |
+
* <?php
|
392 |
+
* add_action( 'um_admin_user_action_hook', 'my_admin_user_action', 10, 1 );
|
393 |
+
* function my_admin_user_action( $bulk_action ) {
|
394 |
+
* // your code here
|
395 |
+
* }
|
396 |
+
* ?>
|
397 |
+
*/
|
398 |
+
do_action( "um_admin_user_action_hook", $bulk_action );
|
399 |
+
|
400 |
+
/**
|
401 |
+
* UM hook
|
402 |
+
*
|
403 |
+
* @type action
|
404 |
+
* @title um_admin_user_action_{$bulk_action}_hook
|
405 |
+
* @description Action on bulk user action
|
406 |
+
* @change_log
|
407 |
+
* ["Since: 2.0"]
|
408 |
+
* @usage add_action( 'um_admin_user_action_{$bulk_action}_hook', 'function_name', 10 );
|
409 |
+
* @example
|
410 |
+
* <?php
|
411 |
+
* add_action( 'um_admin_user_action_{$bulk_action}_hook', 'my_admin_user_action', 10 );
|
412 |
+
* function my_admin_user_action() {
|
413 |
+
* // your code here
|
414 |
+
* }
|
415 |
+
* ?>
|
416 |
+
*/
|
417 |
+
do_action( "um_admin_user_action_{$bulk_action}_hook" );
|
|
|
|
|
|
|
|
|
|
|
418 |
}
|
419 |
|
420 |
// Finished. redirect now
|
421 |
+
//if ( $admin_err == 0 ) {
|
422 |
|
423 |
+
$uri = $this->set_redirect_uri( admin_url( 'users.php' ) );
|
424 |
+
$uri = add_query_arg( 'update', 'users_updated', $uri );
|
425 |
|
426 |
+
wp_redirect( $uri );
|
427 |
+
exit;
|
428 |
|
429 |
+
/*} else {
|
|
|
430 |
wp_redirect( admin_url( 'users.php?update=err_users_updated' ) );
|
431 |
exit;
|
432 |
+
}*/
|
433 |
|
434 |
} else if ( ! empty( $_REQUEST['um_bulkedit'] ) ) {
|
435 |
|
includes/admin/core/packages/2.0-beta1/email_templates.php
CHANGED
@@ -25,8 +25,8 @@ foreach ( $emails as $email_key => $value ) {
|
|
25 |
} else {
|
26 |
$setting_value = UM()->options()->get( $email_key );
|
27 |
|
28 |
-
$fp = fopen( $theme_template_path, "w" );
|
29 |
-
$result = fputs( $fp, $setting_value );
|
30 |
fclose( $fp );
|
31 |
}
|
32 |
} else {
|
25 |
} else {
|
26 |
$setting_value = UM()->options()->get( $email_key );
|
27 |
|
28 |
+
$fp = @fopen( $theme_template_path, "w" );
|
29 |
+
$result = @fputs( $fp, $setting_value );
|
30 |
fclose( $fp );
|
31 |
}
|
32 |
} else {
|
includes/admin/core/packages/2.0-beta1/menus.php
CHANGED
@@ -18,9 +18,15 @@ $menus = get_posts( array(
|
|
18 |
foreach ( $menus as $menu ) {
|
19 |
$menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true );
|
20 |
|
|
|
|
|
|
|
21 |
foreach ( $menu_roles as $i => $role_k ) {
|
22 |
-
|
|
|
|
|
23 |
}
|
24 |
|
|
|
25 |
update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles );
|
26 |
}
|
18 |
foreach ( $menus as $menu ) {
|
19 |
$menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true );
|
20 |
|
21 |
+
if( !is_array( $menu_roles ) ) {
|
22 |
+
$menu_roles = array();
|
23 |
+
}
|
24 |
foreach ( $menu_roles as $i => $role_k ) {
|
25 |
+
if( $role_k != '' && isset( $roles_associations[ $role_k ] ) ) {
|
26 |
+
$menu_roles[ $i ] = $roles_associations[ $role_k ];
|
27 |
+
}
|
28 |
}
|
29 |
|
30 |
+
|
31 |
update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles );
|
32 |
}
|
includes/admin/core/packages/2.0.10/functions.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function um_upgrade_styles2010() {
|
3 |
+
um_maybe_unset_time_limit();
|
4 |
+
|
5 |
+
include 'styles.php';
|
6 |
+
wp_send_json_success( array( 'message' => __( 'Styles was upgraded successfully', 'ultimate-member' ) ) );
|
7 |
+
}
|
8 |
+
|
9 |
+
|
10 |
+
function um_upgrade_cache2010() {
|
11 |
+
um_maybe_unset_time_limit();
|
12 |
+
|
13 |
+
UM()->user()->remove_cache_all_users();
|
14 |
+
|
15 |
+
update_option( 'um_last_version_upgrade', '2.0.10' );
|
16 |
+
|
17 |
+
wp_send_json_success( array( 'message' => __( 'Users cache was cleared successfully', 'ultimate-member' ) ) );
|
18 |
+
}
|
includes/admin/core/packages/2.0.10/hooks.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
return array(
|
4 |
+
'styles2010' => 'styles2010',
|
5 |
+
'cache2010' => 'cache2010',
|
6 |
+
);
|
includes/admin/core/packages/2.0.10/init.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php ?>
|
2 |
+
|
3 |
+
<script type="text/javascript">
|
4 |
+
jQuery( document ).ready( function() {
|
5 |
+
//upgrade styles
|
6 |
+
um_add_upgrade_log( '<?php echo esc_js( __( 'Upgrade Styles...', 'ultimate-member' ) ) ?>' );
|
7 |
+
|
8 |
+
jQuery.ajax({
|
9 |
+
url: '<?php echo admin_url( 'admin-ajax.php' ) ?>',
|
10 |
+
type: 'POST',
|
11 |
+
dataType: 'json',
|
12 |
+
data: {
|
13 |
+
action: 'um_styles2010'
|
14 |
+
},
|
15 |
+
success: function( response ) {
|
16 |
+
if ( typeof response.data != 'undefined' ) {
|
17 |
+
um_add_upgrade_log( response.data.message );
|
18 |
+
um_clear_cache2010();
|
19 |
+
} else {
|
20 |
+
um_wrong_ajax();
|
21 |
+
}
|
22 |
+
},
|
23 |
+
error: function() {
|
24 |
+
um_something_wrong();
|
25 |
+
}
|
26 |
+
});
|
27 |
+
|
28 |
+
|
29 |
+
//clear users cache
|
30 |
+
function um_clear_cache2010() {
|
31 |
+
um_add_upgrade_log( '<?php echo esc_js( __( 'Clear Users Cache...', 'ultimate-member' ) ) ?>' );
|
32 |
+
jQuery.ajax({
|
33 |
+
url: '<?php echo admin_url( 'admin-ajax.php' ) ?>',
|
34 |
+
type: 'POST',
|
35 |
+
dataType: 'json',
|
36 |
+
data: {
|
37 |
+
action: 'um_cache2010'
|
38 |
+
},
|
39 |
+
success: function( response ) {
|
40 |
+
if ( typeof response.data != 'undefined' ) {
|
41 |
+
um_add_upgrade_log( response.data.message );
|
42 |
+
//switch to the next package
|
43 |
+
um_run_upgrade();
|
44 |
+
} else {
|
45 |
+
um_wrong_ajax();
|
46 |
+
}
|
47 |
+
},
|
48 |
+
error: function() {
|
49 |
+
um_something_wrong();
|
50 |
+
}
|
51 |
+
});
|
52 |
+
}
|
53 |
+
});
|
54 |
+
</script>
|
includes/admin/core/packages/2.0.10/styles.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$css = '';
|
4 |
+
$custom_css = UM()->options()->get( 'custom_css' );
|
5 |
+
$enable_css = UM()->options()->get( 'enable_custom_css' );
|
6 |
+
|
7 |
+
if ( ! empty( $enable_css ) && ! empty( $custom_css ) ) {
|
8 |
+
$css .= $custom_css;
|
9 |
+
}
|
10 |
+
|
11 |
+
$forms_query = new WP_Query;
|
12 |
+
$registration_forms = $forms_query->query( array(
|
13 |
+
'post_type' => 'um_form',
|
14 |
+
'meta_query' => array(
|
15 |
+
array(
|
16 |
+
'key' => '_um_mode',
|
17 |
+
'value' => 'register'
|
18 |
+
),
|
19 |
+
),
|
20 |
+
'posts_per_page' => -1,
|
21 |
+
'fields' => 'ids'
|
22 |
+
) );
|
23 |
+
|
24 |
+
$forms_query = new WP_Query;
|
25 |
+
$login_forms = $forms_query->query( array(
|
26 |
+
'post_type' => 'um_form',
|
27 |
+
'meta_query' => array(
|
28 |
+
array(
|
29 |
+
'key' => '_um_mode',
|
30 |
+
'value' => 'login'
|
31 |
+
)
|
32 |
+
),
|
33 |
+
'posts_per_page' => -1,
|
34 |
+
'fields' => 'ids'
|
35 |
+
) );
|
36 |
+
|
37 |
+
$forms_query = new WP_Query;
|
38 |
+
$profile_forms = $forms_query->query( array(
|
39 |
+
'post_type' => 'um_form',
|
40 |
+
'meta_query' => array(
|
41 |
+
array(
|
42 |
+
'key' => '_um_mode',
|
43 |
+
'value' => 'profile'
|
44 |
+
)
|
45 |
+
),
|
46 |
+
'posts_per_page' => -1,
|
47 |
+
'fields' => 'ids'
|
48 |
+
) );
|
49 |
+
|
50 |
+
|
51 |
+
foreach ( $registration_forms as $form_id ) {
|
52 |
+
$register_custom_css = get_post_meta( $form_id, '_um_register_custom_css', true );
|
53 |
+
if ( ! empty( $register_custom_css ) ) {
|
54 |
+
$css .= '
|
55 |
+
/* registration form ID=' . $form_id . ' */
|
56 |
+
' . $register_custom_css;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
foreach ( $login_forms as $form_id ) {
|
62 |
+
$login_custom_css = get_post_meta( $form_id, '_um_login_custom_css', true );
|
63 |
+
if ( ! empty( $login_custom_css ) ) {
|
64 |
+
$css .= '
|
65 |
+
/* login form ID=' . $form_id . ' */
|
66 |
+
' . $login_custom_css;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
foreach ( $profile_forms as $form_id ) {
|
72 |
+
$profile_custom_css = get_post_meta( $form_id, '_um_profile_custom_css', true );
|
73 |
+
if ( ! empty( $profile_custom_css ) ) {
|
74 |
+
$css .= '
|
75 |
+
/* profile form ID=' . $form_id . ' */
|
76 |
+
' . $profile_custom_css;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
if ( ! empty( $css ) ) {
|
82 |
+
$uploads = wp_upload_dir();
|
83 |
+
$upload_dir = $uploads['basedir'] . DIRECTORY_SEPARATOR . 'ultimatemember' . DIRECTORY_SEPARATOR;
|
84 |
+
if ( file_exists( $upload_dir. 'um_old_settings.css' ) ) {
|
85 |
+
$css_doc_file = fopen( $upload_dir. 'um_old_settings.css', 'a' );
|
86 |
+
fwrite( $css_doc_file, "\r\n" . $css );
|
87 |
+
fclose( $css_doc_file );
|
88 |
+
}
|
89 |
+
}
|
includes/admin/templates/dashboard/cache.php
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
-
<?php $
|
2 |
|
3 |
-
$count =
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
} ?>
|
9 |
|
10 |
<p><?php _e( 'Run this task from time to time to keep your DB clean.', 'ultimate-member' ) ?></p>
|
11 |
<p>
|
1 |
+
<?php global $wpdb;
|
2 |
|
3 |
+
$count = $wpdb->get_var(
|
4 |
+
"SELECT COUNT( option_id )
|
5 |
+
FROM {$wpdb->options}
|
6 |
+
WHERE option_name LIKE 'um_cache_userdata_%'"
|
7 |
+
); ?>
|
|
|
8 |
|
9 |
<p><?php _e( 'Run this task from time to time to keep your DB clean.', 'ultimate-member' ) ?></p>
|
10 |
<p>
|
includes/admin/templates/dashboard/upgrade-request.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p><?php _e( 'Run this task from time to time if you have issues with WP Cron and need to get UM extension updates.', 'ultimate-member' ) ?></p>
|
2 |
+
<p>
|
3 |
+
<a href="<?php echo add_query_arg( 'um_adm_action', 'manual_upgrades_request' ); ?>" class="button">
|
4 |
+
<?php _e( 'Get latest versions', 'ultimate-member' ) ?>
|
5 |
+
</a>
|
6 |
+
</p>
|
includes/admin/templates/form/login_customize.php
CHANGED
@@ -65,7 +65,7 @@
|
|
65 |
array(
|
66 |
'id' => '_um_login_secondary_btn_word',
|
67 |
'type' => 'text',
|
68 |
-
'label' => __( '
|
69 |
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
70 |
'value' => UM()->query()->get_meta_value( '_um_login_secondary_btn_word', null, UM()->options()->get( 'login_secondary_btn_word' ) ),
|
71 |
'conditional' => array( '_um_login_secondary_btn', '=', 1 )
|
65 |
array(
|
66 |
'id' => '_um_login_secondary_btn_word',
|
67 |
'type' => 'text',
|
68 |
+
'label' => __( 'Secondary Button Text', 'ultimate-member' ),
|
69 |
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
70 |
'value' => UM()->query()->get_meta_value( '_um_login_secondary_btn_word', null, UM()->options()->get( 'login_secondary_btn_word' ) ),
|
71 |
'conditional' => array( '_um_login_secondary_btn', '=', 1 )
|
includes/admin/templates/form/profile_customize.php
CHANGED
@@ -90,7 +90,7 @@
|
|
90 |
array(
|
91 |
'id' => '_um_profile_secondary_btn_word',
|
92 |
'type' => 'text',
|
93 |
-
'label' => __( '
|
94 |
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
95 |
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn_word', null, UM()->options()->get( 'profile_secondary_btn_word' ) ),
|
96 |
'conditional' => array( '_um_profile_secondary_btn', '=', 1 )
|
90 |
array(
|
91 |
'id' => '_um_profile_secondary_btn_word',
|
92 |
'type' => 'text',
|
93 |
+
'label' => __( 'Secondary Button Text', 'ultimate-member' ),
|
94 |
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
95 |
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn_word', null, UM()->options()->get( 'profile_secondary_btn_word' ) ),
|
96 |
'conditional' => array( '_um_profile_secondary_btn', '=', 1 )
|
includes/admin/templates/form/register_customize.php
CHANGED
@@ -80,7 +80,7 @@
|
|
80 |
array(
|
81 |
'id' => '_um_register_secondary_btn_word',
|
82 |
'type' => 'text',
|
83 |
-
'label' => __( '
|
84 |
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
85 |
'value' => UM()->query()->get_meta_value( '_um_register_secondary_btn_word', null, UM()->options()->get( 'register_secondary_btn_word' ) ),
|
86 |
'conditional' => array( '_um_register_secondary_btn', '=', 1 )
|
80 |
array(
|
81 |
'id' => '_um_register_secondary_btn_word',
|
82 |
'type' => 'text',
|
83 |
+
'label' => __( 'Secondary Button Text', 'ultimate-member' ),
|
84 |
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
85 |
'value' => UM()->query()->get_meta_value( '_um_register_secondary_btn_word', null, UM()->options()->get( 'register_secondary_btn_word' ) ),
|
86 |
'conditional' => array( '_um_register_secondary_btn', '=', 1 )
|
includes/admin/templates/form/register_gdpr.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="um-admin-metabox">
|
2 |
+
|
3 |
+
<?php
|
4 |
+
$options = array(
|
5 |
+
'' => __( 'Select page', 'ultimate-member' )
|
6 |
+
);
|
7 |
+
|
8 |
+
$pages = get_pages();
|
9 |
+
foreach ( $pages as $page ) {
|
10 |
+
$options[$page->ID] = $page->post_title;
|
11 |
+
}
|
12 |
+
|
13 |
+
UM()->admin_forms( array(
|
14 |
+
'class' => 'um-form-register-gdpr um-top-label',
|
15 |
+
'prefix_id' => 'form',
|
16 |
+
'fields' => array(
|
17 |
+
array(
|
18 |
+
'id' => '_um_register_use_gdpr',
|
19 |
+
'type' => 'select',
|
20 |
+
'label' => __( 'Enable on this form', 'ultimate-member' ),
|
21 |
+
'value' => UM()->query()->get_meta_value( '_um_register_use_gdpr', null, '' ),
|
22 |
+
'options' => array(
|
23 |
+
'0' => __( 'No', 'ultimate-member' ),
|
24 |
+
'1' => __( 'Yes', 'ultimate-member' )
|
25 |
+
),
|
26 |
+
),
|
27 |
+
array(
|
28 |
+
'id' => '_um_register_use_gdpr_content_id',
|
29 |
+
'type' => 'select',
|
30 |
+
'label' => __( 'Content', 'ultimate-member' ),
|
31 |
+
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_content_id', null, '' ),
|
32 |
+
'options' => $options,
|
33 |
+
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
|
34 |
+
),
|
35 |
+
array(
|
36 |
+
'id' => '_um_register_use_gdpr_toggle_show',
|
37 |
+
'type' => 'text',
|
38 |
+
'label' => __( 'Toggle Show text', 'ultimate-member' ),
|
39 |
+
'placeholder' => __( 'Show privacy policy', 'ultimate-member' ),
|
40 |
+
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_toggle_show', null, __( 'Show privacy policy', 'ultimate-member' ) ),
|
41 |
+
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
|
42 |
+
),
|
43 |
+
array(
|
44 |
+
'id' => '_um_register_use_gdpr_toggle_hide',
|
45 |
+
'type' => 'text',
|
46 |
+
'label' => __( 'Toggle Hide text', 'ultimate-member' ),
|
47 |
+
'placeholder' => __( 'Hide privacy policy', 'ultimate-member' ),
|
48 |
+
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_toggle_hide', null, __( 'Hide privacy policy', 'ultimate-member' ) ),
|
49 |
+
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
|
50 |
+
),
|
51 |
+
array(
|
52 |
+
'id' => '_um_register_use_gdpr_agreement',
|
53 |
+
'type' => 'text',
|
54 |
+
'label' => __( 'Checkbox agreement description', 'ultimate-member' ),
|
55 |
+
'placeholder' => __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ),
|
56 |
+
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_agreement', null, __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ) ),
|
57 |
+
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
|
58 |
+
),
|
59 |
+
array(
|
60 |
+
'id' => '_um_register_use_gdpr_error_text',
|
61 |
+
'type' => 'text',
|
62 |
+
'label' => __( 'Error Text', 'ultimate-member' ),
|
63 |
+
'placeholder' => __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' ),
|
64 |
+
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_error_text', null, __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' ) ),
|
65 |
+
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
|
66 |
+
)
|
67 |
+
)
|
68 |
+
) )->render_form(); ?>
|
69 |
+
|
70 |
+
<div class="um-admin-clear"></div>
|
71 |
+
</div>
|
includes/admin/templates/gdpr.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. ?>
|
2 |
+
|
3 |
+
<h2>
|
4 |
+
<?php _e( 'What personal data we collect and why we collect it', 'ultimate-member' ); ?>
|
5 |
+
</h2>
|
6 |
+
<h3>
|
7 |
+
<?php _e( 'Forms', 'ultimate-member' ); ?>
|
8 |
+
</h3>
|
9 |
+
<p>
|
10 |
+
<?php printf( __( '%s provides you with forms for user registration, login and profiles.', 'ultimate-member' ), ultimatemember_plugin_name ); ?>
|
11 |
+
</p>
|
12 |
+
<p>
|
13 |
+
<?php _e( 'Via these forms you are collecting personal data from your users.', 'ultimate-member' ); ?>
|
14 |
+
</p>
|
15 |
+
<p>
|
16 |
+
<?php _e( 'You should include in your privacy policy what personal data is captured when someone submits/fills in one of the forms, why you collect it and what you do with this data and how long you keep it.', 'ultimate-member' ); ?>
|
17 |
+
</p>
|
18 |
+
|
19 |
+
<h2>
|
20 |
+
<?php _e( 'How long we retain your data', 'ultimate-member' ); ?>
|
21 |
+
</h2>
|
22 |
+
<p>
|
23 |
+
<?php _e( 'Registered user information is retained in your website’s database indefinitely.', 'ultimate-member' ); ?>
|
24 |
+
</p>
|
25 |
+
<p>
|
26 |
+
<?php _e( 'Data can be exported or removed upon users request via the existing WordPress data exporter or eraser.', 'ultimate-member' ); ?>
|
27 |
+
</p>
|
28 |
+
<p>
|
29 |
+
<?php _e( 'If syncing data to a 3rd party service (e.g Mailchimp via our MailChimp extension), data is retained there until unsubscribed or deleted.', 'ultimate-member' ); ?>
|
30 |
+
</p>
|
31 |
+
|
32 |
+
<h2>
|
33 |
+
<?php _e( 'Where we send your data', 'ultimate-member' ); ?>
|
34 |
+
</h2>
|
35 |
+
<p>
|
36 |
+
<?php printf( __( '%s does not send any user data outside of your site by default.', 'ultimate-member' ), ultimatemember_plugin_name ); ?>
|
37 |
+
</p>
|
38 |
+
<p>
|
39 |
+
<?php _e( 'If you have extended the functionality of the plugin (e.g sending registered user data to MailChimp via our MailChimp extension, this user info may be passed to these external services. These services may be located abroad and outwith the EU.', 'ultimate-member' ); ?>
|
40 |
+
</p>
|
includes/class-dependencies.php
CHANGED
@@ -57,6 +57,7 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
|
|
57 |
'woocommerce' => '2.0.1',
|
58 |
'restrict-content' => '2.0',
|
59 |
'beaver-builder' => '2.0',
|
|
|
60 |
);
|
61 |
|
62 |
|
57 |
'woocommerce' => '2.0.1',
|
58 |
'restrict-content' => '2.0',
|
59 |
'beaver-builder' => '2.0',
|
60 |
+
'gdpr' => '1.0.0',
|
61 |
);
|
62 |
|
63 |
|
includes/class-init.php
CHANGED
@@ -30,6 +30,7 @@ if ( ! class_exists( 'UM' ) ) {
|
|
30 |
* @method UM_Terms_Conditions_API Terms_Conditions_API()
|
31 |
* @method UM_Private_Content_API Private_Content_API()
|
32 |
* @method UM_User_Location_API User_Location_API()
|
|
|
33 |
*
|
34 |
*/
|
35 |
final class UM extends UM_Functions {
|
@@ -274,7 +275,7 @@ if ( ! class_exists( 'UM' ) ) {
|
|
274 |
// include hook files
|
275 |
add_action( 'plugins_loaded', array( &$this, 'init' ), 0 );
|
276 |
|
277 |
-
|
278 |
|
279 |
//run activation
|
280 |
register_activation_hook( um_plugin, array( &$this, 'activation' ) );
|
@@ -290,45 +291,99 @@ if ( ! class_exists( 'UM' ) ) {
|
|
290 |
}
|
291 |
|
292 |
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
}
|
300 |
|
301 |
-
if (
|
302 |
-
|
|
|
303 |
}
|
304 |
|
305 |
-
$
|
|
|
|
|
|
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
|
|
|
310 |
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
}
|
321 |
|
322 |
-
if (
|
323 |
-
|
|
|
324 |
}
|
325 |
|
326 |
-
|
327 |
-
|
328 |
-
|
|
|
329 |
|
330 |
-
|
331 |
-
|
|
|
|
|
|
|
332 |
|
333 |
|
334 |
/**
|
@@ -430,6 +485,7 @@ if ( ! class_exists( 'UM' ) ) {
|
|
430 |
$this->ajax_init();
|
431 |
$this->metabox();
|
432 |
$this->admin_upgrade()->init_packages_ajax_handlers();
|
|
|
433 |
} elseif ( $this->is_request( 'admin' ) ) {
|
434 |
$this->admin();
|
435 |
$this->admin_menu();
|
@@ -442,9 +498,9 @@ if ( ! class_exists( 'UM' ) ) {
|
|
442 |
$this->users();
|
443 |
$this->dragdrop();
|
444 |
$this->plugin_updater();
|
|
|
445 |
} elseif ( $this->is_request( 'frontend' ) ) {
|
446 |
$this->enqueue();
|
447 |
-
$this->rewrite();
|
448 |
$this->account();
|
449 |
$this->password();
|
450 |
$this->login();
|
@@ -456,6 +512,7 @@ if ( ! class_exists( 'UM' ) ) {
|
|
456 |
}
|
457 |
|
458 |
//common includes
|
|
|
459 |
$this->mail();
|
460 |
$this->rest_api();
|
461 |
$this->shortcodes();
|
@@ -467,9 +524,10 @@ if ( ! class_exists( 'UM' ) ) {
|
|
467 |
$this->permalinks();
|
468 |
$this->modal();
|
469 |
$this->cron();
|
470 |
-
|
471 |
$this->mobile();
|
472 |
$this->external_integrations();
|
|
|
473 |
}
|
474 |
|
475 |
|
@@ -579,12 +637,55 @@ if ( ! class_exists( 'UM' ) ) {
|
|
579 |
*/
|
580 |
function admin_upgrade() {
|
581 |
if ( empty( $this->classes['admin_upgrade'] ) ) {
|
582 |
-
$this->classes['admin_upgrade'] =
|
|
|
583 |
}
|
584 |
return $this->classes['admin_upgrade'];
|
585 |
}
|
586 |
|
587 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
/**
|
589 |
* @since 2.0
|
590 |
*
|
30 |
* @method UM_Terms_Conditions_API Terms_Conditions_API()
|
31 |
* @method UM_Private_Content_API Private_Content_API()
|
32 |
* @method UM_User_Location_API User_Location_API()
|
33 |
+
* @method UM_GDPR_API GDPR_API()
|
34 |
*
|
35 |
*/
|
36 |
final class UM extends UM_Functions {
|
275 |
// include hook files
|
276 |
add_action( 'plugins_loaded', array( &$this, 'init' ), 0 );
|
277 |
|
278 |
+
add_action( 'init', array( &$this, 'old_update_patch' ), 0 );
|
279 |
|
280 |
//run activation
|
281 |
register_activation_hook( um_plugin, array( &$this, 'activation' ) );
|
291 |
}
|
292 |
|
293 |
|
294 |
+
function old_update_patch() {
|
295 |
+
global $um_woocommerce, $um_bbpress, $um_followers, $um_friends, $um_mailchimp, $um_messaging, $um_mycred, $um_notices, $um_notifications, $um_online, $um_private_content, $um_profile_completeness, $um_recaptcha, $um_reviews, $um_activity, $um_social_login, $um_user_tags, $um_verified;
|
296 |
+
|
297 |
+
if ( is_object( $um_woocommerce ) ) {
|
298 |
+
remove_action( 'init', array( $um_woocommerce, 'plugin_check' ), 1 );
|
299 |
+
$um_woocommerce->plugin_inactive = true;
|
300 |
}
|
301 |
|
302 |
+
if ( is_object( $um_bbpress ) ) {
|
303 |
+
remove_action( 'init', array( $um_bbpress, 'plugin_check' ), 4 );
|
304 |
+
$um_bbpress->plugin_inactive = true;
|
305 |
}
|
306 |
|
307 |
+
if ( is_object( $um_followers ) ) {
|
308 |
+
remove_action( 'init', array( $um_followers, 'plugin_check' ), 1 );
|
309 |
+
$um_followers->plugin_inactive = true;
|
310 |
+
}
|
311 |
|
312 |
+
if ( is_object( $um_friends ) ) {
|
313 |
+
remove_action( 'init', array( $um_friends, 'plugin_check' ), 1 );
|
314 |
+
$um_friends->plugin_inactive = true;
|
315 |
+
}
|
316 |
|
317 |
+
if ( is_object( $um_mailchimp ) ) {
|
318 |
+
remove_action( 'init', array( $um_mailchimp, 'plugin_check' ), 1 );
|
319 |
+
$um_mailchimp->plugin_inactive = true;
|
320 |
+
}
|
321 |
+
|
322 |
+
if ( is_object( $um_messaging ) ) {
|
323 |
+
remove_action( 'init', array( $um_messaging, 'plugin_check' ), 1 );
|
324 |
+
$um_messaging->plugin_inactive = true;
|
325 |
+
}
|
326 |
+
|
327 |
+
if ( is_object( $um_mycred ) ) {
|
328 |
+
remove_action( 'init', array( $um_mycred, 'plugin_check' ), 1 );
|
329 |
+
$um_mycred->plugin_inactive = true;
|
330 |
+
}
|
331 |
+
|
332 |
+
if ( is_object( $um_notices ) ) {
|
333 |
+
remove_action( 'init', array( $um_notices, 'plugin_check' ), 1 );
|
334 |
+
$um_notices->plugin_inactive = true;
|
335 |
+
}
|
336 |
+
|
337 |
+
if ( is_object( $um_notifications ) ) {
|
338 |
+
remove_action( 'init', array( $um_notifications, 'plugin_check' ), 1 );
|
339 |
+
$um_notifications->plugin_inactive = true;
|
340 |
+
}
|
341 |
+
|
342 |
+
if ( is_object( $um_online ) ) {
|
343 |
+
remove_action( 'init', array( $um_online, 'plugin_check' ), 1 );
|
344 |
+
$um_online->plugin_inactive = true;
|
345 |
+
}
|
346 |
+
|
347 |
+
if ( is_object( $um_private_content ) ) {
|
348 |
+
remove_action( 'init', array( $um_private_content, 'plugin_check' ), 1 );
|
349 |
+
$um_private_content->plugin_inactive = true;
|
350 |
+
}
|
351 |
+
|
352 |
+
if ( is_object( $um_profile_completeness ) ) {
|
353 |
+
remove_action( 'init', array( $um_profile_completeness, 'plugin_check' ), 1 );
|
354 |
+
$um_profile_completeness->plugin_inactive = true;
|
355 |
+
}
|
356 |
+
|
357 |
+
if ( is_object( $um_recaptcha ) ) {
|
358 |
+
remove_action( 'init', array( $um_recaptcha, 'plugin_check' ), 1 );
|
359 |
+
$um_recaptcha->plugin_inactive = true;
|
360 |
+
}
|
361 |
+
|
362 |
+
if ( is_object( $um_reviews ) ) {
|
363 |
+
remove_action( 'init', array( $um_reviews, 'plugin_check' ), 1 );
|
364 |
+
$um_reviews->plugin_inactive = true;
|
365 |
+
}
|
366 |
+
|
367 |
+
if ( is_object( $um_activity ) ) {
|
368 |
+
remove_action( 'init', array( $um_activity, 'plugin_check' ), 1 );
|
369 |
+
$um_activity->plugin_inactive = true;
|
370 |
}
|
371 |
|
372 |
+
if ( is_object( $um_social_login ) ) {
|
373 |
+
remove_action( 'init', array( $um_social_login, 'plugin_check' ), 1 );
|
374 |
+
$um_social_login->plugin_inactive = true;
|
375 |
}
|
376 |
|
377 |
+
if ( is_object( $um_user_tags ) ) {
|
378 |
+
remove_action( 'init', array( $um_user_tags, 'plugin_check' ), 1 );
|
379 |
+
$um_user_tags->plugin_inactive = true;
|
380 |
+
}
|
381 |
|
382 |
+
if ( is_object( $um_verified ) ) {
|
383 |
+
remove_action( 'init', array( $um_verified, 'plugin_check' ), 1 );
|
384 |
+
$um_verified->plugin_inactive = true;
|
385 |
+
}
|
386 |
+
}
|
387 |
|
388 |
|
389 |
/**
|
485 |
$this->ajax_init();
|
486 |
$this->metabox();
|
487 |
$this->admin_upgrade()->init_packages_ajax_handlers();
|
488 |
+
$this->admin_gdpr();
|
489 |
} elseif ( $this->is_request( 'admin' ) ) {
|
490 |
$this->admin();
|
491 |
$this->admin_menu();
|
498 |
$this->users();
|
499 |
$this->dragdrop();
|
500 |
$this->plugin_updater();
|
501 |
+
$this->admin_gdpr();
|
502 |
} elseif ( $this->is_request( 'frontend' ) ) {
|
503 |
$this->enqueue();
|
|
|
504 |
$this->account();
|
505 |
$this->password();
|
506 |
$this->login();
|
512 |
}
|
513 |
|
514 |
//common includes
|
515 |
+
$this->rewrite();
|
516 |
$this->mail();
|
517 |
$this->rest_api();
|
518 |
$this->shortcodes();
|
524 |
$this->permalinks();
|
525 |
$this->modal();
|
526 |
$this->cron();
|
527 |
+
//$this->tracking();
|
528 |
$this->mobile();
|
529 |
$this->external_integrations();
|
530 |
+
$this->gdpr();
|
531 |
}
|
532 |
|
533 |
|
637 |
*/
|
638 |
function admin_upgrade() {
|
639 |
if ( empty( $this->classes['admin_upgrade'] ) ) {
|
640 |
+
$this->classes['admin_upgrade'] = um\admin\core\Admin_Upgrade::instance();
|
641 |
+
//$this->classes['admin_upgrade'] = new um\admin\core\Admin_Upgrade();
|
642 |
}
|
643 |
return $this->classes['admin_upgrade'];
|
644 |
}
|
645 |
|
646 |
|
647 |
+
/**
|
648 |
+
* GDPR privacy policy
|
649 |
+
*
|
650 |
+
* @since 2.0.14
|
651 |
+
*
|
652 |
+
* @return bool|um\admin\core\Admin_GDPR()
|
653 |
+
*/
|
654 |
+
function admin_gdpr() {
|
655 |
+
global $wp_version;
|
656 |
+
|
657 |
+
if ( version_compare( $wp_version, '4.9.6', '<' ) ) {
|
658 |
+
return false;
|
659 |
+
}
|
660 |
+
|
661 |
+
if ( empty( $this->classes['admin_gdpr'] ) ) {
|
662 |
+
$this->classes['admin_gdpr'] = new um\admin\core\Admin_GDPR();
|
663 |
+
}
|
664 |
+
return $this->classes['admin_gdpr'];
|
665 |
+
}
|
666 |
+
|
667 |
+
|
668 |
+
/**
|
669 |
+
* GDPR privacy policy
|
670 |
+
*
|
671 |
+
* @since 2.0.14
|
672 |
+
*
|
673 |
+
* @return bool|um\core\GDPR()
|
674 |
+
*/
|
675 |
+
function gdpr() {
|
676 |
+
global $wp_version;
|
677 |
+
|
678 |
+
if ( version_compare( $wp_version, '4.9.6', '<' ) ) {
|
679 |
+
return false;
|
680 |
+
}
|
681 |
+
|
682 |
+
if ( empty( $this->classes['gdpr'] ) ) {
|
683 |
+
$this->classes['gdpr'] = new um\core\GDPR();
|
684 |
+
}
|
685 |
+
return $this->classes['gdpr'];
|
686 |
+
}
|
687 |
+
|
688 |
+
|
689 |
/**
|
690 |
* @since 2.0
|
691 |
*
|
includes/core/class-access.php
CHANGED
@@ -65,6 +65,10 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
65 |
add_action( 'template_redirect', array( &$this, 'template_redirect' ), 1000 );
|
66 |
add_action( 'um_access_check_individual_term_settings', array( &$this, 'um_access_check_individual_term_settings' ) );
|
67 |
add_action( 'um_access_check_global_settings', array( &$this, 'um_access_check_global_settings' ) );
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
|
@@ -103,7 +107,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
103 |
* Check individual term Content Restriction settings
|
104 |
*/
|
105 |
function um_access_check_individual_term_settings() {
|
106 |
-
|
107 |
//check only tax|tags|categories - skip archive, author, and date lists
|
108 |
if ( ! ( is_tax() || is_tag() || is_category() ) ) {
|
109 |
return;
|
@@ -119,8 +122,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
119 |
$restriction = get_term_meta( $tag_id, 'um_content_restriction', true );
|
120 |
}
|
121 |
} elseif ( is_category() ) {
|
122 |
-
$um_category =
|
123 |
-
$um_category = current( $um_category );
|
124 |
|
125 |
$restricted_taxonomies = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
|
126 |
if ( empty( $restricted_taxonomies[ $um_category->taxonomy ] ) )
|
@@ -162,17 +164,21 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
162 |
if ( is_user_logged_in() ) {
|
163 |
|
164 |
$custom_restrict = $this->um_custom_restriction( $restriction );
|
165 |
-
|
166 |
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
|
167 |
if ( $custom_restrict ) {
|
168 |
$this->allow_access = true;
|
169 |
return;
|
170 |
} else {
|
171 |
//restrict terms page by 404 for logged in users with wrong role
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
173 |
$wp_query->set_404();
|
174 |
status_header( 404 );
|
175 |
-
nocache_headers()
|
176 |
}
|
177 |
} else {
|
178 |
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
|
@@ -181,11 +187,17 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
181 |
$this->allow_access = true;
|
182 |
return;
|
183 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
//restrict terms page by 404 for logged in users with wrong role
|
185 |
-
global $wp_query;
|
186 |
$wp_query->set_404();
|
187 |
status_header( 404 );
|
188 |
-
nocache_headers()
|
189 |
}
|
190 |
}
|
191 |
}
|
@@ -213,6 +225,18 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
213 |
}
|
214 |
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
/**
|
217 |
* Check global accessible settings
|
218 |
*/
|
@@ -504,14 +528,15 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
504 |
*/
|
505 |
function get_post_privacy_settings( $post ) {
|
506 |
//if logged in administrator all pages are visible
|
507 |
-
if ( current_user_can( 'administrator' ) )
|
508 |
return false;
|
|
|
509 |
|
510 |
//exlude from privacy UM default pages (except Members list and User(Profile) page)
|
511 |
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
|
512 |
if ( um_is_core_post( $post, 'login' ) || um_is_core_post( $post, 'register' ) ||
|
513 |
um_is_core_post( $post, 'account' ) || um_is_core_post( $post, 'logout' ) ||
|
514 |
-
um_is_core_post( $post, 'password-reset' ) )
|
515 |
return false;
|
516 |
}
|
517 |
|
@@ -521,7 +546,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
521 |
$restriction = get_post_meta( $post->ID, 'um_content_restriction', true );
|
522 |
|
523 |
if ( ! empty( $restriction['_um_custom_access_settings'] ) ) {
|
524 |
-
if ( ! isset( $restriction['_um_accessible'] )
|
525 |
return false;
|
526 |
else
|
527 |
return $restriction;
|
@@ -604,6 +629,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
604 |
|
605 |
//post is private
|
606 |
if ( '0' == $restriction['_um_accessible'] ) {
|
|
|
607 |
$filtered_posts[] = $post;
|
608 |
continue;
|
609 |
} elseif ( '1' == $restriction['_um_accessible'] ) {
|
@@ -912,6 +938,63 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
912 |
}
|
913 |
|
914 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
915 |
/**
|
916 |
* Protect Post Types in menu query
|
917 |
* Restrict content new logic
|
@@ -944,7 +1027,13 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
944 |
$filtered_items[] = $menu_item;
|
945 |
continue;
|
946 |
} else {
|
947 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
948 |
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
|
949 |
$filtered_items[] = $menu_item;
|
950 |
continue;
|
@@ -954,6 +1043,11 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
954 |
//if post for logged in users and user is not logged in
|
955 |
if ( is_user_logged_in() ) {
|
956 |
|
|
|
|
|
|
|
|
|
|
|
957 |
$custom_restrict = $this->um_custom_restriction( $restriction );
|
958 |
|
959 |
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
|
65 |
add_action( 'template_redirect', array( &$this, 'template_redirect' ), 1000 );
|
66 |
add_action( 'um_access_check_individual_term_settings', array( &$this, 'um_access_check_individual_term_settings' ) );
|
67 |
add_action( 'um_access_check_global_settings', array( &$this, 'um_access_check_global_settings' ) );
|
68 |
+
|
69 |
+
/* Disable comments if user has not permission to access current post */
|
70 |
+
add_filter( 'comments_open', array( $this, 'disable_comments_open' ), 99, 2 );
|
71 |
+
add_filter( 'get_comments_number', array( $this, 'disable_comments_open' ), 99, 2 );
|
72 |
}
|
73 |
|
74 |
|
107 |
* Check individual term Content Restriction settings
|
108 |
*/
|
109 |
function um_access_check_individual_term_settings() {
|
|
|
110 |
//check only tax|tags|categories - skip archive, author, and date lists
|
111 |
if ( ! ( is_tax() || is_tag() || is_category() ) ) {
|
112 |
return;
|
122 |
$restriction = get_term_meta( $tag_id, 'um_content_restriction', true );
|
123 |
}
|
124 |
} elseif ( is_category() ) {
|
125 |
+
$um_category = get_category( get_query_var( 'cat' ) );
|
|
|
126 |
|
127 |
$restricted_taxonomies = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
|
128 |
if ( empty( $restricted_taxonomies[ $um_category->taxonomy ] ) )
|
164 |
if ( is_user_logged_in() ) {
|
165 |
|
166 |
$custom_restrict = $this->um_custom_restriction( $restriction );
|
|
|
167 |
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
|
168 |
if ( $custom_restrict ) {
|
169 |
$this->allow_access = true;
|
170 |
return;
|
171 |
} else {
|
172 |
//restrict terms page by 404 for logged in users with wrong role
|
173 |
+
add_filter( 'tag_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
174 |
+
add_filter( 'archive_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
175 |
+
add_filter( 'category_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
176 |
+
add_filter( 'taxonomy_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
177 |
+
|
178 |
+
/*global $wp_query;
|
179 |
$wp_query->set_404();
|
180 |
status_header( 404 );
|
181 |
+
nocache_headers();*/
|
182 |
}
|
183 |
} else {
|
184 |
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
|
187 |
$this->allow_access = true;
|
188 |
return;
|
189 |
} else {
|
190 |
+
|
191 |
+
add_filter( 'tag_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
192 |
+
add_filter( 'archive_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
193 |
+
add_filter( 'category_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
194 |
+
add_filter( 'taxonomy_template', array( &$this, 'taxonomy_message' ), 10, 3 );
|
195 |
+
|
196 |
//restrict terms page by 404 for logged in users with wrong role
|
197 |
+
/*global $wp_query;
|
198 |
$wp_query->set_404();
|
199 |
status_header( 404 );
|
200 |
+
nocache_headers();*/
|
201 |
}
|
202 |
}
|
203 |
}
|
225 |
}
|
226 |
|
227 |
|
228 |
+
/**
|
229 |
+
* @param $template
|
230 |
+
* @param $type
|
231 |
+
* @param $templates
|
232 |
+
*
|
233 |
+
* @return string
|
234 |
+
*/
|
235 |
+
function taxonomy_message( $template, $type, $templates ) {
|
236 |
+
return UM()->locate_template( 'restricted-taxonomy.php' );
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
/**
|
241 |
* Check global accessible settings
|
242 |
*/
|
528 |
*/
|
529 |
function get_post_privacy_settings( $post ) {
|
530 |
//if logged in administrator all pages are visible
|
531 |
+
if ( current_user_can( 'administrator' ) ) {
|
532 |
return false;
|
533 |
+
}
|
534 |
|
535 |
//exlude from privacy UM default pages (except Members list and User(Profile) page)
|
536 |
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
|
537 |
if ( um_is_core_post( $post, 'login' ) || um_is_core_post( $post, 'register' ) ||
|
538 |
um_is_core_post( $post, 'account' ) || um_is_core_post( $post, 'logout' ) ||
|
539 |
+
um_is_core_post( $post, 'password-reset' ) || ( is_user_logged_in() && um_is_core_post( $post, 'user' ) ) )
|
540 |
return false;
|
541 |
}
|
542 |
|
546 |
$restriction = get_post_meta( $post->ID, 'um_content_restriction', true );
|
547 |
|
548 |
if ( ! empty( $restriction['_um_custom_access_settings'] ) ) {
|
549 |
+
if ( ! isset( $restriction['_um_accessible'] ) )
|
550 |
return false;
|
551 |
else
|
552 |
return $restriction;
|
629 |
|
630 |
//post is private
|
631 |
if ( '0' == $restriction['_um_accessible'] ) {
|
632 |
+
$this->singular_page = true;
|
633 |
$filtered_posts[] = $post;
|
634 |
continue;
|
635 |
} elseif ( '1' == $restriction['_um_accessible'] ) {
|
938 |
}
|
939 |
|
940 |
|
941 |
+
/**
|
942 |
+
* Disable comments if user has not permission to access this post
|
943 |
+
* @param mixed $open
|
944 |
+
* @param int $post_id
|
945 |
+
* @return boolean
|
946 |
+
*/
|
947 |
+
public function disable_comments_open( $open, $post_id ) {
|
948 |
+
|
949 |
+
static $cache = array();
|
950 |
+
|
951 |
+
if ( isset( $cache[ $post_id ] ) ) {
|
952 |
+
return $cache[ $post_id ] ? $open : false;
|
953 |
+
}
|
954 |
+
|
955 |
+
$post = get_post( $post_id );
|
956 |
+
$restriction = $this->get_post_privacy_settings( $post );
|
957 |
+
|
958 |
+
if ( ! $restriction ) {
|
959 |
+
$cache[ $post_id ] = $open;
|
960 |
+
return $open;
|
961 |
+
}
|
962 |
+
|
963 |
+
if ( '1' == $restriction['_um_accessible'] ) {
|
964 |
+
|
965 |
+
if ( is_user_logged_in() ) {
|
966 |
+
if ( ! current_user_can( 'administrator' ) ) {
|
967 |
+
$open = false;
|
968 |
+
}
|
969 |
+
}
|
970 |
+
|
971 |
+
} elseif ( '2' == $restriction['_um_accessible'] ) {
|
972 |
+
if ( ! is_user_logged_in() ) {
|
973 |
+
$open = false;
|
974 |
+
} else {
|
975 |
+
if ( ! current_user_can( 'administrator' ) ) {
|
976 |
+
$custom_restrict = $this->um_custom_restriction( $restriction );
|
977 |
+
|
978 |
+
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
|
979 |
+
if ( ! $custom_restrict ) {
|
980 |
+
$open = false;
|
981 |
+
}
|
982 |
+
} else {
|
983 |
+
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
|
984 |
+
|
985 |
+
if ( ! isset( $user_can ) || ! $user_can || ! $custom_restrict ) {
|
986 |
+
$open = false;
|
987 |
+
}
|
988 |
+
}
|
989 |
+
}
|
990 |
+
}
|
991 |
+
}
|
992 |
+
|
993 |
+
$cache[ $post_id ] = $open;
|
994 |
+
return $open;
|
995 |
+
}
|
996 |
+
|
997 |
+
|
998 |
/**
|
999 |
* Protect Post Types in menu query
|
1000 |
* Restrict content new logic
|
1027 |
$filtered_items[] = $menu_item;
|
1028 |
continue;
|
1029 |
} else {
|
1030 |
+
|
1031 |
+
if ( current_user_can( 'administrator' ) ) {
|
1032 |
+
$filtered_items[] = $menu_item;
|
1033 |
+
continue;
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
//if not single query when exclude if set _um_access_hide_from_queries
|
1037 |
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
|
1038 |
$filtered_items[] = $menu_item;
|
1039 |
continue;
|
1043 |
//if post for logged in users and user is not logged in
|
1044 |
if ( is_user_logged_in() ) {
|
1045 |
|
1046 |
+
if ( current_user_can( 'administrator' ) ) {
|
1047 |
+
$filtered_items[] = $menu_item;
|
1048 |
+
continue;
|
1049 |
+
}
|
1050 |
+
|
1051 |
$custom_restrict = $this->um_custom_restriction( $restriction );
|
1052 |
|
1053 |
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
|
includes/core/class-account.php
CHANGED
@@ -55,6 +55,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
|
55 |
* @param $args
|
56 |
*/
|
57 |
function init_tabs( $args ) {
|
|
|
58 |
$this->tabs = $this->get_tabs();
|
59 |
|
60 |
ksort( $this->tabs );
|
@@ -75,7 +76,6 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
|
75 |
}
|
76 |
|
77 |
}
|
78 |
-
|
79 |
$this->tabs = $tabs_structed;
|
80 |
}
|
81 |
|
@@ -527,7 +527,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
|
527 |
* ?>
|
528 |
*/
|
529 |
$args = apply_filters( 'um_account_tab_privacy_fields', $args, $shortcode_args );
|
530 |
-
|
531 |
$fields = UM()->builtin()->get_specific_fields( $args );
|
532 |
$fields = $this->account_secure_fields( $fields, $id );
|
533 |
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
|
@@ -535,7 +535,6 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
|
535 |
foreach ( $fields as $key => $data ){
|
536 |
$output .= UM()->fields()->edit_field( $key, $data );
|
537 |
}
|
538 |
-
|
539 |
break;
|
540 |
|
541 |
case 'delete':
|
55 |
* @param $args
|
56 |
*/
|
57 |
function init_tabs( $args ) {
|
58 |
+
|
59 |
$this->tabs = $this->get_tabs();
|
60 |
|
61 |
ksort( $this->tabs );
|
76 |
}
|
77 |
|
78 |
}
|
|
|
79 |
$this->tabs = $tabs_structed;
|
80 |
}
|
81 |
|
527 |
* ?>
|
528 |
*/
|
529 |
$args = apply_filters( 'um_account_tab_privacy_fields', $args, $shortcode_args );
|
530 |
+
|
531 |
$fields = UM()->builtin()->get_specific_fields( $args );
|
532 |
$fields = $this->account_secure_fields( $fields, $id );
|
533 |
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
|
535 |
foreach ( $fields as $key => $data ){
|
536 |
$output .= UM()->fields()->edit_field( $key, $data );
|
537 |
}
|
|
|
538 |
break;
|
539 |
|
540 |
case 'delete':
|
includes/core/class-builtin.php
CHANGED
@@ -1252,7 +1252,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
|
1252 |
*/
|
1253 |
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
|
1254 |
|
1255 |
-
if (
|
1256 |
$this->fields_dropdown = array('image','file','password','rating');
|
1257 |
$this->fields_dropdown = array_merge( $this->fields_dropdown, $fields_without_metakey );
|
1258 |
} else {
|
1252 |
*/
|
1253 |
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
|
1254 |
|
1255 |
+
if ( ! $show_all ) {
|
1256 |
$this->fields_dropdown = array('image','file','password','rating');
|
1257 |
$this->fields_dropdown = array_merge( $this->fields_dropdown, $fields_without_metakey );
|
1258 |
} else {
|
includes/core/class-enqueue.php
CHANGED
@@ -319,6 +319,8 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
|
319 |
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry') );
|
320 |
wp_enqueue_script('um_functions');
|
321 |
|
|
|
|
|
322 |
}
|
323 |
|
324 |
|
@@ -463,7 +465,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
|
463 |
wp_register_script('um_responsive', um_url . 'assets/js/um-responsive' . $this->suffix . '.js' );
|
464 |
wp_enqueue_script('um_responsive');
|
465 |
|
466 |
-
wp_register_style('um_responsive', um_url . 'assets/css/um-responsive.css' );
|
467 |
wp_enqueue_style('um_responsive');
|
468 |
|
469 |
}
|
319 |
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry') );
|
320 |
wp_enqueue_script('um_functions');
|
321 |
|
322 |
+
wp_enqueue_script( 'um-gdpr', um_url . 'assets/js/um-gdpr' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, false );
|
323 |
+
|
324 |
}
|
325 |
|
326 |
|
465 |
wp_register_script('um_responsive', um_url . 'assets/js/um-responsive' . $this->suffix . '.js' );
|
466 |
wp_enqueue_script('um_responsive');
|
467 |
|
468 |
+
wp_register_style('um_responsive', um_url . 'assets/css/um-responsive.css', array( 'um_profile' ) );
|
469 |
wp_enqueue_style('um_responsive');
|
470 |
|
471 |
}
|
includes/core/class-fields.php
CHANGED
@@ -43,9 +43,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
43 |
<div class="um-field um-field-c">
|
44 |
<div class="um-field-area">
|
45 |
<label class="um-field-checkbox active">
|
46 |
-
<input type="checkbox" name="<?php echo $id; ?>" value="1" checked
|
47 |
-
|
48 |
-
class="um-icon-android-checkbox-outline"></i></span>
|
49 |
<span class="um-field-checkbox-option"> <?php echo $title; ?></span>
|
50 |
</label>
|
51 |
</div>
|
@@ -574,7 +573,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
574 |
|
575 |
} elseif ( um_user( $key ) && $this->editing == true ) {
|
576 |
|
577 |
-
|
|
|
578 |
return '';
|
579 |
}
|
580 |
|
@@ -799,6 +799,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
799 |
return true;
|
800 |
}
|
801 |
|
|
|
|
|
|
|
|
|
|
|
802 |
if ( in_array( html_entity_decode( $value ), UM()->form()->post_form[ $key ] ) ) {
|
803 |
return true;
|
804 |
}
|
@@ -809,16 +814,21 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
809 |
|
810 |
$field_value = um_user( $key );
|
811 |
|
812 |
-
if ($key == 'role') {
|
813 |
|
814 |
$role_keys = get_option( 'um_roles' );
|
815 |
|
816 |
-
if (!empty( $role_keys )) {
|
817 |
-
if (in_array( $field_value, $role_keys )) {
|
818 |
$field_value = 'um_' . $field_value;
|
819 |
}
|
820 |
}
|
821 |
-
|
|
|
|
|
|
|
|
|
|
|
822 |
}
|
823 |
|
824 |
/**
|
@@ -931,19 +941,25 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
931 |
|
932 |
$um_user_value = um_user( $key );
|
933 |
|
934 |
-
if ($key == 'role') {
|
935 |
$um_user_value = strtolower( $um_user_value );
|
936 |
|
937 |
$role_keys = get_option( 'um_roles' );
|
938 |
|
939 |
-
if (!empty( $role_keys )) {
|
940 |
-
if (in_array( $um_user_value, $role_keys )) {
|
941 |
$um_user_value = 'um_' . $um_user_value;
|
942 |
}
|
943 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
944 |
}
|
945 |
|
946 |
-
if ($um_user_value == $value) {
|
947 |
return true;
|
948 |
}
|
949 |
|
@@ -1529,10 +1545,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
1529 |
* @param string $key
|
1530 |
* @param array $data
|
1531 |
* @param boolean $rule
|
|
|
1532 |
*
|
1533 |
* @return string
|
1534 |
*/
|
1535 |
-
function edit_field( $key, $data, $rule = false ) {
|
1536 |
global $_um_profile_id;
|
1537 |
$output = null;
|
1538 |
$disabled = '';
|
@@ -1566,7 +1583,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
1566 |
* @var boolean $required
|
1567 |
* @var string $validate
|
1568 |
* @var string $default
|
1569 |
-
|
1570 |
*/
|
1571 |
extract( $data );
|
1572 |
}
|
@@ -1578,7 +1595,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
1578 |
|
1579 |
if ($visibility == 'view' && $this->set_mode != 'register') return;
|
1580 |
|
1581 |
-
if (( $visibility == 'view' && $this->set_mode == 'register' ) ||
|
1582 |
( isset( $data['editable'] ) && $data['editable'] == 0 && $this->set_mode == 'profile' )
|
1583 |
) {
|
1584 |
|
@@ -1619,6 +1636,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
1619 |
// forbidden in edit mode?
|
1620 |
if (isset( $data['edit_forbidden'] )) return;
|
1621 |
|
|
|
1622 |
// required option
|
1623 |
if (isset( $data['required_opt'] )) {
|
1624 |
$opt = $data['required_opt'];
|
@@ -1662,7 +1680,47 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
1662 |
* ?>
|
1663 |
*/
|
1664 |
$type = apply_filters( "um_hook_for_field_{$type}", $type );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1665 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1666 |
/* Begin by field type */
|
1667 |
switch ( $type ) {
|
1668 |
|
@@ -1721,8 +1779,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
1721 |
|
1722 |
</div>';
|
1723 |
|
1724 |
-
|
1725 |
-
|
1726 |
}
|
1727 |
|
1728 |
if ($this->is_error( $key )) {
|
@@ -2032,8 +2090,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
2032 |
}
|
2033 |
|
2034 |
$output .= '<div class="um-field-area">';
|
2035 |
-
$field_name = $key;
|
2036 |
-
$field_value = $this->field_value( $key, $default, $data );
|
2037 |
|
2038 |
if (isset( $data['html'] ) && $data['html'] != 0 && $key != "description") {
|
2039 |
|
@@ -2084,16 +2140,17 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
2084 |
// add the contents of the buffer to the output variable
|
2085 |
$output .= ob_get_clean();
|
2086 |
|
2087 |
-
} else
|
|
|
|
|
2088 |
|
2089 |
-
$output .= '
|
2090 |
-
</div>';
|
2091 |
|
2092 |
-
if (!empty( $disabled )) {
|
2093 |
$output .= $this->disabled_hidden_field( $field_name, $field_value );
|
2094 |
}
|
2095 |
|
2096 |
-
if ($this->is_error( $key )) {
|
2097 |
$output .= $this->field_error( $this->show_error( $key ) );
|
2098 |
}
|
2099 |
|
@@ -2111,7 +2168,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
2111 |
$output .= '<div class="um-field-area">';
|
2112 |
|
2113 |
$output .= '<div class="um-rating um-raty" id="' . $key . '" data-key="' . $key . '" data-number="' . $data['number'] . '" data-score="' . $this->field_value( $key, $default, $data ) . '"></div>';
|
2114 |
-
|
2115 |
$output .= '</div>';
|
2116 |
|
2117 |
$output .= '</div>';
|
@@ -2313,8 +2369,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
2313 |
/* Select dropdown */
|
2314 |
case 'select':
|
2315 |
|
2316 |
-
$form_key = str_replace( 'role_select', 'role', $key );
|
2317 |
-
|
2318 |
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '">';
|
2319 |
|
2320 |
|
@@ -2434,10 +2488,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
2434 |
}
|
2435 |
|
2436 |
if( ! empty( $placeholder ) ) {
|
2437 |
-
|
2438 |
-
|
2439 |
|
2440 |
-
$output .= '<select ' . $disabled . ' ' . $select_original_option_value . ' ' . $disabled_by_parent_option . ' name="' . $form_key . '" id="' . $
|
2441 |
|
2442 |
/**
|
2443 |
* UM hook
|
@@ -2631,7 +2685,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
2631 |
$output .= '<div class="um-field-icon"><i class="' . $icon . '"></i></div>';
|
2632 |
}
|
2633 |
|
2634 |
-
$output .= '<select ' . $disabled . ' multiple="multiple" name="' . $
|
2635 |
|
2636 |
|
2637 |
if ( isset( $options ) && $options == 'builtin' ) {
|
@@ -2768,8 +2822,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
2768 |
/* Radio */
|
2769 |
case 'radio':
|
2770 |
|
2771 |
-
$form_key = str_replace( 'role_radio', 'role', $key );
|
2772 |
-
|
2773 |
if ( isset( $options ) ) {
|
2774 |
/**
|
2775 |
* UM hook
|
@@ -2838,7 +2890,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
2838 |
$um_field_checkbox_item_title = $v;
|
2839 |
$option_value = $v;
|
2840 |
|
2841 |
-
if (!is_numeric( $k ) && in_array( $form_key, array( 'role' ) )) {
|
2842 |
$um_field_checkbox_item_title = $v;
|
2843 |
$option_value = $k;
|
2844 |
}
|
@@ -3432,9 +3484,12 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
|
3432 |
|
3433 |
if (isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group') return;
|
3434 |
|
3435 |
-
if ($visibility == 'edit') return;
|
|
|
|
|
|
|
3436 |
|
3437 |
-
if (in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) )) {
|
3438 |
|
3439 |
} else {
|
3440 |
|
43 |
<div class="um-field um-field-c">
|
44 |
<div class="um-field-area">
|
45 |
<label class="um-field-checkbox active">
|
46 |
+
<input type="checkbox" name="<?php echo $id; ?>" value="1" checked/>
|
47 |
+
<span class="um-field-checkbox-state"><i class="um-icon-android-checkbox-outline"></i></span>
|
|
|
48 |
<span class="um-field-checkbox-option"> <?php echo $title; ?></span>
|
49 |
</label>
|
50 |
</div>
|
573 |
|
574 |
} elseif ( um_user( $key ) && $this->editing == true ) {
|
575 |
|
576 |
+
//show empty value for password fields
|
577 |
+
if ( strstr( $key, 'user_pass' ) || $type == 'password' ) {
|
578 |
return '';
|
579 |
}
|
580 |
|
799 |
return true;
|
800 |
}
|
801 |
|
802 |
+
$stripslashed = array_map( 'stripslashes', UM()->form()->post_form[ $key ] );
|
803 |
+
if ( in_array( $value, $stripslashed ) ) {
|
804 |
+
return true;
|
805 |
+
}
|
806 |
+
|
807 |
if ( in_array( html_entity_decode( $value ), UM()->form()->post_form[ $key ] ) ) {
|
808 |
return true;
|
809 |
}
|
814 |
|
815 |
$field_value = um_user( $key );
|
816 |
|
817 |
+
if ( $key == 'role' ) {
|
818 |
|
819 |
$role_keys = get_option( 'um_roles' );
|
820 |
|
821 |
+
if ( ! empty( $role_keys ) ) {
|
822 |
+
if ( in_array( $field_value, $role_keys ) ) {
|
823 |
$field_value = 'um_' . $field_value;
|
824 |
}
|
825 |
}
|
826 |
+
/*elseif( $this->set_mode == 'register' ){
|
827 |
+
$data['default'] = UM()->options()->get( 'register_role' );
|
828 |
+
}
|
829 |
+
else{
|
830 |
+
$data['default'] = get_option( 'default_role' );
|
831 |
+
}*/
|
832 |
}
|
833 |
|
834 |
/**
|
941 |
|
942 |
$um_user_value = um_user( $key );
|
943 |
|
944 |
+
if ( $key == 'role' ) {
|
945 |
$um_user_value = strtolower( $um_user_value );
|
946 |
|
947 |
$role_keys = get_option( 'um_roles' );
|
948 |
|
949 |
+
if ( ! empty( $role_keys ) ) {
|
950 |
+
if ( in_array( $um_user_value, $role_keys ) ) {
|
951 |
$um_user_value = 'um_' . $um_user_value;
|
952 |
}
|
953 |
}
|
954 |
+
/*elseif( $this->set_mode == 'register' ){
|
955 |
+
$data['default'] = UM()->options()->get( 'register_role' );
|
956 |
+
}
|
957 |
+
else{
|
958 |
+
$data['default'] = get_option( 'default_role' );
|
959 |
+
}*/
|
960 |
}
|
961 |
|
962 |
+
if ( $um_user_value == $value ) {
|
963 |
return true;
|
964 |
}
|
965 |
|
1545 |
* @param string $key
|
1546 |
* @param array $data
|
1547 |
* @param boolean $rule
|
1548 |
+
* @param array $args
|
1549 |
*
|
1550 |
* @return string
|
1551 |
*/
|
1552 |
+
function edit_field( $key, $data, $rule = false, $args = array() ) {
|
1553 |
global $_um_profile_id;
|
1554 |
$output = null;
|
1555 |
$disabled = '';
|
1583 |
* @var boolean $required
|
1584 |
* @var string $validate
|
1585 |
* @var string $default
|
1586 |
+
* @var string $conditional
|
1587 |
*/
|
1588 |
extract( $data );
|
1589 |
}
|
1595 |
|
1596 |
if ($visibility == 'view' && $this->set_mode != 'register') return;
|
1597 |
|
1598 |
+
if ( ( $visibility == 'view' && $this->set_mode == 'register' ) ||
|
1599 |
( isset( $data['editable'] ) && $data['editable'] == 0 && $this->set_mode == 'profile' )
|
1600 |
) {
|
1601 |
|
1636 |
// forbidden in edit mode?
|
1637 |
if (isset( $data['edit_forbidden'] )) return;
|
1638 |
|
1639 |
+
|
1640 |
// required option
|
1641 |
if (isset( $data['required_opt'] )) {
|
1642 |
$opt = $data['required_opt'];
|
1680 |
* ?>
|
1681 |
*/
|
1682 |
$type = apply_filters( "um_hook_for_field_{$type}", $type );
|
1683 |
+
switch ( $type ) {
|
1684 |
+
|
1685 |
+
case 'textarea':
|
1686 |
+
case 'multiselect':
|
1687 |
+
$field_id = $field_name = $key;
|
1688 |
+
$field_value = $this->field_value( $key, $default, $data );
|
1689 |
+
break;
|
1690 |
|
1691 |
+
case 'select':
|
1692 |
+
case 'radio':
|
1693 |
+
$form_key = str_replace( 'role_select', 'role', $key );
|
1694 |
+
$field_id = $form_key;
|
1695 |
+
break;
|
1696 |
+
default:
|
1697 |
+
$field_id = '';
|
1698 |
+
break;
|
1699 |
+
}
|
1700 |
+
|
1701 |
+
/**
|
1702 |
+
* UM hook
|
1703 |
+
*
|
1704 |
+
* @type filter
|
1705 |
+
* @title um_completeness_field_id
|
1706 |
+
* @description use for change core id not allowed duplicate
|
1707 |
+
* @input_vars
|
1708 |
+
* [{"var":"$field_id","type":"string","desc":"Field id"},
|
1709 |
+
* {"var":"$data","type":"array","desc":"Field Data"}]
|
1710 |
+
* {"var":"$args","type":"array","desc":"Optional field arguments"}]
|
1711 |
+
* @change_log
|
1712 |
+
* ["Since: 2.0.13"]
|
1713 |
+
* @usage add_filter( 'um_completeness_field_id', 'function_name', 10, 3 );
|
1714 |
+
* @example
|
1715 |
+
* <?php
|
1716 |
+
* add_filter( 'um_completeness_field_id', 'function_name', 10, 3 );
|
1717 |
+
* function function_name( $field_id, $data, $args ) {
|
1718 |
+
* // your code here
|
1719 |
+
* return $field_id;
|
1720 |
+
* }
|
1721 |
+
* ?>
|
1722 |
+
*/
|
1723 |
+
$field_id = apply_filters( 'um_completeness_field_id', $field_id, $data, $args );
|
1724 |
/* Begin by field type */
|
1725 |
switch ( $type ) {
|
1726 |
|
1779 |
|
1780 |
</div>';
|
1781 |
|
1782 |
+
if (!empty( $disabled )) {
|
1783 |
+
$output .= $this->disabled_hidden_field( $field_name, $field_value );
|
1784 |
}
|
1785 |
|
1786 |
if ($this->is_error( $key )) {
|
2090 |
}
|
2091 |
|
2092 |
$output .= '<div class="um-field-area">';
|
|
|
|
|
2093 |
|
2094 |
if (isset( $data['html'] ) && $data['html'] != 0 && $key != "description") {
|
2095 |
|
2140 |
// add the contents of the buffer to the output variable
|
2141 |
$output .= ob_get_clean();
|
2142 |
|
2143 |
+
} else {
|
2144 |
+
$output .= '<textarea ' . $disabled . ' style="height: ' . $height . ';" class="' . $this->get_class( $key, $data ) . '" name="' . $field_name . '" id="' . $field_id . '" placeholder="' . $placeholder . '">' . $field_value . '</textarea>';
|
2145 |
+
}
|
2146 |
|
2147 |
+
$output .= '</div>';
|
|
|
2148 |
|
2149 |
+
if ( ! empty( $disabled ) ) {
|
2150 |
$output .= $this->disabled_hidden_field( $field_name, $field_value );
|
2151 |
}
|
2152 |
|
2153 |
+
if ( $this->is_error( $key ) ) {
|
2154 |
$output .= $this->field_error( $this->show_error( $key ) );
|
2155 |
}
|
2156 |
|
2168 |
$output .= '<div class="um-field-area">';
|
2169 |
|
2170 |
$output .= '<div class="um-rating um-raty" id="' . $key . '" data-key="' . $key . '" data-number="' . $data['number'] . '" data-score="' . $this->field_value( $key, $default, $data ) . '"></div>';
|
|
|
2171 |
$output .= '</div>';
|
2172 |
|
2173 |
$output .= '</div>';
|
2369 |
/* Select dropdown */
|
2370 |
case 'select':
|
2371 |
|
|
|
|
|
2372 |
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '">';
|
2373 |
|
2374 |
|
2488 |
}
|
2489 |
|
2490 |
if( ! empty( $placeholder ) ) {
|
2491 |
+
$placeholder = strip_tags( $placeholder );
|
2492 |
+
}
|
2493 |
|
2494 |
+
$output .= '<select ' . $disabled . ' ' . $select_original_option_value . ' ' . $disabled_by_parent_option . ' name="' . $form_key . '" id="' . $field_id . '" data-validate="' . $validate . '" data-key="' . $key . '" class="' . $this->get_class( $key, $data, $class ) . '" style="width: 100%" data-placeholder="' . $placeholder . '" ' . $atts_ajax . '>';
|
2495 |
|
2496 |
/**
|
2497 |
* UM hook
|
2685 |
$output .= '<div class="um-field-icon"><i class="' . $icon . '"></i></div>';
|
2686 |
}
|
2687 |
|
2688 |
+
$output .= '<select ' . $disabled . ' multiple="multiple" name="' . $field_name . '[]" id="' . $field_id . '" data-maxsize="' . $max_selections . '" data-validate="' . $validate . '" data-key="' . $key . '" class="' . $this->get_class( $key, $data, $class ) . ' um-user-keyword_' . $use_keyword . '" style="width: 100%" data-placeholder="' . $placeholder . '">';
|
2689 |
|
2690 |
|
2691 |
if ( isset( $options ) && $options == 'builtin' ) {
|
2822 |
/* Radio */
|
2823 |
case 'radio':
|
2824 |
|
|
|
|
|
2825 |
if ( isset( $options ) ) {
|
2826 |
/**
|
2827 |
* UM hook
|
2890 |
$um_field_checkbox_item_title = $v;
|
2891 |
$option_value = $v;
|
2892 |
|
2893 |
+
if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role', 'role_radio' ) ) ) {
|
2894 |
$um_field_checkbox_item_title = $v;
|
2895 |
$option_value = $k;
|
2896 |
}
|
3484 |
|
3485 |
if (isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group') return;
|
3486 |
|
3487 |
+
if ( $visibility == 'edit' ) return;
|
3488 |
+
|
3489 |
+
//invisible on profile page
|
3490 |
+
if ( $type == 'password' ) return;
|
3491 |
|
3492 |
+
if ( in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) ) ) {
|
3493 |
|
3494 |
} else {
|
3495 |
|
includes/core/class-form.php
CHANGED
@@ -331,19 +331,6 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
|
331 |
wp_die( 'Hello, spam bot!', 'ultimate-member' );
|
332 |
}
|
333 |
|
334 |
-
if ( ! in_array( $this->form_data['mode'], array( 'login' ) ) ) {
|
335 |
-
|
336 |
-
$form_timestamp = trim($_POST['timestamp']);
|
337 |
-
$live_timestamp = current_time( 'timestamp' );
|
338 |
-
|
339 |
-
if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
|
340 |
-
wp_die( __('Hello, spam bot!','ultimate-member') );
|
341 |
-
|
342 |
-
if ( !current_user_can('manage_options') && $live_timestamp - $form_timestamp < 6 && UM()->options()->get( 'enable_timebot' ) == 1 )
|
343 |
-
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!','ultimate-member') );
|
344 |
-
|
345 |
-
}
|
346 |
-
|
347 |
/**
|
348 |
* UM hook
|
349 |
*
|
@@ -478,8 +465,9 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
|
478 |
$global_role = get_option( 'default_role' ); // WP Global settings
|
479 |
|
480 |
$um_global_role = UM()->options()->get( 'register_role' ); // UM Settings Global settings
|
481 |
-
if ( ! empty( $um_global_role ) )
|
482 |
$global_role = $um_global_role; // Form Global settings
|
|
|
483 |
|
484 |
|
485 |
$mode = $this->form_type( $post_id );
|
331 |
wp_die( 'Hello, spam bot!', 'ultimate-member' );
|
332 |
}
|
333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
/**
|
335 |
* UM hook
|
336 |
*
|
465 |
$global_role = get_option( 'default_role' ); // WP Global settings
|
466 |
|
467 |
$um_global_role = UM()->options()->get( 'register_role' ); // UM Settings Global settings
|
468 |
+
if ( ! empty( $um_global_role ) ) {
|
469 |
$global_role = $um_global_role; // Form Global settings
|
470 |
+
}
|
471 |
|
472 |
|
473 |
$mode = $this->form_type( $post_id );
|
includes/core/class-gdpr.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace um\core;
|
3 |
+
|
4 |
+
// Exit if accessed directly.
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
+
|
7 |
+
|
8 |
+
if ( ! class_exists( 'um\core\GDPR' ) ) {
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Admin_GDPR
|
13 |
+
* @package um\core
|
14 |
+
*/
|
15 |
+
class GDPR {
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Admin_GDPR constructor.
|
20 |
+
*/
|
21 |
+
function __construct() {
|
22 |
+
add_action( 'um_submit_form_register', array( &$this, 'agreement_validation' ), 9 );
|
23 |
+
|
24 |
+
add_filter( 'um_before_save_filter_submitted', array( &$this, 'add_agreement_date' ), 10, 1 );
|
25 |
+
add_filter( 'um_email_registration_data', array( &$this, 'email_registration_data' ), 10, 1 );
|
26 |
+
|
27 |
+
add_action( 'um_after_form_fields', array( &$this, 'display_option' ) );
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param $args
|
33 |
+
*/
|
34 |
+
function display_option( $args ) {
|
35 |
+
if ( isset( $args['use_gdpr'] ) && $args['use_gdpr'] == 1 ) {
|
36 |
+
require um_path . 'templates/gdpr-register.php';
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param $args
|
43 |
+
*/
|
44 |
+
function agreement_validation( $args ) {
|
45 |
+
$gdpr_enabled = get_post_meta( $args['form_id'], '_um_register_use_gdpr', true );
|
46 |
+
|
47 |
+
if ( $gdpr_enabled && ! isset( $args['submitted']['use_gdpr_agreement'] ) ) {
|
48 |
+
UM()->form()->add_error( 'use_gdpr_agreement', isset( $args['use_gdpr_error_text'] ) ? $args['use_gdpr_error_text'] : '' );
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @param $submitted
|
55 |
+
*
|
56 |
+
* @return mixed
|
57 |
+
*/
|
58 |
+
function add_agreement_date( $submitted ) {
|
59 |
+
if ( isset( $submitted['use_gdpr_agreement'] ) ) {
|
60 |
+
$submitted['use_gdpr_agreement'] = time();
|
61 |
+
}
|
62 |
+
|
63 |
+
return $submitted;
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @param $submitted
|
69 |
+
*
|
70 |
+
* @return mixed
|
71 |
+
*/
|
72 |
+
function email_registration_data( $submitted ) {
|
73 |
+
|
74 |
+
$timestamp = ! empty( $submitted['timestamp'] ) ? $submitted['timestamp'] : $submitted['use_gdpr_agreement'];
|
75 |
+
|
76 |
+
if ( ! empty( $submitted['use_gdpr_agreement'] ) ) {
|
77 |
+
$submitted['GDPR Applied'] = date( "d M Y H:i", $timestamp );
|
78 |
+
unset( $submitted['use_gdpr_agreement'] );
|
79 |
+
}
|
80 |
+
|
81 |
+
return $submitted;
|
82 |
+
}
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
}
|
includes/core/class-mail.php
CHANGED
@@ -124,10 +124,14 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
|
124 |
|
125 |
$this->message = $this->prepare_template( $template, $args );
|
126 |
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
128 |
// Send mail
|
129 |
wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
|
130 |
-
remove_filter( 'wp_mail_content_type', array( &$this, 'set_content_type' ) );
|
131 |
}
|
132 |
|
133 |
|
@@ -481,22 +485,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
|
481 |
}
|
482 |
|
483 |
|
484 |
-
/**
|
485 |
-
* Set email content type
|
486 |
-
*
|
487 |
-
*
|
488 |
-
* @param $content_type
|
489 |
-
* @return string
|
490 |
-
*/
|
491 |
-
function set_content_type( $content_type ) {
|
492 |
-
if ( UM()->options()->get( 'email_html' ) ) {
|
493 |
-
return 'text/html';
|
494 |
-
} else {
|
495 |
-
return 'text/plain';
|
496 |
-
}
|
497 |
-
}
|
498 |
-
|
499 |
-
|
500 |
/**
|
501 |
* Ajax copy template to the theme
|
502 |
*
|
124 |
|
125 |
$this->message = $this->prepare_template( $template, $args );
|
126 |
|
127 |
+
if ( UM()->options()->get( 'email_html' ) ) {
|
128 |
+
$this->headers .= "Content-Type: text/html\r\n";
|
129 |
+
} else {
|
130 |
+
$this->headers .= "Content-Type: text/plain\r\n";
|
131 |
+
}
|
132 |
+
|
133 |
// Send mail
|
134 |
wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
|
|
|
135 |
}
|
136 |
|
137 |
|
485 |
}
|
486 |
|
487 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
/**
|
489 |
* Ajax copy template to the theme
|
490 |
*
|
includes/core/class-permalinks.php
CHANGED
@@ -136,22 +136,15 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
|
136 |
$um_port_forwarding_url = UM()->options()->get( 'um_port_forwarding_url' );
|
137 |
$um_port_forwarding_url = ! empty( $um_port_forwarding_url ) ? $um_port_forwarding_url : '';
|
138 |
|
|
|
139 |
if ( is_multisite() ) {
|
140 |
-
|
141 |
-
$page_url = '';
|
142 |
$blog_id = get_current_blog_id();
|
143 |
$siteurl = get_site_url( $blog_id );
|
144 |
|
145 |
$network_permalink_structure = UM()->options()->get( 'network_permalink_structure' );
|
146 |
|
147 |
if( $network_permalink_structure == "sub-directory" ){
|
148 |
-
|
149 |
-
$page_url = 'https';
|
150 |
-
} else {
|
151 |
-
$page_url = 'http';
|
152 |
-
}
|
153 |
-
$page_url .= "://";
|
154 |
-
|
155 |
$page_url .= $_SERVER[ $server_name_method ];
|
156 |
}else{
|
157 |
$page_url .= $siteurl;
|
@@ -159,7 +152,6 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
|
159 |
|
160 |
if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
|
161 |
$page_url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
162 |
-
|
163 |
} else {
|
164 |
$page_url .= $_SERVER["REQUEST_URI"];
|
165 |
}
|
@@ -168,13 +160,7 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
|
168 |
if ( !isset( $_SERVER['SERVER_NAME'] ) )
|
169 |
return '';
|
170 |
|
171 |
-
|
172 |
-
if ( is_ssl() ) {
|
173 |
-
$page_url = 'https';
|
174 |
-
} else {
|
175 |
-
$page_url = 'http';
|
176 |
-
}
|
177 |
-
$page_url .= "://";
|
178 |
|
179 |
if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
|
180 |
$page_url .= $_SERVER[ $server_name_method ].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
@@ -210,7 +196,7 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
|
210 |
* }
|
211 |
* ?>
|
212 |
*/
|
213 |
-
return apply_filters( 'um_get_current_page_url', $page_url );
|
214 |
}
|
215 |
|
216 |
|
136 |
$um_port_forwarding_url = UM()->options()->get( 'um_port_forwarding_url' );
|
137 |
$um_port_forwarding_url = ! empty( $um_port_forwarding_url ) ? $um_port_forwarding_url : '';
|
138 |
|
139 |
+
$page_url = '';
|
140 |
if ( is_multisite() ) {
|
|
|
|
|
141 |
$blog_id = get_current_blog_id();
|
142 |
$siteurl = get_site_url( $blog_id );
|
143 |
|
144 |
$network_permalink_structure = UM()->options()->get( 'network_permalink_structure' );
|
145 |
|
146 |
if( $network_permalink_structure == "sub-directory" ){
|
147 |
+
$page_url .= "//";
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
$page_url .= $_SERVER[ $server_name_method ];
|
149 |
}else{
|
150 |
$page_url .= $siteurl;
|
152 |
|
153 |
if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
|
154 |
$page_url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
|
|
155 |
} else {
|
156 |
$page_url .= $_SERVER["REQUEST_URI"];
|
157 |
}
|
160 |
if ( !isset( $_SERVER['SERVER_NAME'] ) )
|
161 |
return '';
|
162 |
|
163 |
+
$page_url .= "//";
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
|
166 |
$page_url .= $_SERVER[ $server_name_method ].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
196 |
* }
|
197 |
* ?>
|
198 |
*/
|
199 |
+
return apply_filters( 'um_get_current_page_url', set_url_scheme( $page_url ) );
|
200 |
}
|
201 |
|
202 |
|
includes/core/class-profile.php
CHANGED
@@ -118,11 +118,18 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
|
118 |
|
119 |
// disable private tabs
|
120 |
if ( ! is_admin() ) {
|
|
|
|
|
|
|
|
|
121 |
foreach ( $tabs as $id => $tab ) {
|
122 |
if ( ! $this->can_view_tab( $id ) ) {
|
123 |
unset( $tabs[$id] );
|
124 |
}
|
125 |
}
|
|
|
|
|
|
|
126 |
}
|
127 |
|
128 |
return $tabs;
|
118 |
|
119 |
// disable private tabs
|
120 |
if ( ! is_admin() ) {
|
121 |
+
if( is_user_logged_in() ) {
|
122 |
+
$user_id = um_user('ID');
|
123 |
+
um_fetch_user( get_current_user_id() );
|
124 |
+
}
|
125 |
foreach ( $tabs as $id => $tab ) {
|
126 |
if ( ! $this->can_view_tab( $id ) ) {
|
127 |
unset( $tabs[$id] );
|
128 |
}
|
129 |
}
|
130 |
+
if( is_user_logged_in() ) {
|
131 |
+
um_fetch_user( $user_id );
|
132 |
+
}
|
133 |
}
|
134 |
|
135 |
return $tabs;
|
includes/core/class-rest-api.php
CHANGED
@@ -524,9 +524,9 @@ if ( ! class_exists( 'um\core\REST_API' ) ) {
|
|
524 |
$val->first_name = um_user('first_name');
|
525 |
$val->last_name = um_user('last_name');
|
526 |
$val->account_status = um_user('account_status');
|
527 |
-
$val->profile_pic_original =
|
528 |
-
$val->profile_pic_normal =
|
529 |
-
$val->profile_pic_small =
|
530 |
$val->cover_photo = $this->getsrc( um_user('cover_photo', 1000) );
|
531 |
|
532 |
/**
|
@@ -667,9 +667,9 @@ if ( ! class_exists( 'um\core\REST_API' ) ) {
|
|
667 |
break;
|
668 |
|
669 |
case 'profile_pic':
|
670 |
-
$response['profile_pic_original'] =
|
671 |
-
$response['profile_pic_normal'] =
|
672 |
-
$response['profile_pic_small'] =
|
673 |
break;
|
674 |
|
675 |
case 'status':
|
@@ -699,9 +699,9 @@ if ( ! class_exists( 'um\core\REST_API' ) ) {
|
|
699 |
$val->first_name = um_user('first_name');
|
700 |
$val->last_name = um_user('last_name');
|
701 |
$val->account_status = um_user('account_status');
|
702 |
-
$val->profile_pic_original =
|
703 |
-
$val->profile_pic_normal =
|
704 |
-
$val->profile_pic_small =
|
705 |
$val->cover_photo = $this->getsrc( um_user('cover_photo', 1000) );
|
706 |
|
707 |
/**
|
524 |
$val->first_name = um_user('first_name');
|
525 |
$val->last_name = um_user('last_name');
|
526 |
$val->account_status = um_user('account_status');
|
527 |
+
$val->profile_pic_original = um_get_user_avatar_url('', 'original');
|
528 |
+
$val->profile_pic_normal = um_get_user_avatar_url('', 200);
|
529 |
+
$val->profile_pic_small = um_get_user_avatar_url('', 40);
|
530 |
$val->cover_photo = $this->getsrc( um_user('cover_photo', 1000) );
|
531 |
|
532 |
/**
|
667 |
break;
|
668 |
|
669 |
case 'profile_pic':
|
670 |
+
$response['profile_pic_original'] = um_get_user_avatar_url('', 'original');
|
671 |
+
$response['profile_pic_normal'] = um_get_user_avatar_url('', 200);
|
672 |
+
$response['profile_pic_small'] = um_get_user_avatar_url('', 40);
|
673 |
break;
|
674 |
|
675 |
case 'status':
|
699 |
$val->first_name = um_user('first_name');
|
700 |
$val->last_name = um_user('last_name');
|
701 |
$val->account_status = um_user('account_status');
|
702 |
+
$val->profile_pic_original = um_get_user_avatar_url('', 'original');
|
703 |
+
$val->profile_pic_normal = um_get_user_avatar_url('', 200);
|
704 |
+
$val->profile_pic_small = um_get_user_avatar_url('', 40);
|
705 |
$val->cover_photo = $this->getsrc( um_user('cover_photo', 1000) );
|
706 |
|
707 |
/**
|
includes/core/class-rewrite.php
CHANGED
@@ -18,16 +18,14 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
|
18 |
* Rewrite constructor.
|
19 |
*/
|
20 |
function __construct() {
|
|
|
21 |
add_filter( 'query_vars', array(&$this, 'query_vars'), 10, 1 );
|
22 |
-
|
23 |
add_action( 'init', array( &$this, 'rewrite_rules'), 100000000 );
|
24 |
|
25 |
-
add_action( 'template_redirect', array( &$this, 'redirect_author_page'), 9999 );
|
26 |
|
|
|
27 |
add_action( 'template_redirect', array( &$this, 'locate_user_profile'), 9999 );
|
28 |
-
|
29 |
-
//add rewrite rules
|
30 |
-
add_filter( 'rewrite_rules_array', array( &$this, '_add_rewrite_rules' ), 10, 1 );
|
31 |
}
|
32 |
|
33 |
|
@@ -66,35 +64,23 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
|
66 |
|
67 |
$newrules['um-api/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?um_page=api&um_action=$matches[1]&um_resource=$matches[2]&um_method=$matches[3]&um_verify=$matches[4]';
|
68 |
|
69 |
-
return $newrules + $rules;
|
70 |
-
}
|
71 |
-
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Setup rewrite rules
|
75 |
-
*/
|
76 |
-
function rewrite_rules() {
|
77 |
-
|
78 |
if ( isset( UM()->config()->permalinks['user'] ) ) {
|
79 |
|
80 |
$user_page_id = UM()->config()->permalinks['user'];
|
81 |
-
$
|
82 |
-
$user = get_post($user_page_id);
|
83 |
|
84 |
if ( isset( $user->post_name ) ) {
|
85 |
|
86 |
$user_slug = $user->post_name;
|
87 |
-
$account = get_post($account_page_id);
|
88 |
-
$account_slug = $account->post_name;
|
89 |
|
90 |
$add_lang_code = '';
|
91 |
$language_code = '';
|
92 |
|
93 |
-
if ( function_exists('icl_object_id') || function_exists('icl_get_current_language')
|
94 |
|
95 |
-
if( function_exists('icl_get_current_language') ){
|
96 |
$language_code = icl_get_current_language();
|
97 |
-
}
|
98 |
$language_code = ICL_LANGUAGE_CODE;
|
99 |
}
|
100 |
|
@@ -105,53 +91,89 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
|
105 |
$user_slug = $lang_post_obj->post_name;
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
// Account page translated slug
|
109 |
$lang_post_id = icl_object_id( $account->ID, 'post', FALSE, $language_code );
|
110 |
$lang_post_obj = get_post( $lang_post_id );
|
111 |
-
if( isset( $lang_post_obj->post_name ) ){
|
112 |
$account_slug = $lang_post_obj->post_name;
|
113 |
}
|
114 |
|
115 |
-
if(
|
116 |
$add_lang_code = $language_code;
|
117 |
}
|
118 |
|
119 |
}
|
120 |
|
121 |
-
|
122 |
-
'index.php?page_id='.$user_page_id.'&um_user=$matches[1]&lang='.$add_lang_code,
|
123 |
-
'top'
|
124 |
-
);
|
125 |
|
126 |
-
|
127 |
-
'index.php?page_id='.$account_page_id.'&um_tab=$matches[1]&lang='.$add_lang_code,
|
128 |
-
'top'
|
129 |
-
);
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
* @usage
|
142 |
-
* <?php add_filter( 'um_rewrite_flush_rewrite_rules', 'function_name', 10, 1 ); ?>
|
143 |
-
* @example
|
144 |
-
* <?php
|
145 |
-
* add_filter( 'um_rewrite_flush_rewrite_rules', 'my_rewrite_flush_rewrite_rules', 10, 1 );
|
146 |
-
* function my_rewrite_flush_rewrite_rules( $stop_flush ) {
|
147 |
-
* // your code here
|
148 |
-
* return $stop_flush;
|
149 |
-
* }
|
150 |
-
* ?>
|
151 |
-
*/
|
152 |
-
if ( ! apply_filters( 'um_rewrite_flush_rewrite_rules', UM()->options()->get( 'um_flush_stop' ) ) )
|
153 |
-
flush_rewrite_rules( true );
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
}
|
156 |
|
157 |
}
|
18 |
* Rewrite constructor.
|
19 |
*/
|
20 |
function __construct() {
|
21 |
+
//add rewrite rules
|
22 |
add_filter( 'query_vars', array(&$this, 'query_vars'), 10, 1 );
|
23 |
+
add_filter( 'rewrite_rules_array', array( &$this, '_add_rewrite_rules' ), 10, 1 );
|
24 |
add_action( 'init', array( &$this, 'rewrite_rules'), 100000000 );
|
25 |
|
|
|
26 |
|
27 |
+
add_action( 'template_redirect', array( &$this, 'redirect_author_page'), 9999 );
|
28 |
add_action( 'template_redirect', array( &$this, 'locate_user_profile'), 9999 );
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
|
64 |
|
65 |
$newrules['um-api/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?um_page=api&um_action=$matches[1]&um_resource=$matches[2]&um_method=$matches[3]&um_verify=$matches[4]';
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
if ( isset( UM()->config()->permalinks['user'] ) ) {
|
68 |
|
69 |
$user_page_id = UM()->config()->permalinks['user'];
|
70 |
+
$user = get_post( $user_page_id );
|
|
|
71 |
|
72 |
if ( isset( $user->post_name ) ) {
|
73 |
|
74 |
$user_slug = $user->post_name;
|
|
|
|
|
75 |
|
76 |
$add_lang_code = '';
|
77 |
$language_code = '';
|
78 |
|
79 |
+
if ( function_exists('icl_object_id') || function_exists('icl_get_current_language') ) {
|
80 |
|
81 |
+
if ( function_exists('icl_get_current_language') ) {
|
82 |
$language_code = icl_get_current_language();
|
83 |
+
} elseif( function_exists('icl_object_id') && defined('ICL_LANGUAGE_CODE') ) {
|
84 |
$language_code = ICL_LANGUAGE_CODE;
|
85 |
}
|
86 |
|
91 |
$user_slug = $lang_post_obj->post_name;
|
92 |
}
|
93 |
|
94 |
+
if( $language_code != icl_get_default_language() ){
|
95 |
+
$add_lang_code = $language_code;
|
96 |
+
}
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
$newrules[ $user_slug.'/([^/]+)/?$' ] = 'index.php?page_id='.$user_page_id.'&um_user=$matches[1]&lang='.$add_lang_code;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( isset( UM()->config()->permalinks['account'] ) ) {
|
105 |
+
|
106 |
+
$account_page_id = UM()->config()->permalinks['account'];
|
107 |
+
$account = get_post( $account_page_id );
|
108 |
+
|
109 |
+
if ( isset( $account->post_name ) ) {
|
110 |
+
|
111 |
+
$account_slug = $account->post_name;
|
112 |
+
|
113 |
+
$add_lang_code = '';
|
114 |
+
$language_code = '';
|
115 |
+
|
116 |
+
if ( function_exists('icl_object_id') || function_exists('icl_get_current_language') ) {
|
117 |
+
|
118 |
+
if ( function_exists('icl_get_current_language') ){
|
119 |
+
$language_code = icl_get_current_language();
|
120 |
+
} elseif( function_exists('icl_object_id') && defined('ICL_LANGUAGE_CODE') ) {
|
121 |
+
$language_code = ICL_LANGUAGE_CODE;
|
122 |
+
}
|
123 |
+
|
124 |
// Account page translated slug
|
125 |
$lang_post_id = icl_object_id( $account->ID, 'post', FALSE, $language_code );
|
126 |
$lang_post_obj = get_post( $lang_post_id );
|
127 |
+
if ( isset( $lang_post_obj->post_name ) ){
|
128 |
$account_slug = $lang_post_obj->post_name;
|
129 |
}
|
130 |
|
131 |
+
if ( $language_code != icl_get_default_language() ) {
|
132 |
$add_lang_code = $language_code;
|
133 |
}
|
134 |
|
135 |
}
|
136 |
|
137 |
+
$newrules[ $account_slug.'/([^/]+)?$' ] = 'index.php?page_id='.$account_page_id.'&um_tab=$matches[1]&lang='.$add_lang_code;
|
|
|
|
|
|
|
138 |
|
139 |
+
}
|
|
|
|
|
|
|
140 |
|
141 |
+
}
|
142 |
+
|
143 |
+
return $newrules + $rules;
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Setup rewrite rules
|
149 |
+
*/
|
150 |
+
function rewrite_rules() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
if ( isset( UM()->config()->permalinks['user'] ) && isset( UM()->config()->permalinks['account'] ) ) {
|
153 |
+
|
154 |
+
/**
|
155 |
+
* UM hook
|
156 |
+
*
|
157 |
+
* @type filter
|
158 |
+
* @title um_rewrite_flush_rewrite_rules
|
159 |
+
* @description Enable flushing rewrite rules
|
160 |
+
* @input_vars
|
161 |
+
* [{"var":"$stop_flush","type":"bool","desc":"Stop flushing rewrite rules"}]
|
162 |
+
* @change_log
|
163 |
+
* ["Since: 2.0"]
|
164 |
+
* @usage
|
165 |
+
* <?php add_filter( 'um_rewrite_flush_rewrite_rules', 'function_name', 10, 1 ); ?>
|
166 |
+
* @example
|
167 |
+
* <?php
|
168 |
+
* add_filter( 'um_rewrite_flush_rewrite_rules', 'my_rewrite_flush_rewrite_rules', 10, 1 );
|
169 |
+
* function my_rewrite_flush_rewrite_rules( $stop_flush ) {
|
170 |
+
* // your code here
|
171 |
+
* return $stop_flush;
|
172 |
+
* }
|
173 |
+
* ?>
|
174 |
+
*/
|
175 |
+
if ( ! apply_filters( 'um_rewrite_flush_rewrite_rules', UM()->options()->get( 'um_flush_stop' ) ) ) {
|
176 |
+
flush_rewrite_rules( true );
|
177 |
}
|
178 |
|
179 |
}
|
includes/core/class-roles-capabilities.php
CHANGED
@@ -506,13 +506,20 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
|
506 |
* @return mixed|void
|
507 |
*/
|
508 |
function role_data( $roleID ) {
|
509 |
-
if ( strpos( $roleID, 'um_' ) === 0 )
|
510 |
-
$
|
511 |
|
512 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
|
514 |
-
if ( ! $role_data )
|
515 |
return array();
|
|
|
516 |
|
517 |
$temp = array();
|
518 |
foreach ( $role_data as $key=>$value ) {
|
506 |
* @return mixed|void
|
507 |
*/
|
508 |
function role_data( $roleID ) {
|
509 |
+
if ( strpos( $roleID, 'um_' ) === 0 ) {
|
510 |
+
$role_data = get_option( "um_role_{$roleID}_meta" );
|
511 |
|
512 |
+
if ( ! $role_data ) {
|
513 |
+
$roleID = substr( $roleID, 3 );
|
514 |
+
$role_data = get_option( "um_role_{$roleID}_meta" );
|
515 |
+
}
|
516 |
+
} else {
|
517 |
+
$role_data = get_option( "um_role_{$roleID}_meta" );
|
518 |
+
}
|
519 |
|
520 |
+
if ( ! $role_data ) {
|
521 |
return array();
|
522 |
+
}
|
523 |
|
524 |
$temp = array();
|
525 |
foreach ( $role_data as $key=>$value ) {
|
includes/core/class-shortcodes.php
CHANGED
@@ -161,7 +161,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
|
161 |
|
162 |
if ( ! empty( $role ) && ! empty( $role["status"] ) ) {
|
163 |
$message_key = $role["status"] . '_message';
|
164 |
-
$this->custom_message = ! empty( $role[ $message_key ] ) ? $role[ $message_key ] : '';
|
165 |
}
|
166 |
}
|
167 |
|
@@ -510,15 +510,21 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
|
510 |
|
511 |
extract($args, EXTR_SKIP);
|
512 |
|
513 |
-
|
514 |
-
|
|
|
|
|
|
|
515 |
}
|
516 |
|
517 |
// for profiles only
|
518 |
if ( $mode == 'profile' && um_profile_id() ) {
|
519 |
-
$
|
520 |
-
if (
|
521 |
-
|
|
|
|
|
|
|
522 |
}
|
523 |
}
|
524 |
|
161 |
|
162 |
if ( ! empty( $role ) && ! empty( $role["status"] ) ) {
|
163 |
$message_key = $role["status"] . '_message';
|
164 |
+
$this->custom_message = ! empty( $role[ $message_key ] ) ? stripslashes( $role[ $message_key ] ) : '';
|
165 |
}
|
166 |
}
|
167 |
|
510 |
|
511 |
extract($args, EXTR_SKIP);
|
512 |
|
513 |
+
//not display on admin preview
|
514 |
+
if ( empty( $_POST['act_id'] ) || $_POST['act_id'] != 'um_admin_preview_form' ) {
|
515 |
+
if ( 'register' == $mode && is_user_logged_in() ) {
|
516 |
+
return __( 'You are already registered', 'ultimate-member' );
|
517 |
+
}
|
518 |
}
|
519 |
|
520 |
// for profiles only
|
521 |
if ( $mode == 'profile' && um_profile_id() ) {
|
522 |
+
$use_custom = get_post_meta( $this->form_id, "_um_{$mode}_use_custom_settings", true );
|
523 |
+
if ( $use_custom ) { // Custom Form settings
|
524 |
+
$current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() );
|
525 |
+
if ( ! empty( $args['role'] ) && ! in_array( $args['role'], $current_user_roles ) ) {
|
526 |
+
return '';
|
527 |
+
}
|
528 |
}
|
529 |
}
|
530 |
|
includes/core/class-user.php
CHANGED
@@ -39,6 +39,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
|
39 |
add_action( 'init', array( &$this, 'set' ), 1 );
|
40 |
|
41 |
$this->preview = false;
|
|
|
42 |
|
43 |
// a list of keys that should never be in wp_usermeta
|
44 |
$this->update_user_keys = array(
|
@@ -54,6 +55,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
|
54 |
|
55 |
// When the cache should be cleared
|
56 |
add_action('um_delete_user_hook', array(&$this, 'remove_cached_queue') );
|
|
|
|
|
57 |
add_action('um_after_user_status_is_changed_hook', array(&$this, 'remove_cached_queue') );
|
58 |
|
59 |
// When user cache should be cleared
|
@@ -83,6 +86,73 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
|
83 |
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
|
84 |
|
85 |
add_action( 'init', array( &$this, 'check_membership' ), 10 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
|
@@ -890,6 +960,20 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
|
890 |
unset( $submitted['confirm_user_password'] );
|
891 |
}
|
892 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
893 |
/**
|
894 |
* UM hook
|
895 |
*
|
@@ -1274,59 +1358,10 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
|
1274 |
* @param bool $send_mail
|
1275 |
*/
|
1276 |
function delete( $send_mail = true ) {
|
1277 |
-
/**
|
1278 |
-
* UM hook
|
1279 |
-
*
|
1280 |
-
* @type action
|
1281 |
-
* @title um_delete_user_hook
|
1282 |
-
* @description On delete user
|
1283 |
-
* @change_log
|
1284 |
-
* ["Since: 2.0"]
|
1285 |
-
* @usage add_action( 'um_delete_user_hook', 'function_name', 10 );
|
1286 |
-
* @example
|
1287 |
-
* <?php
|
1288 |
-
* add_action( 'um_delete_user_hook', 'my_delete_user', 10 );
|
1289 |
-
* function my_delete_user() {
|
1290 |
-
* // your code here
|
1291 |
-
* }
|
1292 |
-
* ?>
|
1293 |
-
*/
|
1294 |
-
do_action( 'um_delete_user_hook' );
|
1295 |
-
/**
|
1296 |
-
* UM hook
|
1297 |
-
*
|
1298 |
-
* @type action
|
1299 |
-
* @title um_delete_user
|
1300 |
-
* @description On delete user
|
1301 |
-
* @input_vars
|
1302 |
-
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
1303 |
-
* @change_log
|
1304 |
-
* ["Since: 2.0"]
|
1305 |
-
* @usage add_action( 'um_delete_user', 'function_name', 10, 1 );
|
1306 |
-
* @example
|
1307 |
-
* <?php
|
1308 |
-
* add_action( 'um_delete_user', 'my_delete_user', 10, 1 );
|
1309 |
-
* function my_delete_user( $user_id ) {
|
1310 |
-
* // your code here
|
1311 |
-
* }
|
1312 |
-
* ?>
|
1313 |
-
*/
|
1314 |
-
do_action( 'um_delete_user', um_user( 'ID' ) );
|
1315 |
|
1316 |
-
|
1317 |
-
if ( $send_mail ) {
|
1318 |
-
UM()->mail()->send( um_user( 'user_email' ), 'deletion_email' );
|
1319 |
-
|
1320 |
-
$emails = um_multi_admin_email();
|
1321 |
-
if ( ! empty( $emails ) ) {
|
1322 |
-
foreach ( $emails as $email ) {
|
1323 |
-
UM()->mail()->send( $email, 'notification_deletion', array( 'admin' => true ) );
|
1324 |
-
}
|
1325 |
-
}
|
1326 |
-
}
|
1327 |
|
1328 |
-
|
1329 |
-
UM()->files()->remove_dir( um_user_uploads_dir() );
|
1330 |
|
1331 |
// remove user
|
1332 |
if ( is_multisite() ) {
|
@@ -1626,23 +1661,29 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
|
1626 |
}
|
1627 |
|
1628 |
}
|
|
|
|
|
1629 |
// update user
|
1630 |
if ( count( $args ) > 1 ) {
|
1631 |
-
global $wp_roles;
|
1632 |
-
$um_roles = get_option( 'um_roles' );
|
1633 |
|
1634 |
-
if
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
} else {
|
1639 |
-
$role_keys = array();
|
1640 |
-
}
|
1641 |
|
1642 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1643 |
|
1644 |
-
|
1645 |
-
|
|
|
|
|
|
|
1646 |
}
|
1647 |
|
1648 |
wp_update_user( $args );
|
39 |
add_action( 'init', array( &$this, 'set' ), 1 );
|
40 |
|
41 |
$this->preview = false;
|
42 |
+
$this->send_mail_on_delete = true;
|
43 |
|
44 |
// a list of keys that should never be in wp_usermeta
|
45 |
$this->update_user_keys = array(
|
55 |
|
56 |
// When the cache should be cleared
|
57 |
add_action('um_delete_user_hook', array(&$this, 'remove_cached_queue') );
|
58 |
+
add_action('um_delete_user', array( &$this, 'remove_cache' ), 10, 1 );
|
59 |
+
|
60 |
add_action('um_after_user_status_is_changed_hook', array(&$this, 'remove_cached_queue') );
|
61 |
|
62 |
// When user cache should be cleared
|
86 |
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
|
87 |
|
88 |
add_action( 'init', array( &$this, 'check_membership' ), 10 );
|
89 |
+
|
90 |
+
add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
|
91 |
+
add_action( 'wpmu_delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @param $user_id
|
97 |
+
*/
|
98 |
+
function delete_user_handler( $user_id ) {
|
99 |
+
|
100 |
+
um_fetch_user( $user_id );
|
101 |
+
|
102 |
+
/**
|
103 |
+
* UM hook
|
104 |
+
*
|
105 |
+
* @type action
|
106 |
+
* @title um_delete_user_hook
|
107 |
+
* @description On delete user
|
108 |
+
* @change_log
|
109 |
+
* ["Since: 2.0"]
|
110 |
+
* @usage add_action( 'um_delete_user_hook', 'function_name', 10 );
|
111 |
+
* @example
|
112 |
+
* <?php
|
113 |
+
* add_action( 'um_delete_user_hook', 'my_delete_user', 10 );
|
114 |
+
* function my_delete_user() {
|
115 |
+
* // your code here
|
116 |
+
* }
|
117 |
+
* ?>
|
118 |
+
*/
|
119 |
+
do_action( 'um_delete_user_hook' );
|
120 |
+
|
121 |
+
/**
|
122 |
+
* UM hook
|
123 |
+
*
|
124 |
+
* @type action
|
125 |
+
* @title um_delete_user
|
126 |
+
* @description On delete user
|
127 |
+
* @input_vars
|
128 |
+
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
129 |
+
* @change_log
|
130 |
+
* ["Since: 2.0"]
|
131 |
+
* @usage add_action( 'um_delete_user', 'function_name', 10, 1 );
|
132 |
+
* @example
|
133 |
+
* <?php
|
134 |
+
* add_action( 'um_delete_user', 'my_delete_user', 10, 1 );
|
135 |
+
* function my_delete_user( $user_id ) {
|
136 |
+
* // your code here
|
137 |
+
* }
|
138 |
+
* ?>
|
139 |
+
*/
|
140 |
+
do_action( 'um_delete_user', um_user( 'ID' ) );
|
141 |
+
|
142 |
+
// send email notifications
|
143 |
+
if ( $this->send_mail_on_delete ) {
|
144 |
+
UM()->mail()->send( um_user( 'user_email' ), 'deletion_email' );
|
145 |
+
|
146 |
+
$emails = um_multi_admin_email();
|
147 |
+
if ( ! empty( $emails ) ) {
|
148 |
+
foreach ( $emails as $email ) {
|
149 |
+
UM()->mail()->send( $email, 'notification_deletion', array( 'admin' => true ) );
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
// remove uploads
|
155 |
+
UM()->files()->remove_dir( um_user_uploads_dir() );
|
156 |
}
|
157 |
|
158 |
|
960 |
unset( $submitted['confirm_user_password'] );
|
961 |
}
|
962 |
|
963 |
+
//remove all password field values from submitted details
|
964 |
+
$password_fields = array();
|
965 |
+
foreach ( $submitted as $k => $v ) {
|
966 |
+
if ( UM()->fields()->get_field_type( $k ) == 'password' ) {
|
967 |
+
$password_fields[] = $k;
|
968 |
+
$password_fields[] = 'confirm_' . $k;
|
969 |
+
}
|
970 |
+
}
|
971 |
+
|
972 |
+
foreach ( $password_fields as $pw_field ) {
|
973 |
+
unset( $submitted[ $pw_field ] );
|
974 |
+
}
|
975 |
+
|
976 |
+
|
977 |
/**
|
978 |
* UM hook
|
979 |
*
|
1358 |
* @param bool $send_mail
|
1359 |
*/
|
1360 |
function delete( $send_mail = true ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1361 |
|
1362 |
+
$this->send_mail_on_delete = $send_mail;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1363 |
|
1364 |
+
$this->delete_user_handler( um_user( 'ID' ) );
|
|
|
1365 |
|
1366 |
// remove user
|
1367 |
if ( is_multisite() ) {
|
1661 |
}
|
1662 |
|
1663 |
}
|
1664 |
+
|
1665 |
+
|
1666 |
// update user
|
1667 |
if ( count( $args ) > 1 ) {
|
|
|
|
|
1668 |
|
1669 |
+
//if isset roles argument validate role to properly for security reasons
|
1670 |
+
if ( isset( $args['role'] ) ) {
|
1671 |
+
global $wp_roles;
|
1672 |
+
$um_roles = get_option( 'um_roles' );
|
|
|
|
|
|
|
1673 |
|
1674 |
+
if ( ! empty( $um_roles ) ) {
|
1675 |
+
$role_keys = array_map( function( $item ) {
|
1676 |
+
return 'um_' . $item;
|
1677 |
+
}, get_option( 'um_roles' ) );
|
1678 |
+
} else {
|
1679 |
+
$role_keys = array();
|
1680 |
+
}
|
1681 |
|
1682 |
+
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
|
1683 |
+
|
1684 |
+
if ( in_array( $args['role'], $exclude_roles ) ) {
|
1685 |
+
unset( $args['role'] );
|
1686 |
+
}
|
1687 |
}
|
1688 |
|
1689 |
wp_update_user( $args );
|
includes/core/um-actions-account.php
CHANGED
@@ -376,7 +376,7 @@ add_action( 'um_account_page_hidden_fields', 'um_account_page_hidden_fields' );
|
|
376 |
* Before delete account tab content
|
377 |
*/
|
378 |
function um_before_account_delete() {
|
379 |
-
echo wpautop( UM()->options()->get( 'delete_account_text' ) );
|
380 |
}
|
381 |
add_action( 'um_before_account_delete', 'um_before_account_delete' );
|
382 |
|
376 |
* Before delete account tab content
|
377 |
*/
|
378 |
function um_before_account_delete() {
|
379 |
+
echo wpautop( htmlspecialchars( UM()->options()->get( 'delete_account_text' ) ) );
|
380 |
}
|
381 |
add_action( 'um_before_account_delete', 'um_before_account_delete' );
|
382 |
|
includes/core/um-actions-core.php
CHANGED
@@ -108,7 +108,9 @@ function um_action_request_process() {
|
|
108 |
break;
|
109 |
|
110 |
case 'um_delete':
|
111 |
-
if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) )
|
|
|
|
|
112 |
um_fetch_user( $uid );
|
113 |
UM()->user()->delete();
|
114 |
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
108 |
break;
|
109 |
|
110 |
case 'um_delete':
|
111 |
+
if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) {
|
112 |
+
wp_die( __('You do not have permission to delete this user.','ultimate-member') );
|
113 |
+
}
|
114 |
um_fetch_user( $uid );
|
115 |
UM()->user()->delete();
|
116 |
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
includes/core/um-actions-form.php
CHANGED
@@ -314,8 +314,9 @@ function um_submit_form_errors_hook_( $args ) {
|
|
314 |
foreach ( $array['conditions'] as $condition ) {
|
315 |
list( $visibility, $parent_key, $op, $parent_value ) = $condition;
|
316 |
|
317 |
-
if ( ! isset( $args[ $parent_key ] ) )
|
318 |
continue;
|
|
|
319 |
|
320 |
$cond_value = ( $fields[ $parent_key ]['type'] == 'radio' ) ? $args[ $parent_key ][0] : $args[ $parent_key ];
|
321 |
|
@@ -337,11 +338,11 @@ function um_submit_form_errors_hook_( $args ) {
|
|
337 |
continue 2;
|
338 |
}
|
339 |
} elseif ( $op == 'greater than' ) {
|
340 |
-
if ( $cond_value > $
|
341 |
continue 2;
|
342 |
}
|
343 |
} elseif ( $op == 'less than' ) {
|
344 |
-
if ( $cond_value < $
|
345 |
continue 2;
|
346 |
}
|
347 |
} elseif ( $op == 'contains' ) {
|
@@ -367,11 +368,11 @@ function um_submit_form_errors_hook_( $args ) {
|
|
367 |
continue 2;
|
368 |
}
|
369 |
} elseif ( $op == 'greater than' ) {
|
370 |
-
if ( $cond_value <= $
|
371 |
continue 2;
|
372 |
}
|
373 |
} elseif ( $op == 'less than' ) {
|
374 |
-
if ( $cond_value >= $
|
375 |
continue 2;
|
376 |
}
|
377 |
} elseif ( $op == 'contains' ) {
|
314 |
foreach ( $array['conditions'] as $condition ) {
|
315 |
list( $visibility, $parent_key, $op, $parent_value ) = $condition;
|
316 |
|
317 |
+
if ( ! isset( $args[ $parent_key ] ) ) {
|
318 |
continue;
|
319 |
+
}
|
320 |
|
321 |
$cond_value = ( $fields[ $parent_key ]['type'] == 'radio' ) ? $args[ $parent_key ][0] : $args[ $parent_key ];
|
322 |
|
338 |
continue 2;
|
339 |
}
|
340 |
} elseif ( $op == 'greater than' ) {
|
341 |
+
if ( $cond_value > $parent_value ) {
|
342 |
continue 2;
|
343 |
}
|
344 |
} elseif ( $op == 'less than' ) {
|
345 |
+
if ( $cond_value < $parent_value ) {
|
346 |
continue 2;
|
347 |
}
|
348 |
} elseif ( $op == 'contains' ) {
|
368 |
continue 2;
|
369 |
}
|
370 |
} elseif ( $op == 'greater than' ) {
|
371 |
+
if ( $cond_value <= $parent_value ) {
|
372 |
continue 2;
|
373 |
}
|
374 |
} elseif ( $op == 'less than' ) {
|
375 |
+
if ( $cond_value >= $parent_value ) {
|
376 |
continue 2;
|
377 |
}
|
378 |
} elseif ( $op == 'contains' ) {
|
includes/core/um-actions-password.php
CHANGED
@@ -133,15 +133,6 @@ function um_reset_password_errors_hook( $args ) {
|
|
133 |
if ( $_POST[ UM()->honeypot ] != '' )
|
134 |
wp_die('Hello, spam bot!','ultimate-member');
|
135 |
|
136 |
-
$form_timestamp = trim($_POST['timestamp']);
|
137 |
-
$live_timestamp = current_time( 'timestamp' );
|
138 |
-
|
139 |
-
if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
|
140 |
-
wp_die( __('Hello, spam bot!','ultimate-member') );
|
141 |
-
|
142 |
-
if ( $live_timestamp - $form_timestamp < 3 && UM()->options()->get( 'enable_timebot' ) == 1 )
|
143 |
-
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!','ultimate-member') );
|
144 |
-
|
145 |
$user = "";
|
146 |
|
147 |
foreach ( $_POST as $key => $val ) {
|
@@ -197,16 +188,6 @@ function um_change_password_errors_hook( $args ) {
|
|
197 |
wp_die('Hello, spam bot!','ultimate-member');
|
198 |
}
|
199 |
|
200 |
-
$form_timestamp = trim($_POST['timestamp']);
|
201 |
-
$live_timestamp = current_time( 'timestamp' );
|
202 |
-
|
203 |
-
if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
|
204 |
-
wp_die( __('Hello, spam bot!','ultimate-member') );
|
205 |
-
|
206 |
-
if ( $live_timestamp - $form_timestamp < 3 && UM()->options()->get( 'enable_timebot' ) == 1 ) {
|
207 |
-
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!','ultimate-member') );
|
208 |
-
}
|
209 |
-
|
210 |
$reset_pass_hash = '';
|
211 |
|
212 |
if( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'reset_password' && um_is_core_page('password-reset') ){
|
133 |
if ( $_POST[ UM()->honeypot ] != '' )
|
134 |
wp_die('Hello, spam bot!','ultimate-member');
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
$user = "";
|
137 |
|
138 |
foreach ( $_POST as $key => $val ) {
|
188 |
wp_die('Hello, spam bot!','ultimate-member');
|
189 |
}
|
190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
$reset_pass_hash = '';
|
192 |
|
193 |
if( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'reset_password' && um_is_core_page('password-reset') ){
|
includes/core/um-actions-profile.php
CHANGED
@@ -218,8 +218,12 @@ function um_user_edit_profile( $args ) {
|
|
218 |
|
219 |
// loop through fields
|
220 |
if ( ! empty( $fields ) ) {
|
|
|
221 |
foreach ( $fields as $key => $array ) {
|
222 |
|
|
|
|
|
|
|
223 |
if ( ! um_can_edit_field( $fields[ $key ] ) && isset( $fields[ $key ]['editable'] ) && ! $fields[ $key ]['editable'] )
|
224 |
continue;
|
225 |
|
@@ -236,10 +240,15 @@ function um_user_edit_profile( $args ) {
|
|
236 |
|
237 |
} else {
|
238 |
|
239 |
-
if (
|
240 |
-
$to_update[ $key ] = $args['submitted'][ $key ];
|
241 |
-
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
243 |
}
|
244 |
|
245 |
}
|
@@ -518,11 +527,7 @@ function um_profile_dynamic_meta_desc() {
|
|
518 |
$user_id = um_user( 'ID' );
|
519 |
$url = um_user_profile_url();
|
520 |
|
521 |
-
|
522 |
-
$avatar = um_user_uploads_uri() . um_profile( 'profile_photo' );
|
523 |
-
} else {
|
524 |
-
$avatar = um_get_default_avatar_uri();
|
525 |
-
}
|
526 |
|
527 |
um_reset_user(); ?>
|
528 |
|
@@ -601,7 +606,7 @@ function um_profile_header_cover_area( $args ) {
|
|
601 |
|
602 |
echo $overlay; ?>
|
603 |
|
604 |
-
<div class="um-cover-e">
|
605 |
|
606 |
<?php if (um_profile( 'cover_photo' )) { ?>
|
607 |
|
@@ -1372,40 +1377,46 @@ function um_profile_menu( $args ) {
|
|
1372 |
|
1373 |
<div class="um-profile-nav-item um-profile-nav-<?php echo $id . ' ' . $profile_nav_class; ?>">
|
1374 |
<?php if ( UM()->options()->get( 'profile_menu_icons' ) ) { ?>
|
1375 |
-
<a href="<?php echo $nav_link; ?>" class="
|
1376 |
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
|
1377 |
|
1378 |
<i class="<?php echo $tab['icon']; ?>"></i>
|
1379 |
|
1380 |
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
|
1381 |
-
<span class="um-tab-notifier
|
1382 |
<?php } ?>
|
1383 |
|
1384 |
-
<span class="
|
1385 |
-
|
1386 |
</a>
|
1387 |
-
<a href="<?php echo $nav_link; ?>" class="
|
1388 |
-
title="<?php echo esc_attr( $tab['name'] ); ?>"
|
1389 |
|
1390 |
<i class="<?php echo $tab['icon']; ?>"></i>
|
1391 |
|
1392 |
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
|
1393 |
-
<span class="um-tab-notifier
|
1394 |
<?php } ?>
|
1395 |
|
1396 |
-
<span class="
|
1397 |
-
|
1398 |
</a>
|
1399 |
<?php } else { ?>
|
1400 |
-
<a href="<?php echo $nav_link; ?>"
|
1401 |
-
original-title="<?php echo esc_attr( $tab['name'] ); ?>">
|
1402 |
|
1403 |
-
<?php
|
1404 |
-
|
|
|
|
|
1405 |
<?php } ?>
|
|
|
|
|
|
|
1406 |
|
1407 |
-
|
|
|
|
|
1408 |
|
|
|
1409 |
</a>
|
1410 |
<?php } ?>
|
1411 |
</div>
|
218 |
|
219 |
// loop through fields
|
220 |
if ( ! empty( $fields ) ) {
|
221 |
+
|
222 |
foreach ( $fields as $key => $array ) {
|
223 |
|
224 |
+
/*if ( ! um_can_edit_field( $fields[ $key ] ) )
|
225 |
+
continue;*/
|
226 |
+
|
227 |
if ( ! um_can_edit_field( $fields[ $key ] ) && isset( $fields[ $key ]['editable'] ) && ! $fields[ $key ]['editable'] )
|
228 |
continue;
|
229 |
|
240 |
|
241 |
} else {
|
242 |
|
243 |
+
if ( $array['type'] == 'password' ) {
|
244 |
+
$to_update[ $key ] = wp_hash_password( $args['submitted'][ $key ] );
|
245 |
+
$args['submitted'][ $key ] = sprintf( __( 'Your choosed %s', 'ultimate-member' ), $array['title'] );
|
246 |
+
} else {
|
247 |
+
if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) {
|
248 |
+
$to_update[ $key ] = $args['submitted'][ $key ];
|
249 |
+
} elseif ( $args['submitted'][ $key ] ) {
|
250 |
+
$to_update[ $key ] = $args['submitted'][ $key ];
|
251 |
+
}
|
252 |
}
|
253 |
|
254 |
}
|
527 |
$user_id = um_user( 'ID' );
|
528 |
$url = um_user_profile_url();
|
529 |
|
530 |
+
$avatar = um_get_user_avatar_url( $user_id, 'original' );
|
|
|
|
|
|
|
|
|
531 |
|
532 |
um_reset_user(); ?>
|
533 |
|
606 |
|
607 |
echo $overlay; ?>
|
608 |
|
609 |
+
<div class="um-cover-e" data-ratio="<?php echo $args['cover_ratio']; ?>">
|
610 |
|
611 |
<?php if (um_profile( 'cover_photo' )) { ?>
|
612 |
|
1377 |
|
1378 |
<div class="um-profile-nav-item um-profile-nav-<?php echo $id . ' ' . $profile_nav_class; ?>">
|
1379 |
<?php if ( UM()->options()->get( 'profile_menu_icons' ) ) { ?>
|
1380 |
+
<a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
|
1381 |
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
|
1382 |
|
1383 |
<i class="<?php echo $tab['icon']; ?>"></i>
|
1384 |
|
1385 |
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
|
1386 |
+
<span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
|
1387 |
<?php } ?>
|
1388 |
|
1389 |
+
<span class="uimob800-hide uimob500-hide uimob340-hide title"><?php echo $tab['name']; ?></span>
|
|
|
1390 |
</a>
|
1391 |
+
<a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
|
1392 |
+
title="<?php echo esc_attr( $tab['name'] ); ?>">
|
1393 |
|
1394 |
<i class="<?php echo $tab['icon']; ?>"></i>
|
1395 |
|
1396 |
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
|
1397 |
+
<span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
|
1398 |
<?php } ?>
|
1399 |
|
1400 |
+
<span class="title"><?php echo $tab['name']; ?></span>
|
|
|
1401 |
</a>
|
1402 |
<?php } else { ?>
|
1403 |
+
<a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
|
1404 |
+
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
|
1405 |
|
1406 |
+
<i class="<?php echo $tab['icon']; ?>"></i>
|
1407 |
+
|
1408 |
+
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
|
1409 |
+
<span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
|
1410 |
<?php } ?>
|
1411 |
+
</a>
|
1412 |
+
<a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
|
1413 |
+
title="<?php echo esc_attr( $tab['name'] ); ?>">
|
1414 |
|
1415 |
+
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0) { ?>
|
1416 |
+
<span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
|
1417 |
+
<?php } ?>
|
1418 |
|
1419 |
+
<span class="title"><?php echo $tab['name']; ?></span>
|
1420 |
</a>
|
1421 |
<?php } ?>
|
1422 |
</div>
|
includes/core/um-actions-register.php
CHANGED
@@ -54,8 +54,9 @@ function um_after_insert_user( $user_id, $args ) {
|
|
54 |
//clear Users cached queue
|
55 |
UM()->user()->remove_cached_queue();
|
56 |
|
|
|
|
|
57 |
if ( ! empty( $args['submitted'] ) ) {
|
58 |
-
um_fetch_user( $user_id );
|
59 |
UM()->user()->set_registration_details( $args['submitted'] );
|
60 |
}
|
61 |
|
@@ -103,7 +104,7 @@ function um_after_insert_user( $user_id, $args ) {
|
|
103 |
*/
|
104 |
do_action( 'um_registration_complete', $user_id, $args );
|
105 |
}
|
106 |
-
add_action( 'um_user_register', 'um_after_insert_user',
|
107 |
|
108 |
|
109 |
/**
|
@@ -118,7 +119,7 @@ function um_send_registration_notification( $user_id, $args ) {
|
|
118 |
$emails = um_multi_admin_email();
|
119 |
if ( ! empty( $emails ) ) {
|
120 |
foreach ( $emails as $email ) {
|
121 |
-
if ( um_user( '
|
122 |
UM()->mail()->send( $email, 'notification_new_user', array( 'admin' => true ) );
|
123 |
} else {
|
124 |
UM()->mail()->send( $email, 'notification_review', array( 'admin' => true ) );
|
@@ -136,7 +137,7 @@ add_action( 'um_registration_complete', 'um_send_registration_notification', 10,
|
|
136 |
* @param $args
|
137 |
*/
|
138 |
function um_check_user_status( $user_id, $args ) {
|
139 |
-
$status = um_user( '
|
140 |
|
141 |
/**
|
142 |
* UM hook
|
@@ -368,6 +369,30 @@ function um_submit_form_register( $args ) {
|
|
368 |
$args['submitted'] = array_merge( $args['submitted'], $credentials );
|
369 |
$args = array_merge( $args, $credentials );
|
370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
/**
|
372 |
* UM hook
|
373 |
*
|
@@ -390,7 +415,7 @@ function um_submit_form_register( $args ) {
|
|
390 |
* }
|
391 |
* ?>
|
392 |
*/
|
393 |
-
$user_role = apply_filters( 'um_registration_user_role',
|
394 |
|
395 |
$userdata = array(
|
396 |
'user_login' => $user_login,
|
@@ -440,7 +465,7 @@ function um_add_user_role( $args ) {
|
|
440 |
|
441 |
$role = apply_filters( 'um_registration_user_role', UM()->form()->assigned_role( UM()->form()->form_id ), $args );
|
442 |
|
443 |
-
if ( empty( $role ) ) return;
|
444 |
|
445 |
/**
|
446 |
* UM hook
|
@@ -469,7 +494,7 @@ function um_add_user_role( $args ) {
|
|
469 |
}
|
470 |
|
471 |
}
|
472 |
-
add_action( 'um_after_register_fields', 'um_add_user_role', 10, 1 );
|
473 |
|
474 |
|
475 |
/**
|
@@ -725,4 +750,18 @@ function um_registration_set_profile_full_name( $user_id, $args ) {
|
|
725 |
*/
|
726 |
do_action( 'um_update_profile_full_name', $user_id, $args );
|
727 |
}
|
728 |
-
add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_full_name', 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
//clear Users cached queue
|
55 |
UM()->user()->remove_cached_queue();
|
56 |
|
57 |
+
um_fetch_user( $user_id );
|
58 |
+
UM()->user()->set_status( um_user( 'status' ) );
|
59 |
if ( ! empty( $args['submitted'] ) ) {
|
|
|
60 |
UM()->user()->set_registration_details( $args['submitted'] );
|
61 |
}
|
62 |
|
104 |
*/
|
105 |
do_action( 'um_registration_complete', $user_id, $args );
|
106 |
}
|
107 |
+
add_action( 'um_user_register', 'um_after_insert_user', 1, 2 );
|
108 |
|
109 |
|
110 |
/**
|
119 |
$emails = um_multi_admin_email();
|
120 |
if ( ! empty( $emails ) ) {
|
121 |
foreach ( $emails as $email ) {
|
122 |
+
if ( um_user( 'account_status' ) != 'pending' ) {
|
123 |
UM()->mail()->send( $email, 'notification_new_user', array( 'admin' => true ) );
|
124 |
} else {
|
125 |
UM()->mail()->send( $email, 'notification_review', array( 'admin' => true ) );
|
137 |
* @param $args
|
138 |
*/
|
139 |
function um_check_user_status( $user_id, $args ) {
|
140 |
+
$status = um_user( 'account_status' );
|
141 |
|
142 |
/**
|
143 |
* UM hook
|
369 |
$args['submitted'] = array_merge( $args['submitted'], $credentials );
|
370 |
$args = array_merge( $args, $credentials );
|
371 |
|
372 |
+
//get user role from global or form's settings
|
373 |
+
$user_role = UM()->form()->assigned_role( UM()->form()->form_id );
|
374 |
+
|
375 |
+
//get user role from field Role dropdown or radio
|
376 |
+
if ( isset( $args['role'] ) ) {
|
377 |
+
global $wp_roles;
|
378 |
+
$um_roles = get_option( 'um_roles' );
|
379 |
+
|
380 |
+
if ( ! empty( $um_roles ) ) {
|
381 |
+
$role_keys = array_map( function( $item ) {
|
382 |
+
return 'um_' . $item;
|
383 |
+
}, get_option( 'um_roles' ) );
|
384 |
+
} else {
|
385 |
+
$role_keys = array();
|
386 |
+
}
|
387 |
+
|
388 |
+
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
|
389 |
+
|
390 |
+
//if role is properly set it
|
391 |
+
if ( ! in_array( $args['role'], $exclude_roles ) ) {
|
392 |
+
$user_role = $args['role'];
|
393 |
+
}
|
394 |
+
}
|
395 |
+
|
396 |
/**
|
397 |
* UM hook
|
398 |
*
|
415 |
* }
|
416 |
* ?>
|
417 |
*/
|
418 |
+
$user_role = apply_filters( 'um_registration_user_role', $user_role, $args );
|
419 |
|
420 |
$userdata = array(
|
421 |
'user_login' => $user_login,
|
465 |
|
466 |
$role = apply_filters( 'um_registration_user_role', UM()->form()->assigned_role( UM()->form()->form_id ), $args );
|
467 |
|
468 |
+
if ( empty( $use_custom_settings ) || empty( $role ) ) return;
|
469 |
|
470 |
/**
|
471 |
* UM hook
|
494 |
}
|
495 |
|
496 |
}
|
497 |
+
//add_action( 'um_after_register_fields', 'um_add_user_role', 10, 1 );
|
498 |
|
499 |
|
500 |
/**
|
750 |
*/
|
751 |
do_action( 'um_update_profile_full_name', $user_id, $args );
|
752 |
}
|
753 |
+
add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_full_name', 10, 2 );
|
754 |
+
|
755 |
+
|
756 |
+
/**
|
757 |
+
* Redirect from default registration to UM registration page
|
758 |
+
*/
|
759 |
+
function um_form_register_redirect() {
|
760 |
+
$page_id = UM()->options()->get( UM()->options()->get_core_page_id( 'register' ) );
|
761 |
+
$register_post = get_post( $page_id );
|
762 |
+
if ( ! empty( $register_post ) ) {
|
763 |
+
wp_safe_redirect( get_permalink( $page_id ) );
|
764 |
+
exit();
|
765 |
+
}
|
766 |
+
}
|
767 |
+
add_action( 'login_form_register', 'um_form_register_redirect', 10 );
|
includes/core/um-filters-avatars.php
CHANGED
@@ -27,7 +27,6 @@ add_filter( 'avatar_defaults', 'um_avatar_defaults', 99999 );
|
|
27 |
* @return string returns avatar in image html elements
|
28 |
*/
|
29 |
function um_get_avatar( $avatar = '', $id_or_email='', $size = '96', $avatar_class = '', $default = '', $alt = '' ) {
|
30 |
-
|
31 |
if ( is_numeric($id_or_email) )
|
32 |
$user_id = (int) $id_or_email;
|
33 |
elseif ( is_string( $id_or_email ) && ( $user = get_user_by( 'email', $id_or_email ) ) )
|
@@ -41,64 +40,6 @@ function um_get_avatar( $avatar = '', $id_or_email='', $size = '96', $avatar_cla
|
|
41 |
|
42 |
$avatar = um_user('profile_photo', $size);
|
43 |
|
44 |
-
/**
|
45 |
-
* UM hook
|
46 |
-
*
|
47 |
-
* @type filter
|
48 |
-
* @title um_avatar_image_alternate_text
|
49 |
-
* @description Change avatar image alt
|
50 |
-
* @input_vars
|
51 |
-
* [{"var":"$avatar_alt","type":"string","desc":"Image alternate text. Display name by default"}]
|
52 |
-
* @change_log
|
53 |
-
* ["Since: 2.0"]
|
54 |
-
* @usage
|
55 |
-
* <?php add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 ); ?>
|
56 |
-
* @example
|
57 |
-
* <?php
|
58 |
-
* add_filter( 'um_avatar_image_alternate_text', 'my_avatar_image_alternate_text', 10, 1 );
|
59 |
-
* function my_avatar_image_alternate_text( $avatar_alt ) {
|
60 |
-
* // your code here
|
61 |
-
* return $avatar_alt;
|
62 |
-
* }
|
63 |
-
* ?>
|
64 |
-
*/
|
65 |
-
$image_alt = apply_filters( "um_avatar_image_alternate_text", um_user("display_name") );
|
66 |
-
|
67 |
-
if ( ! $avatar && UM()->options()->get( 'use_gravatars' ) ) {
|
68 |
-
|
69 |
-
$default = get_option( 'avatar_default', 'mystery' );
|
70 |
-
if ( $default == 'gravatar_default' ) {
|
71 |
-
$default = '';
|
72 |
-
}
|
73 |
-
|
74 |
-
$rating = get_option('avatar_rating');
|
75 |
-
if ( !empty( $rating ) ) {
|
76 |
-
$rating = "&r={$rating}";
|
77 |
-
}
|
78 |
-
|
79 |
-
if ( UM()->options()->get('use_gravatars') && ! um_user('synced_profile_photo') && ! $has_profile_photo ){
|
80 |
-
$avatar_url = um_get_domain_protocol().'gravatar.com/avatar/'.um_user('synced_gravatar_hashed_id');
|
81 |
-
$avatar_url = add_query_arg('s',400, $avatar_url);
|
82 |
-
$gravatar_type = UM()->options()->get( 'use_um_gravatar_default_builtin_image' );
|
83 |
-
|
84 |
-
if ( $gravatar_type == 'default' ) {
|
85 |
-
if ( UM()->options()->get( 'use_um_gravatar_default_image' ) ) {
|
86 |
-
$avatar_url = add_query_arg('d', um_get_default_avatar_uri(), $avatar_url );
|
87 |
-
}
|
88 |
-
} else {
|
89 |
-
$avatar_url = add_query_arg('d', $gravatar_type, $avatar_url );
|
90 |
-
}
|
91 |
-
|
92 |
-
}
|
93 |
-
|
94 |
-
$avatar = '<img src="' .$avatar_url .'?d='. $default . '&s=' . $size . $rating .'" class="func-um_get_avatar gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="'.$image_alt.'" />';
|
95 |
-
|
96 |
-
}else if( empty( $avatar ) ){
|
97 |
-
$default_avatar_uri = um_get_default_avatar_uri();
|
98 |
-
|
99 |
-
$avatar = '<img src="' .$default_avatar_uri .'" class="gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="'.$image_alt.'" />';
|
100 |
-
}
|
101 |
-
|
102 |
return $avatar;
|
103 |
}
|
104 |
add_filter( 'get_avatar', 'um_get_avatar', 99999, 5 );
|
27 |
* @return string returns avatar in image html elements
|
28 |
*/
|
29 |
function um_get_avatar( $avatar = '', $id_or_email='', $size = '96', $avatar_class = '', $default = '', $alt = '' ) {
|
|
|
30 |
if ( is_numeric($id_or_email) )
|
31 |
$user_id = (int) $id_or_email;
|
32 |
elseif ( is_string( $id_or_email ) && ( $user = get_user_by( 'email', $id_or_email ) ) )
|
40 |
|
41 |
$avatar = um_user('profile_photo', $size);
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
return $avatar;
|
44 |
}
|
45 |
add_filter( 'get_avatar', 'um_get_avatar', 99999, 5 );
|
includes/core/um-filters-fields.php
CHANGED
@@ -367,18 +367,70 @@ add_filter( 'um_get_form_fields', 'um_get_form_fields', 99 );
|
|
367 |
*/
|
368 |
function um_get_custom_field_array( $array, $fields ) {
|
369 |
|
370 |
-
if (
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
$array['required'] = 0;
|
381 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
$array['required'] = 0;
|
383 |
}
|
384 |
}
|
367 |
*/
|
368 |
function um_get_custom_field_array( $array, $fields ) {
|
369 |
|
370 |
+
if ( ! empty( $array['conditions'] ) ) {
|
371 |
+
foreach ( $array['conditions'] as $key => $value ) {
|
372 |
+
$condition_metakey = $fields[ $value[1] ]['metakey'];
|
373 |
+
if ( isset( $_POST[ $condition_metakey ] ) ) {
|
374 |
+
$cond_value = ( $fields[ $value[1] ]['type'] == 'radio' ) ? $_POST[ $condition_metakey ][0] : $_POST[ $condition_metakey ];
|
375 |
+
list( $visibility, $parent_key, $op, $parent_value ) = $value;
|
376 |
+
|
377 |
+
if ( $visibility == 'hide' ) {
|
378 |
+
if ( $op == 'empty' ) {
|
379 |
+
if ( empty( $cond_value ) ) {
|
380 |
+
$array['required'] = 0;
|
381 |
+
}
|
382 |
+
} elseif ( $op == 'not empty' ) {
|
383 |
+
if ( ! empty( $cond_value ) ) {
|
384 |
+
$array['required'] = 0;
|
385 |
+
}
|
386 |
+
} elseif ( $op == 'equals to' ) {
|
387 |
+
if ( $cond_value == $parent_value ) {
|
388 |
+
$array['required'] = 0;
|
389 |
+
}
|
390 |
+
} elseif ( $op == 'not equals' ) {
|
391 |
+
if ( $cond_value != $parent_value ) {
|
392 |
+
$array['required'] = 0;
|
393 |
+
}
|
394 |
+
} elseif ( $op == 'greater than' ) {
|
395 |
+
if ( $cond_value > $parent_value ) {
|
396 |
+
$array['required'] = 0;
|
397 |
+
}
|
398 |
+
} elseif ( $op == 'less than' ) {
|
399 |
+
if ( $cond_value < $parent_value ) {
|
400 |
+
$array['required'] = 0;
|
401 |
+
}
|
402 |
+
} elseif ( $op == 'contains' ) {
|
403 |
+
if ( strstr( $cond_value, $parent_value ) ) {
|
404 |
$array['required'] = 0;
|
405 |
+
}
|
406 |
+
}
|
407 |
+
} elseif ( $visibility == 'show' ) {
|
408 |
+
if ( $op == 'empty' ) {
|
409 |
+
if ( ! empty( $cond_value ) ) {
|
410 |
+
$array['required'] = 0;
|
411 |
+
}
|
412 |
+
} elseif ( $op == 'not empty' ) {
|
413 |
+
if ( empty( $cond_value ) ) {
|
414 |
+
$array['required'] = 0;
|
415 |
+
}
|
416 |
+
} elseif ( $op == 'equals to' ) {
|
417 |
+
if ( $cond_value != $parent_value ) {
|
418 |
+
$array['required'] = 0;
|
419 |
+
}
|
420 |
+
} elseif ( $op == 'not equals' ) {
|
421 |
+
if ( $cond_value == $parent_value ) {
|
422 |
+
$array['required'] = 0;
|
423 |
+
}
|
424 |
+
} elseif ( $op == 'greater than' ) {
|
425 |
+
if ( $cond_value <= $parent_value ) {
|
426 |
+
$array['required'] = 0;
|
427 |
+
}
|
428 |
+
} elseif ( $op == 'less than' ) {
|
429 |
+
if ( $cond_value >= $parent_value ) {
|
430 |
+
$array['required'] = 0;
|
431 |
+
}
|
432 |
+
} elseif ( $op == 'contains' ) {
|
433 |
+
if ( ! strstr( $cond_value, $parent_value ) ) {
|
434 |
$array['required'] = 0;
|
435 |
}
|
436 |
}
|
includes/core/um-filters-login.php
CHANGED
@@ -151,4 +151,20 @@ function um_wp_form_errors_hook_logincheck( $user, $username, $password ) {
|
|
151 |
return wp_authenticate_username_password( $user, $username, $password );
|
152 |
|
153 |
}
|
154 |
-
add_filter( 'authenticate', 'um_wp_form_errors_hook_logincheck', 50, 3 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
return wp_authenticate_username_password( $user, $username, $password );
|
152 |
|
153 |
}
|
154 |
+
add_filter( 'authenticate', 'um_wp_form_errors_hook_logincheck', 50, 3 );
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Change lost password url in UM Login form
|
158 |
+
* @param string $lostpassword_url
|
159 |
+
* @return string
|
160 |
+
*/
|
161 |
+
function um_lostpassword_url( $lostpassword_url ) {
|
162 |
+
|
163 |
+
if( um_is_core_page("login") ){
|
164 |
+
return um_get_core_page("password-reset");
|
165 |
+
}
|
166 |
+
|
167 |
+
return $lostpassword_url;
|
168 |
+
}
|
169 |
+
add_filter( 'lostpassword_url', 'um_lostpassword_url', 10, 1 );
|
170 |
+
|
includes/core/um-filters-navmenu.php
CHANGED
@@ -28,19 +28,24 @@ if ( ! is_admin() ) {
|
|
28 |
/**
|
29 |
* Conditional menu items
|
30 |
*
|
31 |
-
* @param $
|
32 |
-
* @param $menu
|
33 |
* @param $args
|
34 |
*
|
35 |
* @return mixed
|
36 |
*/
|
37 |
-
function um_conditional_nav_menu( $
|
38 |
-
|
39 |
-
|
|
|
|
|
40 |
|
41 |
um_fetch_user( get_current_user_id() );
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
44 |
|
45 |
$mode = get_post_meta( $item->ID, 'menu-item-um_nav_public', true );
|
46 |
$roles = get_post_meta( $item->ID, 'menu-item-um_nav_roles', true );
|
@@ -59,11 +64,16 @@ if ( ! is_admin() ) {
|
|
59 |
|
60 |
case 2:
|
61 |
if ( is_user_logged_in() && ! empty( $roles ) ) {
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
67 |
} else {
|
68 |
$visible = is_user_logged_in() ? true : false;
|
69 |
}
|
@@ -104,14 +114,31 @@ if ( ! is_admin() ) {
|
|
104 |
// unset non-visible item
|
105 |
if ( ! $visible ) {
|
106 |
$hide_children_of[] = $item->ID; // store ID of item
|
107 |
-
|
|
|
|
|
108 |
}
|
109 |
|
110 |
}
|
111 |
|
112 |
um_reset_user();
|
113 |
|
114 |
-
return $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
-
add_filter( 'wp_get_nav_menu_items', '
|
117 |
}
|
28 |
/**
|
29 |
* Conditional menu items
|
30 |
*
|
31 |
+
* @param $menu_items
|
|
|
32 |
* @param $args
|
33 |
*
|
34 |
* @return mixed
|
35 |
*/
|
36 |
+
function um_conditional_nav_menu( $menu_items, $args ) {
|
37 |
+
//if empty
|
38 |
+
if ( empty( $menu_items ) ) {
|
39 |
+
return $menu_items;
|
40 |
+
}
|
41 |
|
42 |
um_fetch_user( get_current_user_id() );
|
43 |
|
44 |
+
$filtered_items = array();
|
45 |
+
$hide_children_of = array();
|
46 |
+
|
47 |
+
//other filter
|
48 |
+
foreach ( $menu_items as $item ) {
|
49 |
|
50 |
$mode = get_post_meta( $item->ID, 'menu-item-um_nav_public', true );
|
51 |
$roles = get_post_meta( $item->ID, 'menu-item-um_nav_roles', true );
|
64 |
|
65 |
case 2:
|
66 |
if ( is_user_logged_in() && ! empty( $roles ) ) {
|
67 |
+
if ( current_user_can( 'administrator' ) ) {
|
68 |
+
$visible = true;
|
69 |
+
} else {
|
70 |
+
$current_user_roles = um_user( 'roles' );
|
71 |
+
if ( empty( $current_user_roles ) ) {
|
72 |
+
$visible = false;
|
73 |
+
} else {
|
74 |
+
$visible = ( count( array_intersect( $current_user_roles, (array)$roles ) ) > 0 ) ? true : false;
|
75 |
+
}
|
76 |
+
}
|
77 |
} else {
|
78 |
$visible = is_user_logged_in() ? true : false;
|
79 |
}
|
114 |
// unset non-visible item
|
115 |
if ( ! $visible ) {
|
116 |
$hide_children_of[] = $item->ID; // store ID of item
|
117 |
+
} else {
|
118 |
+
$filtered_items[] = $item;
|
119 |
+
continue;
|
120 |
}
|
121 |
|
122 |
}
|
123 |
|
124 |
um_reset_user();
|
125 |
|
126 |
+
return $filtered_items;
|
127 |
+
}
|
128 |
+
add_filter( 'wp_nav_menu_objects', 'um_conditional_nav_menu', 9999, 2 );
|
129 |
+
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Conditional menu items
|
133 |
+
*
|
134 |
+
* @param $items
|
135 |
+
* @param $menu
|
136 |
+
* @param $args
|
137 |
+
*
|
138 |
+
* @return mixed
|
139 |
+
*/
|
140 |
+
function um_get_nav_menu_items( $items, $menu, $args ) {
|
141 |
+
return um_conditional_nav_menu( $items, $args );
|
142 |
}
|
143 |
+
add_filter( 'wp_get_nav_menu_items', 'um_get_nav_menu_items', 9999, 3 );
|
144 |
}
|
includes/core/um-navmenu.php
CHANGED
@@ -55,7 +55,8 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
|
|
55 |
// Sanitize
|
56 |
if ( ! empty( $_POST[ $key ][ $menu_item_db_id ] ) ) {
|
57 |
// Do some checks here...
|
58 |
-
$value = $_POST[ $key ][ $menu_item_db_id ]
|
|
|
59 |
} else {
|
60 |
$value = null;
|
61 |
}
|
@@ -152,7 +153,7 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
|
|
152 |
<p class="description description-wide um-nav-roles" <# if( data.restriction_data.um_nav_public == '2' ){ #>style="display: block;"<# } #>>
|
153 |
<?php _e( "Select the member roles that can see this link", 'ultimate-member' ) ?><br/>
|
154 |
|
155 |
-
<?php $options = UM()->roles()->get_roles();
|
156 |
$i = 0;
|
157 |
$html = '';
|
158 |
$columns = 2;
|
@@ -165,7 +166,7 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
|
|
165 |
$id_attr = ' id="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
|
166 |
$for_attr = ' for="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
|
167 |
$html .= "<label $for_attr>
|
168 |
-
<input type='checkbox' {$id_attr} name='menu-item-um_nav_roles[{{data.menuItemID}}][]' value='
|
169 |
<span>{$title}</span>
|
170 |
</label>";
|
171 |
}
|
55 |
// Sanitize
|
56 |
if ( ! empty( $_POST[ $key ][ $menu_item_db_id ] ) ) {
|
57 |
// Do some checks here...
|
58 |
+
$value = is_array( $_POST[ $key ][ $menu_item_db_id ] ) ?
|
59 |
+
array_keys( $_POST[ $key ][ $menu_item_db_id ] ) : $_POST[ $key ][ $menu_item_db_id ];
|
60 |
} else {
|
61 |
$value = null;
|
62 |
}
|
153 |
<p class="description description-wide um-nav-roles" <# if( data.restriction_data.um_nav_public == '2' ){ #>style="display: block;"<# } #>>
|
154 |
<?php _e( "Select the member roles that can see this link", 'ultimate-member' ) ?><br/>
|
155 |
|
156 |
+
<?php $options = UM()->roles()->get_roles( false, array( 'administrator' ) );
|
157 |
$i = 0;
|
158 |
$html = '';
|
159 |
$columns = 2;
|
166 |
$id_attr = ' id="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
|
167 |
$for_attr = ' for="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
|
168 |
$html .= "<label $for_attr>
|
169 |
+
<input type='checkbox' {$id_attr} name='menu-item-um_nav_roles[{{data.menuItemID}}][{$k}]' value='1' <# if( _.contains( data.restriction_data.um_nav_roles,'{$k}' ) ){ #>checked='checked'<# } #> />
|
170 |
<span>{$title}</span>
|
171 |
</label>";
|
172 |
}
|
includes/um-short-functions.php
CHANGED
@@ -442,7 +442,7 @@ function um_js_redirect( $url ) {
|
|
442 |
if (headers_sent() || empty( $url )) {
|
443 |
//for blank redirects
|
444 |
if ('' == $url) {
|
445 |
-
$url = (
|
446 |
}
|
447 |
|
448 |
$funtext = "echo \"<script data-cfasync='false' type='text/javascript'>window.location = '" . $url . "'</script>\";";
|
@@ -508,10 +508,11 @@ function um_user_submitted_registration( $style = false ) {
|
|
508 |
|
509 |
$data = um_user( 'submitted' );
|
510 |
|
511 |
-
if ($style)
|
512 |
$output .= '<div class="um-admin-infobox">';
|
|
|
513 |
|
514 |
-
if (isset( $data ) && is_array( $data )) {
|
515 |
|
516 |
/**
|
517 |
* UM hook
|
@@ -535,38 +536,51 @@ function um_user_submitted_registration( $style = false ) {
|
|
535 |
*/
|
536 |
$data = apply_filters( 'um_email_registration_data', $data );
|
537 |
|
538 |
-
|
|
|
539 |
|
540 |
-
if (
|
541 |
-
|
542 |
-
$v = um_user_uploads_uri() . $file;
|
543 |
}
|
544 |
|
545 |
-
if (
|
|
|
|
|
|
|
|
|
546 |
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
} else {
|
560 |
-
$output .= "$k: $v" . "<br />";
|
561 |
-
}
|
562 |
|
|
|
|
|
|
|
563 |
}
|
564 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
}
|
566 |
}
|
567 |
|
568 |
-
if ($style)
|
569 |
$output .= '</div>';
|
|
|
570 |
|
571 |
return $output;
|
572 |
}
|
@@ -710,6 +724,9 @@ function um_profile_id() {
|
|
710 |
* @return bool|string
|
711 |
*/
|
712 |
function um_is_temp_upload( $url ) {
|
|
|
|
|
|
|
713 |
|
714 |
if (filter_var( $url, FILTER_VALIDATE_URL ) === false)
|
715 |
$url = realpath( $url );
|
@@ -1244,7 +1261,11 @@ function um_can_view_field( $data ) {
|
|
1244 |
}
|
1245 |
|
1246 |
if ( is_user_logged_in() ) {
|
|
|
|
|
|
|
1247 |
$current_user_roles = um_user( 'roles' );
|
|
|
1248 |
|
1249 |
if ( $data['public'] == '-3' && ! um_is_user_himself() && ( empty( $current_user_roles ) || count( array_intersect( $current_user_roles, $data['roles'] ) ) <= 0 ) )
|
1250 |
return false;
|
@@ -1587,9 +1608,7 @@ function um_youtube_id_from_url( $url ) {
|
|
1587 |
* @return string
|
1588 |
*/
|
1589 |
function um_user_uploads_uri() {
|
1590 |
-
|
1591 |
-
UM()->files()->upload_baseurl = str_replace( "http://", "https://", UM()->files()->upload_baseurl );
|
1592 |
-
}
|
1593 |
|
1594 |
$uri = UM()->files()->upload_baseurl . um_user( 'ID' ) . '/';
|
1595 |
|
@@ -1699,33 +1718,23 @@ function um_get_avatar_uri( $image, $attrs ) {
|
|
1699 |
*/
|
1700 |
$cache_time = apply_filters( 'um_filter_avatar_cache_time', current_time( 'timestamp' ), um_user( 'ID' ) );
|
1701 |
|
1702 |
-
if (
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
if (file_exists( UM()->files()->upload_basedir . um_user( 'ID' ) . "/profile_photo-{$attrs}{$ext}" )) {
|
1707 |
-
|
1708 |
-
$uri = um_user_uploads_uri() . "profile_photo-{$attrs}{$ext}{$cache_time}";
|
1709 |
-
|
1710 |
} else {
|
1711 |
-
|
1712 |
$sizes = UM()->options()->get( 'photo_thumb_sizes' );
|
1713 |
if (is_array( $sizes )) $find = um_closest_num( $sizes, $attrs );
|
1714 |
|
1715 |
-
if (file_exists(
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
} else if (file_exists( UM()->files()->upload_basedir . um_user( 'ID' ) . "/profile_photo{$ext}" )) {
|
1720 |
-
|
1721 |
-
$uri = um_user_uploads_uri() . "profile_photo{$ext}{$cache_time}";
|
1722 |
-
|
1723 |
-
}
|
1724 |
-
|
1725 |
-
if ($attrs == 'original') {
|
1726 |
-
$uri = um_user_uploads_uri() . "profile_photo{$ext}{$cache_time}";
|
1727 |
}
|
|
|
1728 |
|
|
|
|
|
1729 |
}
|
1730 |
|
1731 |
return $uri;
|
@@ -1742,35 +1751,128 @@ function um_get_default_avatar_uri() {
|
|
1742 |
$uri = !empty( $uri['url'] ) ? $uri['url'] : '';
|
1743 |
if ( ! $uri ) {
|
1744 |
$uri = um_url . 'assets/img/default_avatar.jpg';
|
1745 |
-
} else {
|
1746 |
-
|
1747 |
-
//http <-> https compatibility default avatar option of SSL was changed
|
1748 |
-
$url_array = parse_url( $uri );
|
1749 |
-
|
1750 |
-
if (is_ssl() && $url_array['scheme'] == 'http') {
|
1751 |
-
$uri = str_replace( 'http://', 'https://', $uri );
|
1752 |
-
} else if (!is_ssl() && $url_array['scheme'] == 'https') {
|
1753 |
-
$uri = str_replace( 'https://', 'http://', $uri );
|
1754 |
-
}
|
1755 |
}
|
1756 |
|
1757 |
-
return $uri;
|
1758 |
}
|
1759 |
|
1760 |
|
1761 |
/**
|
1762 |
* get user avatar url
|
1763 |
*
|
|
|
|
|
|
|
1764 |
* @return bool|string
|
1765 |
*/
|
1766 |
-
function
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1772 |
|
1773 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1774 |
}
|
1775 |
|
1776 |
|
@@ -2059,88 +2161,15 @@ function um_user( $data, $attrs = null ) {
|
|
2059 |
break;
|
2060 |
|
2061 |
case 'profile_photo':
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
* @description Change user display name on um_user function profile photo
|
2072 |
-
* @input_vars
|
2073 |
-
* [{"var":"$display_name","type":"string","desc":"User Display Name"}]
|
2074 |
-
* @change_log
|
2075 |
-
* ["Since: 2.0"]
|
2076 |
-
* @usage add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 );
|
2077 |
-
* @example
|
2078 |
-
* <?php
|
2079 |
-
* add_filter( 'um_avatar_image_alternate_text', 'my_avatar_image_alternate_text', 10, 1 );
|
2080 |
-
* function my_avatar_image_alternate_text( $display_name ) {
|
2081 |
-
* // your code here
|
2082 |
-
* return $display_name;
|
2083 |
-
* }
|
2084 |
-
* ?>
|
2085 |
-
*/
|
2086 |
-
$image_alt = apply_filters( "um_avatar_image_alternate_text", um_user( "display_name" ) );
|
2087 |
-
|
2088 |
-
if (um_profile( 'profile_photo' )) {
|
2089 |
-
$avatar_uri = um_get_avatar_uri( um_profile( 'profile_photo' ), $attrs );
|
2090 |
-
$has_profile_photo = true;
|
2091 |
-
$photo_type = 'um-avatar-uploaded';
|
2092 |
-
} else if (um_user( 'synced_profile_photo' )) {
|
2093 |
-
$avatar_uri = um_user( 'synced_profile_photo' );
|
2094 |
-
} else {
|
2095 |
-
$avatar_uri = um_get_default_avatar_uri();
|
2096 |
-
}
|
2097 |
-
|
2098 |
-
/**
|
2099 |
-
* UM hook
|
2100 |
-
*
|
2101 |
-
* @type filter
|
2102 |
-
* @title um_user_avatar_url_filter
|
2103 |
-
* @description Change user avatar URL
|
2104 |
-
* @input_vars
|
2105 |
-
* [{"var":"$avatar_uri","type":"string","desc":"Avatar URL"},
|
2106 |
-
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
2107 |
-
* @change_log
|
2108 |
-
* ["Since: 2.0"]
|
2109 |
-
* @usage add_filter( 'um_user_avatar_url_filter', 'function_name', 10, 2 );
|
2110 |
-
* @example
|
2111 |
-
* <?php
|
2112 |
-
* add_filter( 'um_user_avatar_url_filter', 'my_user_avatar_url', 10, 2 );
|
2113 |
-
* function my_user_avatar_url( $avatar_uri ) {
|
2114 |
-
* // your code here
|
2115 |
-
* return $avatar_uri;
|
2116 |
-
* }
|
2117 |
-
* ?>
|
2118 |
-
*/
|
2119 |
-
$avatar_uri = apply_filters( 'um_user_avatar_url_filter', $avatar_uri, um_user( 'ID' ) );
|
2120 |
-
|
2121 |
-
|
2122 |
-
if (!$avatar_uri)
|
2123 |
-
return '';
|
2124 |
-
|
2125 |
-
if ( UM()->options()->get( 'use_gravatars' ) && !um_user( 'synced_profile_photo' ) && !$has_profile_photo) {
|
2126 |
-
$avatar_hash_id = get_user_meta( um_user( 'ID' ), 'synced_gravatar_hashed_id', true );
|
2127 |
-
$avatar_uri = um_get_domain_protocol() . 'gravatar.com/avatar/' . $avatar_hash_id;
|
2128 |
-
$avatar_uri = add_query_arg( 's', 400, $avatar_uri );
|
2129 |
-
$gravatar_type = UM()->options()->get( 'use_um_gravatar_default_builtin_image' );
|
2130 |
-
$photo_type = 'um-avatar-gravatar';
|
2131 |
-
if ( $gravatar_type == 'default' ) {
|
2132 |
-
if ( UM()->options()->get( 'use_um_gravatar_default_image' ) ) {
|
2133 |
-
$avatar_uri = add_query_arg( 'd', um_get_default_avatar_uri(), $avatar_uri );
|
2134 |
-
}
|
2135 |
-
} else {
|
2136 |
-
$avatar_uri = add_query_arg( 'd', $gravatar_type, $avatar_uri );
|
2137 |
-
}
|
2138 |
-
|
2139 |
-
}
|
2140 |
-
|
2141 |
-
$default_avatar = um_get_default_avatar_uri();
|
2142 |
-
|
2143 |
-
return '<img onerror="this.src=\''.esc_attr($default_avatar).'\';" src="' . $avatar_uri . '" class="func-um_user gravatar avatar avatar-' . $attrs . ' um-avatar ' . $photo_type . '" width="' . $attrs . '" height="' . $attrs . '" alt="' . $image_alt . '" />';
|
2144 |
|
2145 |
break;
|
2146 |
|
442 |
if (headers_sent() || empty( $url )) {
|
443 |
//for blank redirects
|
444 |
if ('' == $url) {
|
445 |
+
$url = set_url_scheme( '//' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );
|
446 |
}
|
447 |
|
448 |
$funtext = "echo \"<script data-cfasync='false' type='text/javascript'>window.location = '" . $url . "'</script>\";";
|
508 |
|
509 |
$data = um_user( 'submitted' );
|
510 |
|
511 |
+
if ( $style ) {
|
512 |
$output .= '<div class="um-admin-infobox">';
|
513 |
+
}
|
514 |
|
515 |
+
if ( isset( $data ) && is_array( $data ) ) {
|
516 |
|
517 |
/**
|
518 |
* UM hook
|
536 |
*/
|
537 |
$data = apply_filters( 'um_email_registration_data', $data );
|
538 |
|
539 |
+
$pw_fields = array();
|
540 |
+
foreach ( $data as $k => $v ) {
|
541 |
|
542 |
+
if ( strstr( $k, 'user_pass' ) || in_array( $k, array( 'g-recaptcha-response', 'request', '_wpnonce', '_wp_http_referer' ) ) ) {
|
543 |
+
continue;
|
|
|
544 |
}
|
545 |
|
546 |
+
if ( UM()->fields()->get_field_type( $k ) == 'password' ) {
|
547 |
+
$pw_fields[] = $k;
|
548 |
+
$pw_fields[] = 'confirm_' . $k;
|
549 |
+
continue;
|
550 |
+
}
|
551 |
|
552 |
+
if ( ! empty( $pw_fields ) && in_array( $k, $pw_fields ) ) {
|
553 |
+
continue;
|
554 |
+
}
|
555 |
|
556 |
+
if ( ! is_array( $v ) && strstr( $v, 'ultimatemember/temp' ) ) {
|
557 |
+
$file = basename( $v );
|
558 |
+
$v = um_user_uploads_uri() . $file;
|
559 |
+
}
|
560 |
|
561 |
+
if ( is_array( $v ) ) {
|
562 |
+
$v = implode( ',', $v );
|
563 |
+
}
|
|
|
|
|
|
|
564 |
|
565 |
+
if ( $k == 'timestamp' ) {
|
566 |
+
$k = __( 'date submitted', 'ultimate-member' );
|
567 |
+
$v = date( "d M Y H:i", $v );
|
568 |
}
|
569 |
|
570 |
+
if ( $style ) {
|
571 |
+
if ( ! $v ) {
|
572 |
+
$v = __( '(empty)', 'ultimate-member' );
|
573 |
+
}
|
574 |
+
$output .= "<p><label>$k</label><span>$v</span></p>";
|
575 |
+
} else {
|
576 |
+
$output .= "$k: $v" . "<br />";
|
577 |
+
}
|
578 |
}
|
579 |
}
|
580 |
|
581 |
+
if ( $style ) {
|
582 |
$output .= '</div>';
|
583 |
+
}
|
584 |
|
585 |
return $output;
|
586 |
}
|
724 |
* @return bool|string
|
725 |
*/
|
726 |
function um_is_temp_upload( $url ) {
|
727 |
+
if( is_string( $url ) ) {
|
728 |
+
$url = trim($url);
|
729 |
+
}
|
730 |
|
731 |
if (filter_var( $url, FILTER_VALIDATE_URL ) === false)
|
732 |
$url = realpath( $url );
|
1261 |
}
|
1262 |
|
1263 |
if ( is_user_logged_in() ) {
|
1264 |
+
$previous_user = um_user( 'ID' );
|
1265 |
+
um_fetch_user( get_current_user_id() );
|
1266 |
+
|
1267 |
$current_user_roles = um_user( 'roles' );
|
1268 |
+
um_fetch_user( $previous_user );
|
1269 |
|
1270 |
if ( $data['public'] == '-3' && ! um_is_user_himself() && ( empty( $current_user_roles ) || count( array_intersect( $current_user_roles, $data['roles'] ) ) <= 0 ) )
|
1271 |
return false;
|
1608 |
* @return string
|
1609 |
*/
|
1610 |
function um_user_uploads_uri() {
|
1611 |
+
UM()->files()->upload_baseurl = set_url_scheme( UM()->files()->upload_baseurl );
|
|
|
|
|
1612 |
|
1613 |
$uri = UM()->files()->upload_baseurl . um_user( 'ID' ) . '/';
|
1614 |
|
1718 |
*/
|
1719 |
$cache_time = apply_filters( 'um_filter_avatar_cache_time', current_time( 'timestamp' ), um_user( 'ID' ) );
|
1720 |
|
1721 |
+
if( $attrs == 'original' && file_exists( um_user_uploads_dir() . "profile_photo{$ext}" ) ) {
|
1722 |
+
$uri = um_user_uploads_uri() . "profile_photo{$ext}";
|
1723 |
+
} else if (file_exists( um_user_uploads_dir() . "profile_photo-{$attrs}{$ext}" )) {
|
1724 |
+
$uri = um_user_uploads_uri() . "profile_photo-{$attrs}{$ext}";
|
|
|
|
|
|
|
|
|
1725 |
} else {
|
|
|
1726 |
$sizes = UM()->options()->get( 'photo_thumb_sizes' );
|
1727 |
if (is_array( $sizes )) $find = um_closest_num( $sizes, $attrs );
|
1728 |
|
1729 |
+
if (file_exists( um_user_uploads_dir() . "profile_photo-{$find}{$ext}" )) {
|
1730 |
+
$uri = um_user_uploads_uri() . "profile_photo-{$find}{$ext}";
|
1731 |
+
} else if (file_exists( um_user_uploads_dir() . "profile_photo{$ext}" )) {
|
1732 |
+
$uri = um_user_uploads_uri() . "profile_photo{$ext}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1733 |
}
|
1734 |
+
}
|
1735 |
|
1736 |
+
if ( !empty( $cache_time ) ) {
|
1737 |
+
$uri .= "?{$cache_time}";
|
1738 |
}
|
1739 |
|
1740 |
return $uri;
|
1751 |
$uri = !empty( $uri['url'] ) ? $uri['url'] : '';
|
1752 |
if ( ! $uri ) {
|
1753 |
$uri = um_url . 'assets/img/default_avatar.jpg';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1754 |
}
|
1755 |
|
1756 |
+
return set_url_scheme( $uri );
|
1757 |
}
|
1758 |
|
1759 |
|
1760 |
/**
|
1761 |
* get user avatar url
|
1762 |
*
|
1763 |
+
* @param $user_id
|
1764 |
+
* @param $size
|
1765 |
+
*
|
1766 |
* @return bool|string
|
1767 |
*/
|
1768 |
+
function um_get_user_avatar_data( $user_id = '', $size = '96' ) {
|
1769 |
+
if( empty( $user_id ) ) {
|
1770 |
+
$user_id = um_user( 'ID' );
|
1771 |
+
} else {
|
1772 |
+
um_fetch_user( $user_id );
|
1773 |
+
}
|
1774 |
+
|
1775 |
+
$data = array(
|
1776 |
+
'user_id' => $user_id,
|
1777 |
+
'default' => um_get_default_avatar_uri(),
|
1778 |
+
'class' => 'gravatar avatar avatar-' . $size . ' um-avatar',
|
1779 |
+
'size' => $size
|
1780 |
+
);
|
1781 |
+
|
1782 |
+
if ( $profile_photo = um_profile( 'profile_photo' ) ) {
|
1783 |
+
$data['url'] = um_get_avatar_uri( $profile_photo, $size );
|
1784 |
+
$data['type'] = 'upload';
|
1785 |
+
$data['class'] .= ' um-avatar-uploaded';
|
1786 |
+
} else if( $synced_profile_photo = um_user( 'synced_profile_photo' ) ) {
|
1787 |
+
$data['url'] = $synced_profile_photo;
|
1788 |
+
$data['type'] = 'sync';
|
1789 |
+
$data['class'] .= ' um-avatar-default';
|
1790 |
+
} else if( UM()->options()->get( 'use_gravatars' ) ) {
|
1791 |
+
$avatar_hash_id = get_user_meta( $user_id, 'synced_gravatar_hashed_id', true );
|
1792 |
+
$data['url'] = set_url_scheme( '//gravatar.com/avatar/' . $avatar_hash_id );
|
1793 |
+
$data['url'] = add_query_arg( 's', 400, $data['url'] );
|
1794 |
+
$rating = get_option('avatar_rating');
|
1795 |
+
if ( !empty( $rating ) ) {
|
1796 |
+
$data['url'] = add_query_arg( 'r', $rating, $data['url'] );
|
1797 |
+
}
|
1798 |
+
$gravatar_type = UM()->options()->get( 'use_um_gravatar_default_builtin_image' );
|
1799 |
+
if ( $gravatar_type == 'default' ) {
|
1800 |
+
if ( UM()->options()->get( 'use_um_gravatar_default_image' ) ) {
|
1801 |
+
$data['url'] = add_query_arg( 'd', $data['default'], $data['url'] );
|
1802 |
+
}
|
1803 |
+
} else {
|
1804 |
+
$default = get_option( 'avatar_default', 'mystery' );
|
1805 |
+
if ( $default == 'gravatar_default' ) {
|
1806 |
+
$default = '';
|
1807 |
+
}
|
1808 |
+
$data['url'] = add_query_arg( 'd', $default, $data['url'] );
|
1809 |
+
}
|
1810 |
+
$data['type'] = 'gravatar';
|
1811 |
+
$data['class'] .= ' um-avatar-gravatar';
|
1812 |
+
} else {
|
1813 |
+
$data['url'] = $data['default'];
|
1814 |
+
$data['type'] = 'default';
|
1815 |
+
$data['class'] .= ' um-avatar-default';
|
1816 |
+
}
|
1817 |
+
|
1818 |
+
/**
|
1819 |
+
* UM hook
|
1820 |
+
*
|
1821 |
+
* @type filter
|
1822 |
+
* @title um_user_avatar_url_filter
|
1823 |
+
* @description Change user avatar URL
|
1824 |
+
* @input_vars
|
1825 |
+
* [{"var":"$avatar_uri","type":"string","desc":"Avatar URL"},
|
1826 |
+
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
1827 |
+
* @change_log
|
1828 |
+
* ["Since: 2.0"]
|
1829 |
+
* @usage add_filter( 'um_user_avatar_url_filter', 'function_name', 10, 2 );
|
1830 |
+
* @example
|
1831 |
+
* <?php
|
1832 |
+
* add_filter( 'um_user_avatar_url_filter', 'my_user_avatar_url', 10, 2 );
|
1833 |
+
* function my_user_avatar_url( $avatar_uri ) {
|
1834 |
+
* // your code here
|
1835 |
+
* return $avatar_uri;
|
1836 |
+
* }
|
1837 |
+
* ?>
|
1838 |
+
*/
|
1839 |
+
$data['url'] = apply_filters( 'um_user_avatar_url_filter', $data['url'], $user_id, $data );
|
1840 |
+
/**
|
1841 |
+
* UM hook
|
1842 |
+
*
|
1843 |
+
* @type filter
|
1844 |
+
* @title um_avatar_image_alternate_text
|
1845 |
+
* @description Change user display name on um_user function profile photo
|
1846 |
+
* @input_vars
|
1847 |
+
* [{"var":"$display_name","type":"string","desc":"User Display Name"}]
|
1848 |
+
* @change_log
|
1849 |
+
* ["Since: 2.0"]
|
1850 |
+
* @usage add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 );
|
1851 |
+
* @example
|
1852 |
+
* <?php
|
1853 |
+
* add_filter( 'um_avatar_image_alternate_text', 'my_avatar_image_alternate_text', 10, 1 );
|
1854 |
+
* function my_avatar_image_alternate_text( $display_name ) {
|
1855 |
+
* // your code here
|
1856 |
+
* return $display_name;
|
1857 |
+
* }
|
1858 |
+
* ?>
|
1859 |
+
*/
|
1860 |
+
$data['alt'] = apply_filters( "um_avatar_image_alternate_text", um_user( "display_name" ), $data );
|
1861 |
+
|
1862 |
+
return $data;
|
1863 |
+
}
|
1864 |
|
1865 |
+
/**
|
1866 |
+
* get user avatar url
|
1867 |
+
*
|
1868 |
+
* @param $user_id
|
1869 |
+
* @param $size
|
1870 |
+
*
|
1871 |
+
* @return bool|string
|
1872 |
+
*/
|
1873 |
+
function um_get_user_avatar_url( $user_id = '', $size = '96' ) {
|
1874 |
+
$data = um_get_user_avatar_data( $user_id, $size );
|
1875 |
+
return $data['url'];
|
1876 |
}
|
1877 |
|
1878 |
|
2161 |
break;
|
2162 |
|
2163 |
case 'profile_photo':
|
2164 |
+
$data = um_get_user_avatar_data( um_user( 'ID' ), $attrs );
|
2165 |
+
|
2166 |
+
return '<img src="' . esc_attr($data['url']) . '"
|
2167 |
+
class="' . esc_attr($data['class']) . '"
|
2168 |
+
width="' . esc_attr($data['size']) . '"
|
2169 |
+
height="' . esc_attr($data['size']) . '"
|
2170 |
+
alt="' . esc_attr($data['alt']) . '"
|
2171 |
+
data-default="' . esc_attr($data['default']) . '"
|
2172 |
+
onerror="if(!this.getAttribute(\'data-load-error\')){this.setAttribute(\'data-load-error\', \'1\');this.setAttribute(\'src\', this.getAttribute(\'data-default\'));}" />'; //don't move attribute before src
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2173 |
|
2174 |
break;
|
2175 |
|
readme.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
=== Ultimate Member - User Profile & Membership Plugin ===
|
2 |
Author URI: https://ultimatemember.com/
|
3 |
Plugin URI: https://ultimatemember.com/
|
4 |
Contributors: ultimatemember, champsupertramp, nsinelnikov
|
@@ -6,7 +6,7 @@ Donate link:
|
|
6 |
Tags: community, member, membership, user-profile, user-registration
|
7 |
Requires at least: 4.1
|
8 |
Tested up to: 4.9
|
9 |
-
Stable tag:
|
10 |
License: GNU Version 2 or Any Later Version
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
12 |
|
@@ -71,6 +71,10 @@ If you're a developer and would like to contribute to the source code of the plu
|
|
71 |
|
72 |
Want to add a new language to Ultimate Member? Great! You can contribute via [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/ultimate-member).
|
73 |
|
|
|
|
|
|
|
|
|
74 |
= Documentation & Support =
|
75 |
|
76 |
Got a problem or need help with Ultimate Member? Head over to our [documentation](http://docs.ultimatemember.com/) and perform a search of the knowledge base. If you can’t find a solution to your issue then you can create a topic on the [support forum](https://wordpress.org/support/plugin/ultimate-member).
|
@@ -125,6 +129,154 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
|
125 |
|
126 |
== Changelog ==
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
= 1.3.88: July 25, 2017 =
|
130 |
|
1 |
+
=== Ultimate Member - User Profile & Membership Plugin ===
|
2 |
Author URI: https://ultimatemember.com/
|
3 |
Plugin URI: https://ultimatemember.com/
|
4 |
Contributors: ultimatemember, champsupertramp, nsinelnikov
|
6 |
Tags: community, member, membership, user-profile, user-registration
|
7 |
Requires at least: 4.1
|
8 |
Tested up to: 4.9
|
9 |
+
Stable tag: 2.0.17
|
10 |
License: GNU Version 2 or Any Later Version
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
12 |
|
71 |
|
72 |
Want to add a new language to Ultimate Member? Great! You can contribute via [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/ultimate-member).
|
73 |
|
74 |
+
If you are a developer and you need to know the list of UM Hooks, make this via our [Hooks Documentation](https://docs.ultimatemember.com/article/1324-hooks-list).
|
75 |
+
|
76 |
+
If you are a developer and you need to know the structure of our code, make this via our [Documentation API](https://ultimatemember.com/php-docs/).
|
77 |
+
|
78 |
= Documentation & Support =
|
79 |
|
80 |
Got a problem or need help with Ultimate Member? Head over to our [documentation](http://docs.ultimatemember.com/) and perform a search of the knowledge base. If you can’t find a solution to your issue then you can create a topic on the [support forum](https://wordpress.org/support/plugin/ultimate-member).
|
129 |
|
130 |
== Changelog ==
|
131 |
|
132 |
+
= Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin =
|
133 |
+
|
134 |
+
= 2.0.17: May 30, 2018 =
|
135 |
+
|
136 |
+
* Enhancements:
|
137 |
+
- Added UM dashboard widget for getting latest extension's upgrades
|
138 |
+
|
139 |
+
* Bugfixes:
|
140 |
+
- Fixed User Profile restriction when the user isn't logged in
|
141 |
+
- Fixed Profile Tabs displaying on desktop/mobile
|
142 |
+
- Fixed set user status after registration on some installs
|
143 |
+
- Fixed PHP memory limit issue on some installs with small PHP memory limit
|
144 |
+
- Fixed PHP validation on submit UM Forms with conditional fields logic
|
145 |
+
|
146 |
+
= 2.0.16: May 23, 2018 =
|
147 |
+
|
148 |
+
* Bugfixes:
|
149 |
+
- Fixed Profile Tabs issues
|
150 |
+
|
151 |
+
= 2.0.15: May 22, 2018 =
|
152 |
+
|
153 |
+
* Bugfixes:
|
154 |
+
- Fixed GDPR min.js script
|
155 |
+
|
156 |
+
= 2.0.14: May 22, 2018 =
|
157 |
+
|
158 |
+
* Enhancements:
|
159 |
+
- Added support for GDPR Personal Data Exporter
|
160 |
+
- Added support for GDPR Personal Data Eraser
|
161 |
+
- Added new privacy field to form builder for GDPR consent collection
|
162 |
+
- Added GDPR privacy policy guide text
|
163 |
+
- Added GDPR compatibility on delete user process
|
164 |
+
- Added security to Restricted posts comments
|
165 |
+
- Added security to custom field type `Password`
|
166 |
+
- Deprecated time checking spam bot
|
167 |
+
|
168 |
+
* Bugfixes:
|
169 |
+
- Fixed settings tabs for PHP7.1
|
170 |
+
- Fixed issues with Profile Tabs
|
171 |
+
- Fixed User Avatars
|
172 |
+
- Fixed set user status on Registration process
|
173 |
+
- Fixed Account Privacy tab content
|
174 |
+
|
175 |
+
= 2.0.13: May 2, 2018 =
|
176 |
+
|
177 |
+
* Bugfixes:
|
178 |
+
- Fixed and optimized user avatars
|
179 |
+
- Fixed Profile Menu on some installs
|
180 |
+
- Fixed fields IDs duplicates
|
181 |
+
- Fixed cache users count
|
182 |
+
|
183 |
+
= 2.0.12: April 30, 2018 =
|
184 |
+
|
185 |
+
* Bugfixes:
|
186 |
+
- Fixed approving users with "Administrator" role
|
187 |
+
- Fixed problem with URLs for upload images
|
188 |
+
- Fixed not UM roles, which start from "um_" symbols
|
189 |
+
- Fixed content restriction logic
|
190 |
+
|
191 |
+
= 2.0.11: April 19, 2018 =
|
192 |
+
|
193 |
+
* Bugfixes:
|
194 |
+
- Fixed profile form JS
|
195 |
+
|
196 |
+
= 2.0.10: April 17, 2018 =
|
197 |
+
|
198 |
+
* Bugfixes:
|
199 |
+
- Fixed Profile Form field privacy
|
200 |
+
- Fixed conditional menu logic for 2 different nav menu hooks
|
201 |
+
- Fixed registration form preview on wp-admin screen
|
202 |
+
- Restored old CSS settings to "um_old_settings.css"
|
203 |
+
- Clean user's cache
|
204 |
+
|
205 |
+
= 2.0.9: April 15, 2018 =
|
206 |
+
|
207 |
+
* Bugfixes:
|
208 |
+
- Fixed registration form role
|
209 |
+
|
210 |
+
= 2.0.8: April 13, 2018 =
|
211 |
+
|
212 |
+
* Bugfixes:
|
213 |
+
- Fixed license activation
|
214 |
+
|
215 |
+
= 2.0.7: April 13, 2018 =
|
216 |
+
|
217 |
+
* Bugfixes:
|
218 |
+
- Fixed add rewrite rules for UM pages
|
219 |
+
- Fixed Profile Form, Registration Form use custom settings and role
|
220 |
+
- Fixed save settings security
|
221 |
+
|
222 |
+
= 2.0.6: April 12, 2018 =
|
223 |
+
|
224 |
+
* Bugfixes:
|
225 |
+
- Fixed nav-menu content restriction issues for Administrator role
|
226 |
+
|
227 |
+
= 2.0.5: April 12, 2018 =
|
228 |
+
|
229 |
+
* Bugfixes:
|
230 |
+
- Fixed old pre2.0 extensions notices
|
231 |
+
- Fixed nav-menu content restriction issues
|
232 |
+
- Fixed lost password URL in UM Login Form
|
233 |
+
- Fixed restriction message on taxonomy page, which is restricted
|
234 |
+
|
235 |
+
= 2.0.4: April 10, 2018 =
|
236 |
+
|
237 |
+
* Enhancements:
|
238 |
+
- Added activation dependencies for extensions
|
239 |
+
- Added Licenses checking and changed Licenses page
|
240 |
+
- Added uninstall.php file for delete permanently all UM settings
|
241 |
+
- Added ability to register users without WP Registration enabled
|
242 |
+
- Added visual integration WPML+UM email notifications
|
243 |
+
- Added Account Upgrade email notification
|
244 |
+
- Added ability to register users using role field on Registration Form
|
245 |
+
- Added Account page shortcodes for each tab content
|
246 |
+
- Changed UM Option View (deprecated/added options)
|
247 |
+
- Changed UM Roles, optimized for WP native logic
|
248 |
+
- Changed backend forms/fields to WP native styles
|
249 |
+
- Changed Content Restriction feature for posts, taxonomies, menus
|
250 |
+
- Changed Email Notifications settings and using templates logic
|
251 |
+
- Deprecated Redux Framework
|
252 |
+
- Deprecated old unusable options
|
253 |
+
- Deprecated old unusable forms metadata
|
254 |
+
- Deprecated old unusable member directories metadata
|
255 |
+
- Deprecated old unusable user roles metadata
|
256 |
+
- Optimized registration/upgrade profile process (some hook deprecated)
|
257 |
+
- Optimized some code parts, deprecated some functions
|
258 |
+
- Updated `FontAwesome` library
|
259 |
+
- Removed addons to separate extensions
|
260 |
+
- Created Plugin Updater for getting updates and license details from Shop
|
261 |
+
- Increased integration abilities, added new hooks (see new Hooks Docs + PHP documentation);
|
262 |
+
- Integrated plugin activation, user creation processes with multisite
|
263 |
+
- Make dependencies with extensions
|
264 |
+
- OOP structure without procedural methods for wp-admin side;
|
265 |
+
|
266 |
+
* Bugfixes:
|
267 |
+
- Fixed avatars on some SSL installs
|
268 |
+
- Fixed some vulnerabilities
|
269 |
+
- Fixed integrations with core/extensions
|
270 |
+
- Fixed `Edit Profile` button at members directory
|
271 |
+
- Fixed conditional logic PHP validation and JS validation (for IE,Edge browsers)
|
272 |
+
- Fixed textdomains for translations
|
273 |
+
- Fixed integration with Woocommerce, SEO Framework, WPML
|
274 |
+
- Fixed navigation menu items custom fields (`Mega Menu`, etc. compatibility)
|
275 |
+
- Fixed theme conflicts with UM js libraries
|
276 |
+
- Fixed and optimized handlers for user permalinks
|
277 |
+
- Fixed replace placeholders for users
|
278 |
+
- Fixed conditional fields logic
|
279 |
+
- Fixed fields sanitize for remove XSS injections
|
280 |
|
281 |
= 1.3.88: July 25, 2017 =
|
282 |
|
templates/gdpr-register.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php ?>
|
2 |
+
|
3 |
+
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
4 |
+
<div class="um-field um-field-type_terms_conditions" data-key="use_terms_conditions_agreement" style="display:block;padding:0;">
|
5 |
+
<div class="um-field-area">
|
6 |
+
<div class='um-gdpr-content' style="display:none;">
|
7 |
+
<?php if ( ! empty( $args['use_gdpr_content_id'] ) ) {
|
8 |
+
$um_content_query = get_post( $args['use_gdpr_content_id'] );
|
9 |
+
if ( isset( $um_content_query ) ) {
|
10 |
+
echo apply_filters( 'um_gdpr_policies_page_content', $um_content_query->post_content, $args );
|
11 |
+
}
|
12 |
+
} ?>
|
13 |
+
</div>
|
14 |
+
<a href="javascript:;" class="um-toggle-gdpr" data-toggle-state="hidden"
|
15 |
+
data-toggle-show="<?php echo ! empty( $args['use_gdpr_toggle_show'] ) ? $args['use_gdpr_toggle_show'] : __( 'Show privacy policy', 'ultimate-member' ); ?>"
|
16 |
+
data-toggle-hide="<?php echo ! empty( $args['use_gdpr_toggle_hide'] ) ? $args['use_gdpr_toggle_hide'] : __( 'Hide privacy policy', 'ultimate-member' ); ?>">
|
17 |
+
<?php echo ! empty( $args['use_gdpr_toggle_show'] ) ? $args['use_gdpr_toggle_show'] : __( 'Show privacy policy', 'ultimate-member' ); ?>
|
18 |
+
</a>
|
19 |
+
</div>
|
20 |
+
<div class="um-field-area">
|
21 |
+
|
22 |
+
<label class="um-field-checkbox">
|
23 |
+
<input type="checkbox" name="use_gdpr_agreement" value="1">
|
24 |
+
<span class="um-field-checkbox-state">
|
25 |
+
<i class="um-icon-android-checkbox-outline-blank"></i>
|
26 |
+
</span>
|
27 |
+
<span class="um-field-checkbox-option">
|
28 |
+
<?php echo ! empty( $args['use_gdpr_agreement'] ) ? $args['use_gdpr_agreement'] : __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ); ?>
|
29 |
+
</span>
|
30 |
+
</label>
|
31 |
+
<div class="um-clear"></div>
|
32 |
+
|
33 |
+
<?php $errors = UM()->form()->errors;
|
34 |
+
|
35 |
+
if ( isset( $errors['use_gdpr_agreement'] ) ) {
|
36 |
+
|
37 |
+
$error_message = ! empty( $args['use_gdpr_error_text'] ) ? $args['use_gdpr_error_text'] : __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' );
|
38 |
+
|
39 |
+
echo '<p class="um-notice err"><i class="um-icon-ios-close-empty" onclick="jQuery(this).parent().fadeOut();"></i>' . $error_message . '</p><br/>';
|
40 |
+
} ?>
|
41 |
+
|
42 |
+
<div class="um-clear"></div>
|
43 |
+
</div>
|
44 |
+
</div>
|
templates/members-grid.php
CHANGED
@@ -100,7 +100,7 @@
|
|
100 |
continue;
|
101 |
?>
|
102 |
|
103 |
-
<div class="um-member-tagline um-member-tagline-<?php echo $key;?>"><?php
|
104 |
|
105 |
<?php
|
106 |
} // end if
|
@@ -124,7 +124,7 @@
|
|
124 |
if ( ! $value )
|
125 |
continue; ?>
|
126 |
|
127 |
-
<div class="um-member-metaline um-member-metaline-<?php echo $key; ?>"><span><strong><?php echo UM()->fields()->get_label( $key ); ?>:</strong> <?php
|
128 |
|
129 |
<?php }
|
130 |
}
|
100 |
continue;
|
101 |
?>
|
102 |
|
103 |
+
<div class="um-member-tagline um-member-tagline-<?php echo $key;?>"><?php _e( $value, 'ultimate-member'); ?></div>
|
104 |
|
105 |
<?php
|
106 |
} // end if
|
124 |
if ( ! $value )
|
125 |
continue; ?>
|
126 |
|
127 |
+
<div class="um-member-metaline um-member-metaline-<?php echo $key; ?>"><span><strong><?php echo UM()->fields()->get_label( $key ); ?>:</strong> <?php _e( $value, 'ultimate-member'); ?></span></div>
|
128 |
|
129 |
<?php }
|
130 |
}
|
templates/restricted-taxonomy.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
get_header(); ?>
|
4 |
+
|
5 |
+
<div class="wrap">
|
6 |
+
|
7 |
+
<?php if ( have_posts() ) : ?>
|
8 |
+
<header class="page-header">
|
9 |
+
<?php
|
10 |
+
the_archive_title( '<h1 class="page-title">', '</h1>' );
|
11 |
+
the_archive_description( '<div class="taxonomy-description">', '</div>' );
|
12 |
+
?>
|
13 |
+
</header><!-- .page-header -->
|
14 |
+
<?php endif; ?>
|
15 |
+
|
16 |
+
<div id="primary" class="content-area">
|
17 |
+
<main id="main" class="site-main" role="main">
|
18 |
+
|
19 |
+
<?php if ( is_tag() ) {
|
20 |
+
$tag_id = get_query_var( 'tag_id' );
|
21 |
+
if ( ! empty( $tag_id ) ) {
|
22 |
+
$restriction = get_term_meta( $tag_id, 'um_content_restriction', true );
|
23 |
+
}
|
24 |
+
} elseif ( is_category() ) {
|
25 |
+
$um_category = get_category( get_query_var( 'cat' ) );
|
26 |
+
|
27 |
+
if ( ! empty( $um_category->term_id ) ) {
|
28 |
+
$restriction = get_term_meta( $um_category->term_id, 'um_content_restriction', true );
|
29 |
+
}
|
30 |
+
} elseif ( is_tax() ) {
|
31 |
+
$tax_name = get_query_var( 'taxonomy' );
|
32 |
+
$term_name = get_query_var( 'term' );
|
33 |
+
$term = get_term_by( 'slug', $term_name, $tax_name );
|
34 |
+
if ( ! empty( $term->term_id ) ) {
|
35 |
+
$restriction = get_term_meta( $term->term_id, 'um_content_restriction', true );
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
if ( ! isset( $restriction['_um_restrict_by_custom_message'] ) || '0' == $restriction['_um_restrict_by_custom_message'] ) {
|
40 |
+
$restricted_global_message = UM()->options()->get( 'restricted_access_message' );
|
41 |
+
$message = stripslashes( $restricted_global_message );
|
42 |
+
} elseif ( '1' == $restriction['_um_restrict_by_custom_message'] ) {
|
43 |
+
$message = ! empty( $restriction['_um_restrict_custom_message'] ) ? stripslashes( $restriction['_um_restrict_custom_message'] ) : '';
|
44 |
+
}
|
45 |
+
|
46 |
+
echo $message; ?>
|
47 |
+
|
48 |
+
</main><!-- #main -->
|
49 |
+
</div><!-- #primary -->
|
50 |
+
<?php get_sidebar(); ?>
|
51 |
+
</div><!-- .wrap -->
|
52 |
+
|
53 |
+
<?php get_footer();
|
ultimate-member.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Ultimate Member
|
4 |
Plugin URI: http://ultimatemember.com/
|
5 |
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
6 |
-
Version: 2.0.
|
7 |
Author: Ultimate Member
|
8 |
Author URI: http://ultimatemember.com/
|
9 |
Text Domain: ultimate-member
|
3 |
Plugin Name: Ultimate Member
|
4 |
Plugin URI: http://ultimatemember.com/
|
5 |
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
6 |
+
Version: 2.0.17
|
7 |
Author: Ultimate Member
|
8 |
Author URI: http://ultimatemember.com/
|
9 |
Text Domain: ultimate-member
|