mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Merge pull request #1628 from ultimatemember/development/2.9.x
Version 2.10.0
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
"step": "installPlugin",
|
||||
"pluginZipFile": {
|
||||
"resource": "url",
|
||||
"url": "https:\/\/downloads.wordpress.org\/plugin\/ultimate-member.2.9.2.zip"
|
||||
"url": "https:\/\/downloads.wordpress.org\/plugin\/ultimate-member.2.10.0.zip"
|
||||
},
|
||||
"options": {
|
||||
"activate": true
|
||||
|
||||
@@ -44,7 +44,7 @@ GNU Version 2 or Any Later Version
|
||||
|
||||
### IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION
|
||||
|
||||
[Official Release Version: 2.9.2](https://github.com/ultimatemember/ultimatemember/releases/tag/2.9.2).
|
||||
[Official Release Version: 2.10.0](https://github.com/ultimatemember/ultimatemember/releases/tag/2.10.0).
|
||||
|
||||
## Changelog
|
||||
|
||||
|
||||
+33
-3
@@ -107,9 +107,12 @@ jQuery(document).ready(function() {
|
||||
var form_id = 0;
|
||||
var mode = '';
|
||||
if ( jQuery('div.um-field-image[data-key="' + key + '"]').length === 1 ) {
|
||||
var $formWrapper = jQuery('div.um-field-image[data-key="' + key + '"]').closest('.um-form');
|
||||
form_id = $formWrapper.find('input[name="form_id"]').val();
|
||||
mode = $formWrapper.attr('data-mode');
|
||||
let $formWrapper = jQuery('div.um-field-image[data-key="' + key + '"]').closest('.um-form');
|
||||
form_id = $formWrapper.data('form_id') || $formWrapper.find('input[name="form_id"]').val(); // 'input[name="form_id"]' is a backward compatibility.
|
||||
mode = $formWrapper.data('mode');
|
||||
} else {
|
||||
console.warn( wp.i18n.__( 'UM Warning: No field associated with image uploader.', 'ultimate-member' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( jQuery('.cropper-hidden').length > 0 && UM.frontend.cropper.obj ) {
|
||||
@@ -140,11 +143,38 @@ jQuery(document).ready(function() {
|
||||
|
||||
if ( key === 'profile_photo' ) {
|
||||
jQuery('.um-profile-photo-img img').attr('src', response.data.image.source_url + "?"+d.getTime());
|
||||
|
||||
let $dropdown = jQuery('.um-profile-photo .um-dropdown');
|
||||
if ( ! $dropdown.find('.um-reset-profile-photo').hasClass('um-is-visible') ) {
|
||||
let $dropdownItem = $dropdown.find('.um-manual-trigger[data-parent=".um-profile-photo"]');
|
||||
let altText = $dropdownItem.data('alt_text');
|
||||
$dropdownItem.data( 'alt_text', $dropdownItem.text() ).text( altText );
|
||||
|
||||
$dropdown.find('.um-reset-profile-photo').addClass('um-is-visible').show();
|
||||
}
|
||||
|
||||
if ( ! jQuery('.um').hasClass('um-editing') ) {
|
||||
$dropdown.remove();
|
||||
}
|
||||
} else if ( key === 'cover_photo' ) {
|
||||
jQuery('.um-cover-e').empty().html('<img src="' + response.data.image.source_url + "?"+d.getTime() + '" alt="" />');
|
||||
|
||||
let $dropdown = jQuery('.um-cover .um-dropdown');
|
||||
if ( ! $dropdown.find('.um-reset-cover-photo').hasClass('um-is-visible') ) {
|
||||
let $dropdownItem = $dropdown.find('.um-manual-trigger[data-parent=".um-cover"]');
|
||||
let altText = $dropdownItem.data('alt_text');
|
||||
$dropdownItem.data( 'alt_text', $dropdownItem.text() ).text( altText );
|
||||
|
||||
$dropdown.find('.um-reset-cover-photo').addClass('um-is-visible').show();
|
||||
}
|
||||
|
||||
if ( jQuery('.um').hasClass('um-editing') ) {
|
||||
jQuery('.um-cover-overlay').show();
|
||||
} else {
|
||||
$dropdown.remove();
|
||||
}
|
||||
|
||||
um_responsive();
|
||||
}
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', response.data.image.source_url + "?"+d.getTime());
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
jQuery(document).ready(function(){jQuery(document).on("click",".um-popup-overlay",function(){remove_Modal()}),jQuery(document).on("click",'.um-modal-overlay, a[data-action="um_remove_modal"]',function(){um_remove_modal()}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"], .um-modal:not(:has(.um-form)) a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-finish-upload.file:not(.disabled)",function(){var e=jQuery(this).attr("data-key"),a=jQuery(this).parents(".um-modal-body").find(".um-single-file-preview").html(),a=(um_remove_modal(),jQuery(".um-single-file-preview[data-key="+e+"]").fadeIn().html(a),jQuery(".um-field[data-key="+e+"]").find(".um-single-fileinfo a").data("file"));jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-btn-auto-width").html(jQuery(this).attr("data-change")),jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find('input[type="hidden"]').val(a)}),jQuery(document).on("click",".um-finish-upload.image:not(.disabled)",function(){var a,e,t=jQuery(this),i=jQuery(this).attr("data-key"),r=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),u=r.find("img").attr("src"),r=r.find("img").data("file"),d=0,m=(jQuery(this).parents("#um_upload_single").data("user_id")&&(d=jQuery(this).parents("#um_upload_single").data("user_id")),0),n="";1===jQuery('div.um-field-image[data-key="'+i+'"]').length&&(m=(e=jQuery('div.um-field-image[data-key="'+i+'"]').closest(".um-form")).find('input[name="form_id"]').val(),n=e.attr("data-mode")),0<jQuery(".cropper-hidden").length&&UM.frontend.cropper.obj?(e=UM.frontend.cropper.obj.getData(),e=Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height),jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_resize_image",src:u,coord:e,user_id:d,key:i,set_id:m,set_mode:n,nonce:um_scripts.nonce},success:function(e){e.success&&(a=new Date,"profile_photo"===i?jQuery(".um-profile-photo-img img").attr("src",e.data.image.source_url+"?"+a.getTime()):"cover_photo"===i&&(jQuery(".um-cover-e").empty().html('<img src="'+e.data.image.source_url+"?"+a.getTime()+'" alt="" />'),jQuery(".um").hasClass("um-editing"))&&jQuery(".um-cover-overlay").show(),jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",e.data.image.source_url+"?"+a.getTime()),um_remove_modal(),jQuery("img.cropper-invisible").remove(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find('input[type="hidden"]').val(e.data.image.filename))}})):(a=new Date,jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",u+"?"+a.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find("input[type=hidden]").val(r))}),jQuery(document.body).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal"),t="normal";jQuery(this).data("modal-size")&&(t=jQuery(this).data("modal-size")),jQuery(this).data("modal-copy")&&(jQuery("#"+a).html(jQuery(this).parents(".um-field").find(".um-modal-hidden-content").html()),jQuery(this).parents(".um-profile-photo").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-profile-photo").attr("data-user_id")),jQuery(this).parents(".um-cover").attr("data-ratio")&&jQuery("#"+a).attr("data-ratio",jQuery(this).parents(".um-cover").attr("data-ratio")),jQuery(this).parents(".um-cover").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-cover").attr("data-user_id")),0<jQuery('input[type="hidden"][name="user_id"]').length)&&jQuery("#"+a).attr("data-user_id",jQuery('input[type="hidden"][name="user_id"]').val()),um_new_modal(a,t)})});
|
||||
jQuery(document).ready(function(){jQuery(document).on("click",".um-popup-overlay",function(){remove_Modal()}),jQuery(document).on("click",'.um-modal-overlay, a[data-action="um_remove_modal"]',function(){um_remove_modal()}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"], .um-modal:not(:has(.um-form)) a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-finish-upload.file:not(.disabled)",function(){var e=jQuery(this).attr("data-key"),a=jQuery(this).parents(".um-modal-body").find(".um-single-file-preview").html(),a=(um_remove_modal(),jQuery(".um-single-file-preview[data-key="+e+"]").fadeIn().html(a),jQuery(".um-field[data-key="+e+"]").find(".um-single-fileinfo a").data("file"));jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-btn-auto-width").html(jQuery(this).attr("data-change")),jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find('input[type="hidden"]').val(a)}),jQuery(document).on("click",".um-finish-upload.image:not(.disabled)",function(){var r,e,u=jQuery(this),d=jQuery(this).attr("data-key"),a=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),t=a.find("img").attr("src"),a=a.find("img").data("file"),i=0,m=(jQuery(this).parents("#um_upload_single").data("user_id")&&(i=jQuery(this).parents("#um_upload_single").data("user_id")),0),n="";1!==jQuery('div.um-field-image[data-key="'+d+'"]').length?console.warn(wp.i18n.__("UM Warning: No field associated with image uploader.","ultimate-member")):(m=(e=jQuery('div.um-field-image[data-key="'+d+'"]').closest(".um-form")).data("form_id")||e.find('input[name="form_id"]').val(),n=e.data("mode"),0<jQuery(".cropper-hidden").length&&UM.frontend.cropper.obj?(e=UM.frontend.cropper.obj.getData(),e=Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height),jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_resize_image",src:t,coord:e,user_id:i,key:d,set_id:m,set_mode:n,nonce:um_scripts.nonce},success:function(e){var a,t,i;e.success&&(r=new Date,"profile_photo"===d?(jQuery(".um-profile-photo-img img").attr("src",e.data.image.source_url+"?"+r.getTime()),(i=jQuery(".um-profile-photo .um-dropdown")).find(".um-reset-profile-photo").hasClass("um-is-visible")||(t=(a=i.find('.um-manual-trigger[data-parent=".um-profile-photo"]')).data("alt_text"),a.data("alt_text",a.text()).text(t),i.find(".um-reset-profile-photo").addClass("um-is-visible").show()),jQuery(".um").hasClass("um-editing")||i.remove()):"cover_photo"===d&&(jQuery(".um-cover-e").empty().html('<img src="'+e.data.image.source_url+"?"+r.getTime()+'" alt="" />'),(a=jQuery(".um-cover .um-dropdown")).find(".um-reset-cover-photo").hasClass("um-is-visible")||(i=(t=a.find('.um-manual-trigger[data-parent=".um-cover"]')).data("alt_text"),t.data("alt_text",t.text()).text(i),a.find(".um-reset-cover-photo").addClass("um-is-visible").show()),jQuery(".um").hasClass("um-editing")?jQuery(".um-cover-overlay").show():a.remove(),um_responsive()),jQuery(".um-single-image-preview[data-key="+d+"]").fadeIn().find("img").attr("src",e.data.image.source_url+"?"+r.getTime()),um_remove_modal(),jQuery("img.cropper-invisible").remove(),jQuery(".um-single-image-preview[data-key="+d+"]").parents(".um-field").find(".um-btn-auto-width").html(u.attr("data-change")),jQuery(".um-single-image-preview[data-key="+d+"]").parents(".um-field").find('input[type="hidden"]').val(e.data.image.filename))}})):(r=new Date,jQuery(".um-single-image-preview[data-key="+d+"]").fadeIn().find("img").attr("src",t+"?"+r.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+d+"]").parents(".um-field").find(".um-btn-auto-width").html(u.attr("data-change")),jQuery(".um-single-image-preview[data-key="+d+"]").parents(".um-field").find("input[type=hidden]").val(a)))}),jQuery(document.body).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal"),t="normal";jQuery(this).data("modal-size")&&(t=jQuery(this).data("modal-size")),jQuery(this).data("modal-copy")&&(jQuery("#"+a).html(jQuery(this).parents(".um-field").find(".um-modal-hidden-content").html()),jQuery(this).parents(".um-profile-photo").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-profile-photo").attr("data-user_id")),jQuery(this).parents(".um-cover").attr("data-ratio")&&jQuery("#"+a).attr("data-ratio",jQuery(this).parents(".um-cover").attr("data-ratio")),jQuery(this).parents(".um-cover").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-cover").attr("data-user_id")),0<jQuery('input[type="hidden"][name="user_id"]').length)&&jQuery("#"+a).attr("data-user_id",jQuery('input[type="hidden"][name="user_id"]').val()),um_new_modal(a,t)})});
|
||||
+19
-16
@@ -35,52 +35,55 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
|
||||
jQuery(document.body).on('click', '.um-reset-profile-photo', function(e) {
|
||||
let $obj = jQuery(this);
|
||||
let user_id = $obj.data('user_id');
|
||||
|
||||
jQuery('.um-profile-photo-img img').attr( 'src', jQuery(this).attr( 'data-default_src' ) );
|
||||
let $dropdownItem = $obj.parents('ul').find('.um-manual-trigger[data-parent=".um-profile-photo"]');
|
||||
let altText = $dropdownItem.data('alt_text');
|
||||
$dropdownItem.data( 'alt_text', $dropdownItem.text() ).text( altText );
|
||||
|
||||
user_id = jQuery(this).attr('data-user_id');
|
||||
metakey = 'profile_photo';
|
||||
|
||||
UM.dropdown.hideAll();
|
||||
jQuery('.um-profile-photo-img img').attr( 'src', $obj.data( 'default_src' ) );
|
||||
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action:'um_delete_profile_photo',
|
||||
metakey: metakey,
|
||||
user_id: user_id,
|
||||
nonce: um_scripts.nonce
|
||||
},
|
||||
success: function() {
|
||||
$obj.removeClass('um-is-visible').hide();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(this).parents('li').hide();
|
||||
UM.dropdown.hideAll();
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document.body).on('click', '.um-reset-cover-photo', function(e){
|
||||
var obj = jQuery(this);
|
||||
let $obj = jQuery(this);
|
||||
let user_id = $obj.data('user_id');
|
||||
|
||||
let $dropdownItem = $obj.parents('ul').find('.um-manual-trigger[data-parent=".um-cover"]');
|
||||
let altText = $dropdownItem.data('alt_text');
|
||||
$dropdownItem.data( 'alt_text', $dropdownItem.text() ).text( altText );
|
||||
|
||||
jQuery('.um-cover-overlay').hide();
|
||||
|
||||
jQuery('.um-cover-e').html('<a href="javascript:void(0);" class="um-cover-add" style="height: 370px;"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>');
|
||||
jQuery('.um-cover-e').html('<a href="javascript:void(0);" class="um-cover-add" style="height: 370px;"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="' + wp.i18n.__( 'Upload a cover photo', 'ultimate-member' ) + '"></i></span></a>');
|
||||
|
||||
um_responsive();
|
||||
|
||||
user_id = jQuery(this).attr('data-user_id');
|
||||
metakey = 'cover_photo';
|
||||
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_delete_cover_photo',
|
||||
metakey: metakey,
|
||||
user_id: user_id,
|
||||
nonce: um_scripts.nonce
|
||||
},
|
||||
success: function( response ) {
|
||||
obj.hide();
|
||||
success: function() {
|
||||
$obj.removeClass('um-is-visible').hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
jQuery(document).ready(function(){jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-profile.um-viewing .um-profile-body").find(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document.body).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um.um-profile.um-editing").find("form").trigger("submit"),!1}),jQuery(document.body).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document.body).on("click",".um-cover a.um-cover-add, .um-photo a",function(e){e.preventDefault()}),jQuery(document.body).on("click",".um-photo-modal",function(e){e.preventDefault();e=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,e),!1}),jQuery(document.body).on("click",".um-reset-profile-photo",function(e){return jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",UM.dropdown.hideAll(),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_profile_photo",metakey:metakey,user_id:user_id,nonce:um_scripts.nonce}}),jQuery(this).parents("li").hide(),!1}),jQuery(document.body).on("click",".um-reset-cover-photo",function(e){var t=jQuery(this);return jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="javascript:void(0);" class="um-cover-add" style="height: 370px;"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>'),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_cover_photo",metakey:metakey,user_id:user_id,nonce:um_scripts.nonce},success:function(e){t.hide()}}),UM.dropdown.hideAll(),!1}),jQuery(document.body).on("change keyup","#um-meta-bio",function(){if(void 0!==jQuery(this).val()){var t=jQuery(this).data("character-limit"),r=jQuery(this).data("html");let e=t-jQuery(this).val().length;e=(e=1===parseInt(r)?t-jQuery(this).val().replace(/(<([^>]+)>)/gi,"").length:e)<0?0:e,jQuery("span.um-meta-bio-character span.um-bio-limit").text(e);r=e<5?"red":"";jQuery("span.um-meta-bio-character").css("color",r)}}),jQuery("#um-meta-bio").trigger("change"),jQuery(".um-profile form").each(function(){let t=jQuery(this).data("description_key");jQuery(this).find('textarea[name="'+t+'"]').length&&jQuery(document.body).on("change input",'textarea[name="'+t+'"]',function(e){jQuery(this).parents("form").find('textarea[name="'+t+'"]').each(function(){jQuery(this).val(e.currentTarget.value),jQuery("#um-meta-bio")[0]!==e.currentTarget&&jQuery("#um-meta-bio")[0]===jQuery(this)[0]&&jQuery(this).trigger("change")})})}),jQuery(".um-profile-edit a.um_delete-item").on("click",function(e){if(e.preventDefault(),!confirm(wp.i18n.__("Are you sure that you want to delete this user?","ultimate-member")))return!1}),jQuery(".um-profile-nav a").on("touchend",function(e){jQuery(e.currentTarget).trigger("click")})});
|
||||
jQuery(document).ready(function(){jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-profile.um-viewing .um-profile-body").find(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document.body).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um.um-profile.um-editing").find("form").trigger("submit"),!1}),jQuery(document.body).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document.body).on("click",".um-cover a.um-cover-add, .um-photo a",function(e){e.preventDefault()}),jQuery(document.body).on("click",".um-photo-modal",function(e){e.preventDefault();e=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,e),!1}),jQuery(document.body).on("click",".um-reset-profile-photo",function(e){let t=jQuery(this);var r=t.data("user_id"),u=t.parents("ul").find('.um-manual-trigger[data-parent=".um-profile-photo"]'),i=u.data("alt_text");return u.data("alt_text",u.text()).text(i),jQuery(".um-profile-photo-img img").attr("src",t.data("default_src")),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_profile_photo",user_id:r,nonce:um_scripts.nonce},success:function(){t.removeClass("um-is-visible").hide()}}),UM.dropdown.hideAll(),!1}),jQuery(document.body).on("click",".um-reset-cover-photo",function(e){let t=jQuery(this);var r=t.data("user_id"),u=t.parents("ul").find('.um-manual-trigger[data-parent=".um-cover"]'),i=u.data("alt_text");return u.data("alt_text",u.text()).text(i),jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="javascript:void(0);" class="um-cover-add" style="height: 370px;"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="'+wp.i18n.__("Upload a cover photo","ultimate-member")+'"></i></span></a>'),um_responsive(),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_cover_photo",user_id:r,nonce:um_scripts.nonce},success:function(){t.removeClass("um-is-visible").hide()}}),UM.dropdown.hideAll(),!1}),jQuery(document.body).on("change keyup","#um-meta-bio",function(){if(void 0!==jQuery(this).val()){var t=jQuery(this).data("character-limit"),r=jQuery(this).data("html");let e=t-jQuery(this).val().length;e=(e=1===parseInt(r)?t-jQuery(this).val().replace(/(<([^>]+)>)/gi,"").length:e)<0?0:e,jQuery("span.um-meta-bio-character span.um-bio-limit").text(e);r=e<5?"red":"";jQuery("span.um-meta-bio-character").css("color",r)}}),jQuery("#um-meta-bio").trigger("change"),jQuery(".um-profile form").each(function(){let t=jQuery(this).data("description_key");jQuery(this).find('textarea[name="'+t+'"]').length&&jQuery(document.body).on("change input",'textarea[name="'+t+'"]',function(e){jQuery(this).parents("form").find('textarea[name="'+t+'"]').each(function(){jQuery(this).val(e.currentTarget.value),jQuery("#um-meta-bio")[0]!==e.currentTarget&&jQuery("#um-meta-bio")[0]===jQuery(this)[0]&&jQuery(this).trigger("change")})})}),jQuery(".um-profile-edit a.um_delete-item").on("click",function(e){if(e.preventDefault(),!confirm(wp.i18n.__("Are you sure that you want to delete this user?","ultimate-member")))return!1}),jQuery(".um-profile-nav a").on("touchend",function(e){jQuery(e.currentTarget).trigger("click")})});
|
||||
@@ -1,5 +1,35 @@
|
||||
== Changelog ==
|
||||
|
||||
= 2.10.0 February 17, 2025 =
|
||||
|
||||
* Enhancements:
|
||||
|
||||
- Added: User Profile `form-id` attribute and updated code for Profile/Cover photos actions dropdowns.
|
||||
- Added: Honeypot scripts/styles via `wp_add_inline_script()`, `wp_add_inline_style()` changed from direct adding in header and footer.
|
||||
- Updated: We've made improvements to requests for extension updates to boost stability.
|
||||
- Updated: PHP requirement - the minimum PHP version is now upgraded to 7.0.
|
||||
- Updated: Using $wpdb and WPCS for queries. Set minimum required version to 6.2 due to using %i for `$wpdb->prepare()`.
|
||||
- Updated: Revised wp-admin user actions handling. Now, the required capability is `edit_users` instead of `manage_options`.
|
||||
- Removed: User Profile hidden inputs on view mode.
|
||||
- Tweak: WPCS enhancements.
|
||||
|
||||
* Bugfixes:
|
||||
|
||||
- Fixed: Security issue CVE ID: CVE-2024-12276.
|
||||
- Fixed: Custom usermeta table metakeys for filtering in member directory (from `_money_spent` to `wc_money_spent_` and added `wc_order_count_`).
|
||||
- Fixed: Layout for "Download your data" and "Erase of your data" fields.
|
||||
- Fixed: Image sizes used for Open Graph meta in User Profile headers are now corrected.
|
||||
- Fixed: "Delete account text" settings visibility issue in wp-admin.
|
||||
- Fixed: The "Privacy Policy" field in the registration form. Disallowed HTML from the "Privacy Policy" content (like `<form>`) is filtered out by the `wp_kses()` function.
|
||||
- Fixed: Password fields are now sanitized the WordPress native way, with `wp_unslash()` omitted post-submission.
|
||||
|
||||
* Templates required update:
|
||||
|
||||
- gdpr-register.php
|
||||
- profile.php
|
||||
|
||||
* Cached and optimized/minified assets(JS/CSS) must be flushed/re-generated after upgrade *
|
||||
|
||||
= 2.9.2 January 14, 2025 =
|
||||
|
||||
* Enhancements:
|
||||
|
||||
@@ -14,6 +14,24 @@ if ( ! class_exists( 'um\admin\Actions_Listener' ) ) {
|
||||
*/
|
||||
class Actions_Listener {
|
||||
|
||||
/**
|
||||
* USER_ACTIONS array containing different actions for managing users:
|
||||
* - approve_user: Approve a user
|
||||
* - reactivate_user: Reactivate a user account
|
||||
* - put_user_as_pending: Set a user as pending
|
||||
* - resend_user_activation: Resend activation email to a user
|
||||
* - reject_user: Reject a user
|
||||
* - deactivate_user: Deactivate a user account
|
||||
*/
|
||||
const USER_ACTIONS = array(
|
||||
'approve_user',
|
||||
'reactivate_user',
|
||||
'put_user_as_pending',
|
||||
'resend_user_activation',
|
||||
'reject_user',
|
||||
'deactivate_user',
|
||||
);
|
||||
|
||||
/**
|
||||
* Actions_Listener constructor.
|
||||
*/
|
||||
@@ -26,171 +44,179 @@ if ( ! class_exists( 'um\admin\Actions_Listener' ) ) {
|
||||
* Handle wp-admin actions
|
||||
*
|
||||
* @since 2.8.7
|
||||
* @since 2.10.0 User should have 'edit_users' capability instead of 'manage_options'.
|
||||
*/
|
||||
public function actions_listener() {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
// phpcs:disable WordPress.Security.NonceVerification -- there is nonce verification below for each case
|
||||
if ( empty( $_REQUEST['um_adm_action'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $_REQUEST['um_adm_action'] ) ) {
|
||||
switch ( sanitize_key( $_REQUEST['um_adm_action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification -- there is nonce verification below for each case
|
||||
case 'approve_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
$action = sanitize_key( $_REQUEST['um_adm_action'] );
|
||||
// phpcs:enable WordPress.Security.NonceVerification -- there is nonce verification below for each case
|
||||
|
||||
if ( in_array( $action, self::USER_ACTIONS, true ) && ! current_user_can( 'edit_users' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( $action ) {
|
||||
case 'approve_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "approve_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->approve( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_approved',
|
||||
'approved_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'reactivate_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
check_admin_referer( "approve_user{$user_id}" );
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->approve( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_approved',
|
||||
'approved_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
check_admin_referer( "reactivate_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->reactivate( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_reactivated',
|
||||
'reactivated_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'put_user_as_pending':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'reactivate_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "put_user_as_pending{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->set_as_pending( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_pending',
|
||||
'pending_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'resend_user_activation':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "reactivate_user{$user_id}" );
|
||||
check_admin_referer( "resend_user_activation{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->reactivate( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_reactivated',
|
||||
'reactivated_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->send_activation( $user_id, true );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_resend_activation',
|
||||
'resend_activation_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'put_user_as_pending':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'reject_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "reject_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->reject( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_rejected',
|
||||
'rejected_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'deactivate_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "put_user_as_pending{$user_id}" );
|
||||
check_admin_referer( "deactivate_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->set_as_pending( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_pending',
|
||||
'pending_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->deactivate( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_deactivate',
|
||||
'deactivated_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'resend_user_activation':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "resend_user_activation{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->send_activation( $user_id, true );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_resend_activation',
|
||||
'resend_activation_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'reject_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "reject_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->reject( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_rejected',
|
||||
'rejected_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
case 'deactivate_user':
|
||||
if ( empty( $_REQUEST['uid'] ) || ! is_numeric( $_REQUEST['uid'] ) ) {
|
||||
die( esc_html__( 'Invalid user ID', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = absint( $_REQUEST['uid'] );
|
||||
|
||||
check_admin_referer( "deactivate_user{$user_id}" );
|
||||
|
||||
$redirect = wp_get_referer();
|
||||
if ( UM()->common()->users()->can_current_user_edit_user( $user_id ) ) {
|
||||
$result = UM()->common()->users()->deactivate( $user_id );
|
||||
if ( $result ) {
|
||||
$redirect = add_query_arg(
|
||||
array(
|
||||
'update' => 'um_deactivate',
|
||||
'deactivated_count' => 1,
|
||||
),
|
||||
$redirect
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends an array of actions with the predefined user actions.
|
||||
*
|
||||
* @param array $actions The original array of actions to extend.
|
||||
*
|
||||
* @return array The extended array containing additional user actions.
|
||||
*/
|
||||
public function extends_individual_nonce_actions( $actions ) {
|
||||
$actions[] = 'approve_user';
|
||||
$actions[] = 'reactivate_user';
|
||||
$actions[] = 'put_user_as_pending';
|
||||
$actions[] = 'resend_user_activation';
|
||||
$actions[] = 'reject_user';
|
||||
$actions[] = 'deactivate_user';
|
||||
return $actions;
|
||||
return array_merge( $actions, self::USER_ACTIONS );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,12 +170,16 @@ if ( ! class_exists( 'um\admin\core\Admin_GDPR' ) ) {
|
||||
function get_metadata( $user_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$metadata = $wpdb->get_results( $wpdb->prepare(
|
||||
"SELECT meta_key, meta_value
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE user_id = %d",
|
||||
$user_id
|
||||
), ARRAY_A );
|
||||
$metadata = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"SELECT meta_key,
|
||||
meta_value
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE user_id = %d",
|
||||
$user_id
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
$filtered = array();
|
||||
foreach ( $metadata as $data ) {
|
||||
|
||||
@@ -1177,7 +1177,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
$where = array( 'ID' => $post_id );
|
||||
// translators: %s: Directory id.
|
||||
$_POST['post_title'] = sprintf( __( 'Directory #%s', 'ultimate-member' ), $post_id );
|
||||
$wpdb->update( $wpdb->posts, array( 'post_title' => sanitize_text_field( wp_unslash( $_POST['post_title'] ) ) ), $where );
|
||||
$wpdb->update(
|
||||
$wpdb->posts,
|
||||
array(
|
||||
'post_title' => sanitize_text_field( wp_unslash( $_POST['post_title'] ) ),
|
||||
),
|
||||
$where,
|
||||
array(
|
||||
'%s',
|
||||
),
|
||||
array(
|
||||
'%d',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
do_action( 'um_before_member_directory_save', $post_id );
|
||||
@@ -1275,7 +1287,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
$where = array( 'ID' => $post_id );
|
||||
// translators: %s: Form id.
|
||||
$_POST['post_title'] = sprintf( __( 'Form #%s', 'ultimate-member' ), $post_id );
|
||||
$wpdb->update( $wpdb->posts, array( 'post_title' => sanitize_text_field( wp_unslash( $_POST['post_title'] ) ) ), $where );
|
||||
$wpdb->update(
|
||||
$wpdb->posts,
|
||||
array(
|
||||
'post_title' => sanitize_text_field( wp_unslash( $_POST['post_title'] ) ),
|
||||
),
|
||||
$where,
|
||||
array(
|
||||
'%s',
|
||||
),
|
||||
array(
|
||||
'%d',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// save
|
||||
|
||||
@@ -630,8 +630,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
'license_key',
|
||||
array(
|
||||
'class' => 'error',
|
||||
// translators: %1$s is an inactive license number; %2$s is a plugin name; %3$s is a store link.
|
||||
'message' => '<p>' . sprintf( __( 'There are %1$s inactive %2$s license keys for this site. This site is not authorized to get plugin updates. You can active this site on <a href="%3$s">www.ultimatemember.com</a>.', 'ultimate-member' ), count( $arr_inactive_license_keys ), UM_PLUGIN_NAME, UM()->store_url ) . '</p>',
|
||||
// translators: %1$s is an inactive license number; %2$s is a plugin name.
|
||||
'message' => '<p>' . sprintf( __( 'There are %1$s inactive %2$s license keys for this site. This site is not authorized to get plugin updates. You can activate this site on <a href="https://ultimatemember.com/">www.ultimatemember.com</a>.', 'ultimate-member' ), count( $arr_inactive_license_keys ), UM_PLUGIN_NAME ) . '</p>',
|
||||
),
|
||||
3
|
||||
);
|
||||
|
||||
@@ -97,20 +97,22 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
$metakeys = apply_filters( 'um_metadata_same_page_update_ajax', $metakeys, UM()->builtin()->all_user_fields );
|
||||
|
||||
if ( is_multisite() ) {
|
||||
|
||||
$sites = get_sites( array( 'fields' => 'ids' ) );
|
||||
foreach ( $sites as $blog_id ) {
|
||||
$metakeys[] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
|
||||
$metakeys[] = 'wc_money_spent_' . rtrim( $wpdb->get_blog_prefix( $blog_id ), '_' );
|
||||
$metakeys[] = 'wc_order_count_' . rtrim( $wpdb->get_blog_prefix( $blog_id ), '_' );
|
||||
}
|
||||
} else {
|
||||
$blog_id = get_current_blog_id();
|
||||
$metakeys[] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
|
||||
$metakeys[] = 'wc_money_spent_' . rtrim( $wpdb->get_blog_prefix( $blog_id ), '_' );
|
||||
$metakeys[] = 'wc_order_count_' . rtrim( $wpdb->get_blog_prefix( $blog_id ), '_' );
|
||||
}
|
||||
|
||||
//member directory data
|
||||
$metakeys[] = 'um_member_directory_data';
|
||||
$metakeys[] = '_um_verified';
|
||||
$metakeys[] = '_money_spent';
|
||||
$metakeys[] = '_completed';
|
||||
$metakeys[] = '_reviews_avg';
|
||||
|
||||
@@ -2239,6 +2241,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
} else {
|
||||
unset( $this->settings_structure['advanced']['sections']['features']['form_sections']['beta_features'] );
|
||||
}
|
||||
|
||||
if ( UM()->account()->current_password_is_required( 'delete' ) ) {
|
||||
unset( $this->settings_structure['']['sections']['account']['form_sections']['delete_tab']['fields'][2] );
|
||||
} else {
|
||||
unset( $this->settings_structure['']['sections']['account']['form_sections']['delete_tab']['fields'][1] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2927,9 +2935,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
);
|
||||
|
||||
$request = wp_remote_post(
|
||||
UM()->store_url,
|
||||
UM()::$store_url,
|
||||
array(
|
||||
'timeout' => UM()->request_timeout,
|
||||
'timeout' => UM()::$request_timeout,
|
||||
'sslverify' => false,
|
||||
'body' => $api_params,
|
||||
)
|
||||
@@ -2939,9 +2947,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
||||
} else {
|
||||
$request = wp_remote_post(
|
||||
UM()->store_url,
|
||||
UM()::$store_url,
|
||||
array(
|
||||
'timeout' => UM()->request_timeout,
|
||||
'timeout' => UM()::$request_timeout,
|
||||
'sslverify' => true,
|
||||
'body' => $api_params,
|
||||
)
|
||||
|
||||
@@ -55,15 +55,18 @@ if ( ! empty( $um_roles ) ) {
|
||||
$role_keys[] = $role_key;
|
||||
}
|
||||
|
||||
$all_role_metadata = $wpdb->get_results( $wpdb->prepare(
|
||||
"SELECT pm.meta_key,
|
||||
pm.meta_value
|
||||
FROM {$wpdb->postmeta} pm
|
||||
WHERE pm.post_id = %d AND
|
||||
pm.meta_key LIKE %s",
|
||||
$um_role->ID,
|
||||
"_um_%"
|
||||
), ARRAY_A );
|
||||
$all_role_metadata = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"SELECT pm.meta_key,
|
||||
pm.meta_value
|
||||
FROM {$wpdb->postmeta} pm
|
||||
WHERE pm.post_id = %d AND
|
||||
pm.meta_key LIKE %s",
|
||||
$um_role->ID,
|
||||
"_um_%"
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
$role_metadata = array();
|
||||
if ( ! empty( $all_role_metadata ) ) {
|
||||
@@ -160,4 +163,4 @@ if ( version_compare( $wp_version, '4.9', '<' ) ) {
|
||||
|
||||
|
||||
//temporary option
|
||||
update_option( 'um_roles_associations', $roles_associations );
|
||||
update_option( 'um_roles_associations', $roles_associations );
|
||||
|
||||
@@ -10,7 +10,8 @@ if ( ! empty( $postmeta ) ) {
|
||||
update_post_meta( $row['post_id'], '_um_hide_pm_button', $value );
|
||||
}
|
||||
|
||||
$wpdb->delete( "{$wpdb->postmeta}",
|
||||
$wpdb->delete(
|
||||
$wpdb->postmeta,
|
||||
array(
|
||||
'meta_value' => '_um_show_pm_button',
|
||||
),
|
||||
@@ -185,4 +186,4 @@ if ( ! empty( $groups ) && ! is_wp_error( $groups ) ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->update( "{$wpdb->usermeta}",
|
||||
$wpdb->update(
|
||||
$wpdb->usermeta,
|
||||
array(
|
||||
'meta_value' => serialize( array() ),
|
||||
'meta_value' => serialize( array() ),
|
||||
),
|
||||
array(
|
||||
'meta_key' => 'um_account_secure_fields',
|
||||
'meta_key' => 'um_account_secure_fields',
|
||||
),
|
||||
array(
|
||||
'%s'
|
||||
'%s',
|
||||
),
|
||||
array(
|
||||
'%s'
|
||||
'%s',
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
@@ -28,29 +28,35 @@ function um_upgrade_metadata_per_user213beta3() {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$min_max = $wpdb->get_row( $wpdb->prepare(
|
||||
"SELECT MIN(ID) AS MinID, MAX(ID) AS MaxID
|
||||
FROM (
|
||||
SELECT u.ID
|
||||
FROM {$wpdb->users} as u
|
||||
ORDER BY u.ID
|
||||
LIMIT %d, %d
|
||||
) as dt",
|
||||
( absint( $_POST['page'] ) - 1 ) * $per_page,
|
||||
$per_page
|
||||
), ARRAY_A );
|
||||
$min_max = $wpdb->get_row(
|
||||
$wpdb->prepare(
|
||||
"SELECT MIN(ID) AS MinID, MAX(ID) AS MaxID
|
||||
FROM (
|
||||
SELECT u.ID
|
||||
FROM {$wpdb->users} as u
|
||||
ORDER BY u.ID
|
||||
LIMIT %d, %d
|
||||
) as dt",
|
||||
( absint( $_POST['page'] ) - 1 ) * $per_page,
|
||||
$per_page
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
$metadata = $wpdb->get_results( $wpdb->prepare(
|
||||
"SELECT u.ID as user_id,
|
||||
um.meta_key as meta_key,
|
||||
um.meta_value as meta_value
|
||||
FROM {$wpdb->users} u
|
||||
LEFT JOIN {$wpdb->usermeta} um ON ( um.user_id = u.ID AND um.meta_key IN( 'account_status','hide_in_members','synced_gravatar_hashed_id','synced_profile_photo','profile_photo','cover_photo','_um_verified' ) )
|
||||
WHERE u.ID >= %d AND
|
||||
u.ID <= %d",
|
||||
$min_max['MinID'],
|
||||
$min_max['MaxID']
|
||||
), ARRAY_A );
|
||||
$metadata = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"SELECT u.ID as user_id,
|
||||
um.meta_key as meta_key,
|
||||
um.meta_value as meta_value
|
||||
FROM {$wpdb->users} u
|
||||
LEFT JOIN {$wpdb->usermeta} um ON ( um.user_id = u.ID AND um.meta_key IN( 'account_status','hide_in_members','synced_gravatar_hashed_id','synced_profile_photo','profile_photo','cover_photo','_um_verified' ) )
|
||||
WHERE u.ID >= %d AND
|
||||
u.ID <= %d",
|
||||
$min_max['MinID'],
|
||||
$min_max['MaxID']
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
$users_map = array();
|
||||
foreach ( $metadata as $metadatarow ) {
|
||||
|
||||
+6
-6
@@ -14,9 +14,9 @@ function um_upgrade_usermeta_count280() {
|
||||
"SELECT COUNT(*)
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = 'use_gdpr_agreement' OR
|
||||
meta_key = 'um_user_blocked__timestamp' OR
|
||||
meta_key = '_um_last_login' OR
|
||||
meta_key = 'submitted'"
|
||||
meta_key = 'um_user_blocked__timestamp' OR
|
||||
meta_key = '_um_last_login' OR
|
||||
meta_key = 'submitted'"
|
||||
);
|
||||
|
||||
wp_send_json_success( array( 'count' => $count ) );
|
||||
@@ -40,9 +40,9 @@ function um_upgrade_metadata_per_user280() {
|
||||
"SELECT *
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = 'use_gdpr_agreement' OR
|
||||
meta_key = 'um_user_blocked__timestamp' OR
|
||||
meta_key = '_um_last_login' OR
|
||||
meta_key = 'submitted'
|
||||
meta_key = 'um_user_blocked__timestamp' OR
|
||||
meta_key = '_um_last_login' OR
|
||||
meta_key = 'submitted'
|
||||
LIMIT %d, %d",
|
||||
( absint( $_POST['page'] ) - 1 ) * $per_page,
|
||||
$per_page
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( empty( UM()->builder()->form_id ) ) {
|
||||
UM()->builder()->form_id = $this->form_id;
|
||||
} ?>
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="um-admin-builder" data-form_id="<?php echo esc_attr( UM()->builder()->form_id ); ?>">
|
||||
|
||||
<div class="um-admin-drag-ctrls-demo um-admin-drag-ctrls">
|
||||
|
||||
<a href="javascript:void(0);" class="active" data-modal="UM_preview_form" data-modal-size="smaller"
|
||||
data-dynamic-content="um_admin_preview_form" data-arg1="<?php echo esc_attr( get_the_ID() ); ?>" data-arg2="">
|
||||
<?php esc_html_e( 'Live Preview', 'ultimate-member' ); ?>
|
||||
<a href="#" class="active" data-modal="UM_preview_form" data-modal-size="larger"
|
||||
data-dynamic-content="um_admin_preview_form" data-arg1="<?php echo esc_attr( get_the_ID() ); ?>" data-arg2="">
|
||||
<?php esc_html_e( 'Live Preview Screen', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
|
||||
<a href="#" class="active" data-modal="UM_preview_form" data-modal-size="smaller"
|
||||
data-dynamic-content="um_admin_preview_form" data-arg1="<?php echo esc_attr( get_the_ID() ); ?>" data-arg2="">
|
||||
<?php esc_html_e( 'Live Preview Mobile', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
@@ -26,7 +31,7 @@ if ( empty( UM()->builder()->form_id ) ) {
|
||||
</div>
|
||||
|
||||
<div class="um-admin-drag-addrow um-tip-n" title="<?php esc_attr_e( 'Add Master Row', 'ultimate-member' ); ?>"
|
||||
data-row_action="add_row">
|
||||
data-row_action="add_row">
|
||||
<i class="um-icon-plus"></i>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
|
||||
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<div id="UM_preview_form" style="display:none">
|
||||
|
||||
<div class="um-admin-modal-head">
|
||||
<h3><?php _e( 'Live Form Preview', 'ultimate-member' ); ?></h3>
|
||||
<h3><?php esc_html_e( 'Live Form Preview', 'ultimate-member' ); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-modal-body"></div>
|
||||
|
||||
<div class="um-admin-modal-foot">
|
||||
<a href="javascript:void(0);" class="button-primary" data-action="UM_remove_modal"><?php _e( 'Continue editing', 'ultimate-member' ); ?></a>
|
||||
<a href="#" class="button-primary" data-action="UM_remove_modal"><?php esc_html_e( 'Continue editing', 'ultimate-member' ); ?></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,36 +1,27 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'UM_Functions' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class UM_Functions
|
||||
*/
|
||||
class UM_Functions {
|
||||
|
||||
|
||||
/**
|
||||
* Store URL
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $store_url = 'https://ultimatemember.com/';
|
||||
|
||||
public static $store_url = 'https://ultimatemember.com/?edd-request=get-info';
|
||||
|
||||
/**
|
||||
* WP remote Post timeout
|
||||
* @var int
|
||||
*/
|
||||
var $request_timeout = 60;
|
||||
|
||||
|
||||
/**
|
||||
* UM_Functions constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
public static $request_timeout = 60;
|
||||
|
||||
/**
|
||||
* Check if AJAX now
|
||||
|
||||
@@ -175,15 +175,6 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'ultimate-member' ), '1.0' );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM constructor.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* UM pseudo-constructor.
|
||||
*
|
||||
|
||||
@@ -969,13 +969,15 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
$restricted_posts = array_unique( $restricted_posts );
|
||||
foreach ( $restricted_posts as $k => $post_type ) {
|
||||
if ( 'closed' === get_default_comment_status( $post_type ) ) {
|
||||
$open_comments = $wpdb->get_var( $wpdb->prepare(
|
||||
"SELECT ID
|
||||
FROM {$wpdb->posts}
|
||||
WHERE post_type = %s AND
|
||||
comment_status != 'closed'",
|
||||
$post_type
|
||||
) );
|
||||
$open_comments = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT ID
|
||||
FROM {$wpdb->posts}
|
||||
WHERE post_type = %s AND
|
||||
comment_status != 'closed'",
|
||||
$post_type
|
||||
)
|
||||
);
|
||||
|
||||
if ( empty( $open_comments ) ) {
|
||||
unset( $restricted_posts[ $k ] );
|
||||
@@ -1070,12 +1072,11 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
}
|
||||
|
||||
$totals = (array) $wpdb->get_results(
|
||||
"
|
||||
SELECT comment_approved, COUNT( * ) AS total
|
||||
FROM {$wpdb->comments}
|
||||
{$where}
|
||||
GROUP BY comment_approved
|
||||
",
|
||||
"SELECT comment_approved,
|
||||
COUNT(*) AS total
|
||||
FROM {$wpdb->comments}
|
||||
{$where}
|
||||
GROUP BY comment_approved",
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
|
||||
@@ -340,93 +340,100 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Submit Account handler
|
||||
* Process the submission of account details
|
||||
*/
|
||||
function account_submit() {
|
||||
public function account_submit() {
|
||||
if ( ! um_submitting_account_page() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( um_submitting_account_page() ) {
|
||||
$formdata = wp_unslash( $_POST );
|
||||
|
||||
UM()->form()->post_form = wp_unslash( $_POST );
|
||||
// Don't un-slash passwords in manner of WordPress native password field.
|
||||
$fields_map = array(
|
||||
'user_password',
|
||||
'confirm_user_password',
|
||||
'current_user_password',
|
||||
'single_user_password',
|
||||
);
|
||||
$formdata = UM()->form()::ignore_formdata_unslash( $formdata, $fields_map );
|
||||
|
||||
UM()->form()->post_form = $formdata;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_submit_account_errors_hook
|
||||
* @description Validate process on account submit
|
||||
* @input_vars
|
||||
* [{"var":"$submitted","type":"array","desc":"Account Page Submitted data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_submit_account_errors_hook', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_submit_account_errors_hook', 'my_submit_account_errors', 10, 1 );
|
||||
* function my_submit_account_errors( $submitted ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_submit_account_errors_hook', UM()->form()->post_form );
|
||||
|
||||
if ( um_is_core_page( 'account' ) && get_query_var( 'um_tab' ) ) {
|
||||
$this->current_tab = get_query_var( 'um_tab' );
|
||||
} else {
|
||||
$this->current_tab = UM()->form()->post_form['_um_account_tab'];
|
||||
}
|
||||
|
||||
$this->current_tab = sanitize_key( $this->current_tab );
|
||||
|
||||
if ( ! isset( UM()->form()->errors ) ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_submit_account_errors_hook
|
||||
* @description Validate process on account submit
|
||||
* @title um_submit_account_details
|
||||
* @description On success account submit
|
||||
* @input_vars
|
||||
* [{"var":"$submitted","type":"array","desc":"Account Page Submitted data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_submit_account_errors_hook', 'function_name', 10, 1 );
|
||||
* @usage add_action( 'um_submit_account_details', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_submit_account_errors_hook', 'my_submit_account_errors', 10, 1 );
|
||||
* function my_submit_account_errors( $submitted ) {
|
||||
* add_action( 'um_submit_account_details', 'my_submit_account_details', 10, 1 );
|
||||
* function my_submit_account_details( $submitted ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_submit_account_errors_hook', UM()->form()->post_form );
|
||||
do_action( 'um_submit_account_details', UM()->form()->post_form );
|
||||
|
||||
if ( um_is_core_page( 'account' ) && get_query_var( 'um_tab' ) ) {
|
||||
$this->current_tab = get_query_var( 'um_tab' );
|
||||
} else {
|
||||
$this->current_tab = UM()->form()->post_form['_um_account_tab'];
|
||||
}
|
||||
} elseif ( UM()->form()->has_error( 'um_account_security' ) ) {
|
||||
$url = '';
|
||||
if ( um_is_core_page( 'account' ) ) {
|
||||
|
||||
$this->current_tab = sanitize_key( $this->current_tab );
|
||||
$url = UM()->account()->tab_link( $this->current_tab );
|
||||
|
||||
if ( ! isset( UM()->form()->errors ) ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_submit_account_details
|
||||
* @description On success account submit
|
||||
* @input_vars
|
||||
* [{"var":"$submitted","type":"array","desc":"Account Page Submitted data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_submit_account_details', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_submit_account_details', 'my_submit_account_details', 10, 1 );
|
||||
* function my_submit_account_details( $submitted ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_submit_account_details', UM()->form()->post_form );
|
||||
$url = add_query_arg( 'err', 'account', $url );
|
||||
|
||||
} elseif ( UM()->form()->has_error( 'um_account_security' ) ) {
|
||||
$url = '';
|
||||
if ( um_is_core_page( 'account' ) ) {
|
||||
if ( function_exists( 'icl_get_current_language' ) ) {
|
||||
if ( icl_get_current_language() != icl_get_default_language() ) {
|
||||
$url = UM()->permalinks()->get_current_url( true );
|
||||
$url = add_query_arg( 'err', 'account', $url );
|
||||
|
||||
$url = UM()->account()->tab_link( $this->current_tab );
|
||||
|
||||
$url = add_query_arg( 'err', 'account', $url );
|
||||
|
||||
if ( function_exists( 'icl_get_current_language' ) ) {
|
||||
if ( icl_get_current_language() != icl_get_default_language() ) {
|
||||
$url = UM()->permalinks()->get_current_url( true );
|
||||
$url = add_query_arg( 'err', 'account', $url );
|
||||
|
||||
exit( wp_redirect( $url ) );
|
||||
}
|
||||
exit( wp_redirect( $url ) );
|
||||
}
|
||||
}
|
||||
|
||||
exit( wp_redirect( $url ) );
|
||||
}
|
||||
|
||||
exit( wp_redirect( $url ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter account fields
|
||||
* @param array $predefined_fields
|
||||
|
||||
@@ -453,6 +453,11 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
$arr_restricted_fields = UM()->fields()->get_restricted_fields_for_edit();
|
||||
}
|
||||
|
||||
$password_fields = array(
|
||||
'user_password',
|
||||
'confirm_user_password',
|
||||
);
|
||||
|
||||
$field_types_without_metakey = UM()->builtin()->get_fields_without_metakey();
|
||||
foreach ( $custom_fields as $cf_k => $cf_data ) {
|
||||
if ( ! array_key_exists( 'type', $cf_data ) || in_array( $cf_data['type'], $field_types_without_metakey, true ) ) {
|
||||
@@ -462,6 +467,9 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
if ( array_key_exists( 'type', $cf_data ) && 'password' === $cf_data['type'] ) {
|
||||
$ignore_keys[] = $cf_k;
|
||||
$ignore_keys[] = 'confirm_' . $cf_k;
|
||||
|
||||
$password_fields[] = $cf_k;
|
||||
$password_fields[] = 'confirm_' . $cf_k;
|
||||
}
|
||||
|
||||
if ( 'profile' === $this->form_data['mode'] ) {
|
||||
@@ -556,6 +564,18 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
*/
|
||||
do_action( 'um_before_submit_form_post', $this );
|
||||
|
||||
$formdata = wp_unslash( $_POST );
|
||||
|
||||
if ( isset( $formdata['form_id'] ) ) {
|
||||
// Don't un-slash passwords in manner of WordPress native password field.
|
||||
$form_id = absint( $formdata['form_id'] );
|
||||
foreach ( $password_fields as &$password_field ) {
|
||||
$password_field .= '-' . $form_id;
|
||||
}
|
||||
unset( $password_field );
|
||||
$formdata = UM()->form()::ignore_formdata_unslash( $formdata, $password_fields );
|
||||
}
|
||||
|
||||
/* save entire form as global */
|
||||
/**
|
||||
* Filters $_POST submitted data by the UM login, registration or profile form.
|
||||
@@ -574,7 +594,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
* }
|
||||
* add_filter( 'um_submit_post_form', 'my_submit_post_form' );
|
||||
*/
|
||||
$this->post_form = apply_filters( 'um_submit_post_form', wp_unslash( $_POST ) );
|
||||
$this->post_form = apply_filters( 'um_submit_post_form', $formdata );
|
||||
|
||||
// Validate form submission by honeypot.
|
||||
if ( isset( $this->post_form[ UM()->honeypot ] ) && '' !== $this->post_form[ UM()->honeypot ] ) {
|
||||
@@ -1109,7 +1129,6 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
return $mode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get custom field roles
|
||||
*
|
||||
@@ -1166,5 +1185,24 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore of `wp_unslash()` for form data
|
||||
*
|
||||
* @param array $formdata The form data to process
|
||||
* @param array $fields_map The fields map array
|
||||
*
|
||||
* @return array The updated form data
|
||||
*/
|
||||
public static function ignore_formdata_unslash( $formdata, $fields_map ) {
|
||||
foreach ( $fields_map as $field ) {
|
||||
if ( ! isset( $_POST[ $field ] ) ) {
|
||||
continue;
|
||||
}
|
||||
$formdata[ $field ] = trim( $_POST[ $field ] );
|
||||
}
|
||||
|
||||
return $formdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) {
|
||||
"SELECT umeta_id
|
||||
FROM {$wpdb->prefix}um_metadata
|
||||
WHERE user_id = %d AND
|
||||
um_key = %s
|
||||
um_key = %s
|
||||
LIMIT 1",
|
||||
$object_id,
|
||||
$meta_key
|
||||
|
||||
@@ -969,14 +969,17 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
default: {
|
||||
|
||||
$meta = $wpdb->get_row( $wpdb->prepare(
|
||||
"SELECT MIN( CONVERT( meta_value, DECIMAL ) ) as min_meta,
|
||||
MAX( CONVERT( meta_value, DECIMAL ) ) as max_meta,
|
||||
COUNT( DISTINCT meta_value ) as amount
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = %s",
|
||||
$filter
|
||||
), ARRAY_A );
|
||||
$meta = $wpdb->get_row(
|
||||
$wpdb->prepare(
|
||||
"SELECT MIN( CONVERT( meta_value, DECIMAL ) ) as min_meta,
|
||||
MAX( CONVERT( meta_value, DECIMAL ) ) as max_meta,
|
||||
COUNT( DISTINCT meta_value ) as amount
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = %s",
|
||||
$filter
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
if ( isset( $meta['min_meta'] ) && isset( $meta['max_meta'] ) && isset( $meta['amount'] ) && $meta['amount'] > 1 ) {
|
||||
$range = array( (float) $meta['min_meta'], (float) $meta['max_meta'] );
|
||||
@@ -988,24 +991,6 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
break;
|
||||
}
|
||||
case 'birth_date': {
|
||||
|
||||
// $meta = $wpdb->get_col(
|
||||
// "SELECT meta_value
|
||||
// FROM {$wpdb->usermeta}
|
||||
// WHERE meta_key = 'birth_date' AND
|
||||
// meta_value != ''"
|
||||
// );
|
||||
//
|
||||
// if ( empty( $meta ) || count( $meta ) < 2 ) {
|
||||
// $range = false;
|
||||
// } elseif ( is_array( $meta ) ) {
|
||||
// $birth_dates = array_filter( array_map( 'strtotime', $meta ), 'is_numeric' );
|
||||
// sort( $birth_dates );
|
||||
// $min_meta = array_shift( $birth_dates );
|
||||
// $max_meta = array_pop( $birth_dates );
|
||||
// $range = array( $this->borndate( $max_meta ), $this->borndate( $min_meta ) );
|
||||
// }
|
||||
|
||||
$meta = $wpdb->get_row(
|
||||
"SELECT MIN( meta_value ) as min_meta,
|
||||
MAX( meta_value ) as max_meta,
|
||||
@@ -1013,7 +998,8 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = 'birth_date' AND
|
||||
meta_value != ''",
|
||||
ARRAY_A );
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
if ( isset( $meta['min_meta'] ) && isset( $meta['max_meta'] ) && isset( $meta['amount'] ) && $meta['amount'] > 1 ) {
|
||||
$range = array( $this->borndate( strtotime( $meta['max_meta'] ) ), $this->borndate( strtotime( $meta['min_meta'] ) ) );
|
||||
@@ -1082,10 +1068,15 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
switch ( $filter ) {
|
||||
default:
|
||||
global $wpdb;
|
||||
$meta = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT meta_value
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = %s
|
||||
ORDER BY meta_value DESC", $filter ) );
|
||||
$meta = $wpdb->get_col(
|
||||
$wpdb->prepare(
|
||||
"SELECT DISTINCT meta_value
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = %s
|
||||
ORDER BY meta_value DESC",
|
||||
$filter
|
||||
)
|
||||
);
|
||||
|
||||
if ( empty( $meta ) || count( $meta ) === 1 ) {
|
||||
$range = false;
|
||||
|
||||
@@ -337,7 +337,17 @@ if ( ! class_exists( 'um\core\Password' ) ) {
|
||||
}
|
||||
|
||||
if ( $this->is_change_request() ) {
|
||||
UM()->form()->post_form = wp_unslash( $_POST );
|
||||
|
||||
$formdata = wp_unslash( $_POST );
|
||||
|
||||
// Don't un-slash passwords in manner of WordPress native password field.
|
||||
$fields_map = array(
|
||||
'user_password',
|
||||
'confirm_user_password',
|
||||
);
|
||||
$formdata = UM()->form()::ignore_formdata_unslash( $formdata, $fields_map );
|
||||
|
||||
UM()->form()->post_form = $formdata;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
use WP_Error;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Plugin_Updater
|
||||
* @package um\core
|
||||
*/
|
||||
class Plugin_Updater {
|
||||
|
||||
|
||||
/**
|
||||
* Plugin_Updater constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
//cron request to UM()->store_url;
|
||||
public function __construct() {
|
||||
add_action( 'um_daily_scheduled_events', array( &$this, 'um_checklicenses' ) );
|
||||
|
||||
// clean update plugin cache
|
||||
@@ -35,16 +34,15 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
//add_filter( 'auto_update_plugin', array( &$this, 'prevent_dangerous_auto_updates' ), 99, 2 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prevent auto-updating the WooCommerce plugin on major releases if there are untested extensions active.
|
||||
*
|
||||
* @todo maybe check untested extensions.
|
||||
* @since 3.2.0
|
||||
* @param bool $should_update If should update.
|
||||
* @param object $plugin Plugin data.
|
||||
* @return bool
|
||||
*/
|
||||
function prevent_dangerous_auto_updates( $should_update, $plugin ) {
|
||||
public function prevent_dangerous_auto_updates( $should_update, $plugin ) {
|
||||
if ( ! isset( $plugin->plugin, $plugin->new_version ) ) {
|
||||
return $should_update;
|
||||
}
|
||||
@@ -56,7 +54,6 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
return $should_update;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This action is documented in wp-admin/includes/class-wp-upgrader.php
|
||||
*
|
||||
@@ -204,33 +201,32 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
|
||||
foreach ( $the_plugs as $key => $value ) {
|
||||
|
||||
if ( in_array( $value, array_keys( $paid_extensions ) ) ) {
|
||||
if ( array_key_exists( $value, $paid_extensions ) ) {
|
||||
$license = UM()->options()->get( "um_{$paid_extensions[ $value ]['key']}_license_key" );
|
||||
|
||||
if ( empty( $license ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$active_um_plugins[ $value ] = $paid_extensions[ $value ];
|
||||
$active_um_plugins[ $value ] = $paid_extensions[ $value ];
|
||||
$active_um_plugins[ $value ]['license'] = $license;
|
||||
}
|
||||
}
|
||||
|
||||
restore_current_blog();
|
||||
}
|
||||
|
||||
} else {
|
||||
$the_plugs = get_option( 'active_plugins' );
|
||||
foreach ( $the_plugs as $key => $value ) {
|
||||
|
||||
if ( in_array( $value, array_keys( $paid_extensions ) ) ) {
|
||||
if ( array_key_exists( $value, $paid_extensions ) ) {
|
||||
$license = UM()->options()->get( "um_{$paid_extensions[ $value ]['key']}_license_key" );
|
||||
|
||||
if ( empty( $license ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$active_um_plugins[ $value ] = $paid_extensions[ $value ];
|
||||
$active_um_plugins[ $value ] = $paid_extensions[ $value ];
|
||||
$active_um_plugins[ $value ]['license'] = $license;
|
||||
}
|
||||
}
|
||||
@@ -239,14 +235,13 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
return $active_um_plugins;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check license function
|
||||
* WP Cron request to UM()::$store_url
|
||||
*/
|
||||
function um_checklicenses() {
|
||||
public function um_checklicenses() {
|
||||
$exts = $this->get_active_plugins();
|
||||
|
||||
if ( 0 == count( $exts ) ) {
|
||||
if ( empty( $exts ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -267,16 +262,16 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
'slug' => $slug,
|
||||
'license' => $data['license'],
|
||||
'item_name' => $data['title'],
|
||||
'version' => $plugin_data['Version']
|
||||
'version' => $plugin_data['Version'],
|
||||
);
|
||||
}
|
||||
|
||||
$request = wp_remote_post(
|
||||
UM()->store_url,
|
||||
UM()::$store_url,
|
||||
array(
|
||||
'timeout' => UM()->request_timeout,
|
||||
'timeout' => UM()::$request_timeout,
|
||||
'sslverify' => false,
|
||||
'body' => $api_params
|
||||
'body' => $api_params,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -284,11 +279,11 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
||||
} else {
|
||||
$request = wp_remote_post(
|
||||
UM()->store_url,
|
||||
UM()::$store_url,
|
||||
array(
|
||||
'timeout' => UM()->request_timeout,
|
||||
'timeout' => UM()::$request_timeout,
|
||||
'sslverify' => true,
|
||||
'body' => $api_params
|
||||
'body' => $api_params,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -321,11 +316,11 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
$request->$slug->get_version_check->sections = maybe_unserialize( $request->$slug->get_version_check->sections );
|
||||
$request->$slug->get_version_check->sections = (array) $request->$slug->get_version_check->sections;
|
||||
} else {
|
||||
$request->$slug->get_version_check = new \WP_Error( 'plugins_api_failed',
|
||||
$request->$slug->get_version_check = new WP_Error(
|
||||
'plugins_api_failed',
|
||||
sprintf(
|
||||
/* translators: %s: support forums URL */
|
||||
__( 'An unexpected error occurred. Something may be wrong with %s or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
|
||||
UM()->store_url,
|
||||
/* translators: %s: support forums URL */
|
||||
__( 'An unexpected error occurred. Something may be wrong with installation or server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
|
||||
__( 'https://wordpress.org/support/' )
|
||||
),
|
||||
wp_remote_retrieve_body( $request->$slug->get_version_check )
|
||||
@@ -341,7 +336,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
}
|
||||
|
||||
if ( ! empty( $request->$slug->get_version_check->sections ) ) {
|
||||
foreach( $request->$slug->get_version_check->sections as $key => $section ) {
|
||||
foreach ( $request->$slug->get_version_check->sections as $key => $section ) {
|
||||
$request->$slug->get_version_check->$key = (array) $section;
|
||||
}
|
||||
}
|
||||
@@ -350,11 +345,8 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for Updates by request to the marketplace
|
||||
* and modify the update array.
|
||||
@@ -362,15 +354,15 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
* @param array $_transient_data plugin update array build by WordPress.
|
||||
* @return \stdClass modified plugin update array.
|
||||
*/
|
||||
function check_update( $_transient_data ) {
|
||||
public function check_update( $_transient_data ) {
|
||||
if ( ! is_object( $_transient_data ) ) {
|
||||
$_transient_data = new \stdClass;
|
||||
$_transient_data = new \stdClass();
|
||||
}
|
||||
|
||||
$exts = $this->get_active_plugins();
|
||||
|
||||
foreach ( $exts as $slug => $data ) {
|
||||
//if response for current product isn't empty check for override
|
||||
// If response for current product isn't empty check for override.
|
||||
if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $slug ] ) && $_transient_data->last_checked > time() - DAY_IN_SECONDS ) {
|
||||
continue;
|
||||
}
|
||||
@@ -387,12 +379,14 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
|
||||
$version_info = $this->get_cached_version_info( $slug );
|
||||
if ( false === $version_info ) {
|
||||
$version_info = $this->single_request( 'plugin_latest_version', array(
|
||||
'slug' => $slug,
|
||||
'license' => $data['license'],
|
||||
'item_name' => $data['title'],
|
||||
'version' => $plugin_data['Version']
|
||||
) );
|
||||
$version_info = $this->single_request(
|
||||
array(
|
||||
'slug' => $slug,
|
||||
'license' => $data['license'],
|
||||
'item_name' => $data['title'],
|
||||
'version' => $plugin_data['Version'],
|
||||
)
|
||||
);
|
||||
|
||||
$this->set_version_info_cache( $slug, $version_info );
|
||||
}
|
||||
@@ -400,42 +394,39 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
||||
//show update version block if new version > then current
|
||||
if ( version_compare( $plugin_data['Version'], $version_info->new_version, '<' ) ) {
|
||||
$_transient_data->response[ $slug ] = $version_info;
|
||||
$_transient_data->response[ $slug ] = $version_info;
|
||||
$_transient_data->response[ $slug ]->plugin = $slug;
|
||||
} else {
|
||||
$_transient_data->no_update[ $slug ] = $version_info;
|
||||
$_transient_data->no_update[ $slug ] = $version_info;
|
||||
$_transient_data->no_update[ $slug ]->plugin = $slug;
|
||||
}
|
||||
|
||||
$_transient_data->last_checked = time();
|
||||
$_transient_data->checked[ $slug ] = $plugin_data['Version'];
|
||||
$_transient_data->last_checked = time();
|
||||
$_transient_data->checked[ $slug ] = $plugin_data['Version'];
|
||||
|
||||
} elseif ( false !== $version_info && is_object( $version_info ) && ! isset( $version_info->new_version ) ) {
|
||||
$_transient_data->no_update[ $slug ] = $version_info;
|
||||
$_transient_data->no_update[ $slug ] = $version_info;
|
||||
$_transient_data->no_update[ $slug ]->plugin = $slug;
|
||||
|
||||
$_transient_data->last_checked = time();
|
||||
$_transient_data->checked[ $slug ] = $plugin_data['Version'];
|
||||
$_transient_data->last_checked = time();
|
||||
$_transient_data->checked[ $slug ] = $plugin_data['Version'];
|
||||
}
|
||||
}
|
||||
|
||||
return $_transient_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Calls the API and, if successfull, returns the object delivered by the API.
|
||||
* Calls the API and, if successfully, returns the object delivered by the API.
|
||||
*
|
||||
* @uses get_bloginfo()
|
||||
* @uses wp_remote_post()
|
||||
* @uses is_wp_error()
|
||||
*
|
||||
* @param string $_action The requested action.
|
||||
* @param array $_data Parameters for the API action.
|
||||
* @param array $_data Parameters for the API action.
|
||||
* @return false|object
|
||||
*/
|
||||
private function single_request( $_action, $_data ) {
|
||||
private function single_request( $_data ) {
|
||||
$api_params = array(
|
||||
'edd_action' => 'get_version',
|
||||
'author' => 'Ultimate Member',
|
||||
@@ -445,12 +436,12 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
|
||||
$api_params = array_merge( $api_params, $_data );
|
||||
|
||||
$request = wp_remote_post(
|
||||
UM()->store_url,
|
||||
$request = wp_remote_post(
|
||||
UM()::$store_url,
|
||||
array(
|
||||
'timeout' => UM()->request_timeout,
|
||||
'timeout' => UM()::$request_timeout,
|
||||
'sslverify' => false,
|
||||
'body' => $api_params
|
||||
'body' => $api_params,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -473,7 +464,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
$request->icons = maybe_unserialize( $request->icons );
|
||||
}
|
||||
|
||||
if( ! empty( $request->sections ) ) {
|
||||
if ( ! empty( $request->sections ) ) {
|
||||
foreach ( $request->sections as $key => $section ) {
|
||||
$request->$key = (array) $section;
|
||||
}
|
||||
@@ -490,7 +481,6 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
return $request;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates information on the "View version x.x details" popup with custom data.
|
||||
*
|
||||
@@ -499,9 +489,9 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
* @param object $_args
|
||||
* @return object $_data
|
||||
*/
|
||||
function plugin_information( $_data, $_action = '', $_args = null ) {
|
||||
//by default $data = false (from Wordpress)
|
||||
if ( $_action != 'plugin_information' ) {
|
||||
public function plugin_information( $_data, $_action = '', $_args = null ) {
|
||||
//by default $data = false (from WordPress)
|
||||
if ( 'plugin_information' !== $_action ) {
|
||||
return $_data;
|
||||
}
|
||||
|
||||
@@ -513,19 +503,21 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
if ( false === $api_request_transient ) {
|
||||
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug );
|
||||
|
||||
$api_request_transient = $this->single_request( 'plugin_latest_version', array(
|
||||
'slug' => $slug,
|
||||
'license' => $data['license'],
|
||||
'item_name' => $data['title'],
|
||||
'version' => $plugin_data['Version']
|
||||
) );
|
||||
$api_request_transient = $this->single_request(
|
||||
array(
|
||||
'slug' => $slug,
|
||||
'license' => $data['license'],
|
||||
'item_name' => $data['title'],
|
||||
'version' => $plugin_data['Version'],
|
||||
)
|
||||
);
|
||||
$this->set_version_info_cache( $slug, $api_request_transient );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
||||
// If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
||||
if ( isset( $api_request_transient ) ) {
|
||||
$_data = $api_request_transient;
|
||||
}
|
||||
@@ -533,23 +525,6 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
return $_data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disable SSL verification in order to prevent download update failures
|
||||
*
|
||||
* @param array $args
|
||||
* @param string $url
|
||||
* @return array $array
|
||||
*/
|
||||
function http_request_args( $args, $url ) {
|
||||
// If it is an https request and we are performing a package download, disable ssl verification
|
||||
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'action=package_download' ) ) {
|
||||
$args['sslverify'] = false;
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download extension URL
|
||||
*
|
||||
@@ -559,51 +534,46 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function extend_download_url( $download_url, $slug, $data ) {
|
||||
|
||||
$url = get_site_url( get_current_blog_id() );
|
||||
$domain = strtolower( urlencode( rtrim( $url, '/' ) ) );
|
||||
private function extend_download_url( $download_url, $slug, $data ) {
|
||||
$url = get_site_url( get_current_blog_id() );
|
||||
$domain = strtolower( urlencode( rtrim( $url, '/' ) ) );
|
||||
|
||||
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug );
|
||||
|
||||
$api_params = array(
|
||||
'action' => 'get_last_version',
|
||||
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
|
||||
'item_name' => str_replace( 'Ultimate Member - ', '', $plugin_data['Name'] ),
|
||||
'blog_id' => get_current_blog_id(),
|
||||
'site_url' => urlencode( $url ),
|
||||
'domain' => urlencode( $domain ),
|
||||
'slug' => urlencode( $slug ),
|
||||
'action' => 'get_last_version',
|
||||
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
|
||||
'item_name' => str_replace( 'Ultimate Member - ', '', $plugin_data['Name'] ),
|
||||
'blog_id' => get_current_blog_id(),
|
||||
'site_url' => urlencode( $url ),
|
||||
'domain' => urlencode( $domain ),
|
||||
'slug' => urlencode( $slug ),
|
||||
);
|
||||
|
||||
$download_url = add_query_arg( $api_params, $download_url );
|
||||
|
||||
return $download_url;
|
||||
return add_query_arg( $api_params, $download_url );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $slug
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function get_cache_key( $slug ) {
|
||||
private function get_cache_key( $slug ) {
|
||||
$exts = $this->get_active_plugins();
|
||||
|
||||
if ( empty( $exts[ $slug ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 'edd_sl_' . md5( serialize( $slug . $exts[ $slug ]['license'] ) );
|
||||
return 'edd_sl_' . md5( maybe_serialize( $slug . $exts[ $slug ]['license'] ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $slug
|
||||
*
|
||||
* @return array|bool|mixed|object
|
||||
*/
|
||||
function get_cached_version_info( $slug ) {
|
||||
private function get_cached_version_info( $slug ) {
|
||||
$cache_key = $this->get_cache_key( $slug );
|
||||
if ( empty( $cache_key ) ) {
|
||||
return false;
|
||||
@@ -629,12 +599,11 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
return $cache['value'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $slug
|
||||
* @param string $slug
|
||||
* @param string $value
|
||||
*/
|
||||
function set_version_info_cache( $slug, $value = '' ) {
|
||||
private function set_version_info_cache( $slug, $value = '' ) {
|
||||
$cache_key = $this->get_cache_key( $slug );
|
||||
if ( empty( $cache_key ) ) {
|
||||
return;
|
||||
@@ -642,11 +611,10 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
|
||||
$data = array(
|
||||
'timeout' => strtotime( '+6 hours', time() ),
|
||||
'value' => json_encode( $value )
|
||||
'value' => wp_json_encode( $value ),
|
||||
);
|
||||
|
||||
update_option( $cache_key, $data, 'no' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -89,13 +89,12 @@ if ( ! class_exists( 'um\core\Query' ) ) {
|
||||
"SELECT *
|
||||
FROM {$wpdb->posts}
|
||||
WHERE post_type = 'page' AND
|
||||
post_status = 'publish'",
|
||||
OBJECT
|
||||
post_status = 'publish'"
|
||||
);
|
||||
|
||||
$array = array();
|
||||
if( $wpdb->num_rows > 0 ){
|
||||
foreach ($pages as $page_data) {
|
||||
if ( $wpdb->num_rows > 0 ) {
|
||||
foreach ( $pages as $page_data ) {
|
||||
$array[ $page_data->ID ] = $page_data->post_title;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1379,16 +1379,23 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
foreach ( $files as $file ) {
|
||||
$str = basename( $file );
|
||||
|
||||
if ( strstr( $str, 'profile_photo' ) || strstr( $str, 'cover_photo' ) || preg_grep( '/' . $str . '/', $_array ) ) {
|
||||
if ( false !== strpos( $str, 'profile_photo' ) || false !== strpos( $str, 'cover_photo' ) || preg_grep( '/' . $str . '/', $_array ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't delete photo that belongs to the Social Activity post or Groups post
|
||||
if ( strstr( $str, 'stream_photo' ) ) {
|
||||
if ( false !== strpos( $str, 'stream_photo' ) ) {
|
||||
global $wpdb;
|
||||
$is_post_image = $wpdb->get_var( "
|
||||
SELECT COUNT(*) FROM {$wpdb->postmeta}
|
||||
WHERE `meta_key`='_photo' AND `meta_value`='{$str}';" );
|
||||
$is_post_image = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT COUNT(*)
|
||||
FROM {$wpdb->postmeta}
|
||||
WHERE meta_key = '_photo' AND
|
||||
meta_value = %s",
|
||||
$str
|
||||
)
|
||||
);
|
||||
|
||||
if ( $is_post_image ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,15 @@ if ( ! class_exists( 'um\core\User_posts' ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$count = $wpdb->get_var("SELECT COUNT(comment_ID) FROM " . $wpdb->comments. " WHERE user_id = " . $user_id . " AND comment_approved = '1'");
|
||||
$count = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT COUNT(comment_ID)
|
||||
FROM {$wpdb->comments}
|
||||
WHERE user_id = %d AND
|
||||
comment_approved = '1'",
|
||||
$user_id
|
||||
)
|
||||
);
|
||||
|
||||
return $this->pretty_number_formatting( $count );
|
||||
}
|
||||
|
||||
@@ -110,14 +110,16 @@ if ( ! class_exists( 'um\core\rest\API_v1' ) ) {
|
||||
$user = get_transient( md5( 'um_api_user_' . $key ) );
|
||||
|
||||
if ( false === $user ) {
|
||||
$user = $wpdb->get_var( $wpdb->prepare(
|
||||
"SELECT user_id
|
||||
FROM $wpdb->usermeta
|
||||
WHERE meta_key = 'um_user_public_key' AND
|
||||
meta_value = %s
|
||||
LIMIT 1",
|
||||
$key
|
||||
) );
|
||||
$user = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT user_id
|
||||
FROM $wpdb->usermeta
|
||||
WHERE meta_key = 'um_user_public_key' AND
|
||||
meta_value = %s
|
||||
LIMIT 1",
|
||||
$key
|
||||
)
|
||||
);
|
||||
set_transient( md5( 'um_api_user_' . $key ) , $user, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
|
||||
@@ -109,14 +109,16 @@ if ( ! class_exists( 'um\core\rest\API_v2' ) ) {
|
||||
$user = get_transient( md5( 'um_api_user_' . $key ) );
|
||||
|
||||
if ( false === $user ) {
|
||||
$user = $wpdb->get_var( $wpdb->prepare(
|
||||
"SELECT user_id
|
||||
FROM $wpdb->usermeta
|
||||
WHERE meta_key = 'um_user_public_key' AND
|
||||
meta_value = %s
|
||||
LIMIT 1",
|
||||
$key
|
||||
) );
|
||||
$user = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT user_id
|
||||
FROM $wpdb->usermeta
|
||||
WHERE meta_key = 'um_user_public_key' AND
|
||||
meta_value = %s
|
||||
LIMIT 1",
|
||||
$key
|
||||
)
|
||||
);
|
||||
set_transient( md5( 'um_api_user_' . $key ) , $user, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
|
||||
@@ -681,7 +681,7 @@ function um_after_account_privacy( $args ) {
|
||||
} else {
|
||||
if ( UM()->account()->current_password_is_required( 'privacy_download_data' ) ) {
|
||||
?>
|
||||
<label name="um-export-data">
|
||||
<label name="um-export-data" for="um-export-data">
|
||||
<?php esc_html_e( 'Enter your current password to confirm a new export of your personal data.', 'ultimate-member' ); ?>
|
||||
</label>
|
||||
<div class="um-field-area">
|
||||
@@ -771,8 +771,10 @@ function um_after_account_privacy( $args ) {
|
||||
} else {
|
||||
if ( UM()->account()->current_password_is_required( 'privacy_erase_data' ) ) {
|
||||
?>
|
||||
<label name="um-erase-data">
|
||||
<label name="um-erase-data" for="um-erase-data">
|
||||
<?php esc_html_e( 'Enter your current password to confirm the erasure of your personal data.', 'ultimate-member' ); ?>
|
||||
</label>
|
||||
<div class="um-field-area">
|
||||
<?php if ( UM()->options()->get( 'toggle_password' ) ) { ?>
|
||||
<div class="um-field-area-password">
|
||||
<input id="um-erase-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' ); ?>">
|
||||
@@ -785,7 +787,7 @@ function um_after_account_privacy( $args ) {
|
||||
<span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span><?php esc_html_e( 'You must enter a password', 'ultimate-member' ); ?>
|
||||
</div>
|
||||
<div class="um-field-area-response um-erase-data"></div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a form identifier to form
|
||||
@@ -7,58 +9,42 @@
|
||||
* @param $args
|
||||
*/
|
||||
function um_add_form_identifier( $args ) {
|
||||
// Ignore wp-admin preview.
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore UM:Profile in view mode.
|
||||
if ( 'profile' === UM()->fields()->set_mode && true !== UM()->fields()->editing ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="form_id" id="form_id_<?php echo esc_attr( $args['form_id'] ); ?>" value="<?php echo esc_attr( $args['form_id'] ); ?>" />
|
||||
<input type="hidden" name="form_id" id="form_id_<?php echo esc_attr( $args['form_id'] ); ?>" value="<?php echo esc_attr( $args['form_id'] ); ?>" />
|
||||
<?php
|
||||
}
|
||||
add_action( 'um_after_form_fields', 'um_add_form_identifier' );
|
||||
|
||||
|
||||
/**
|
||||
* Adds a spam timestamp
|
||||
*
|
||||
* @param $args
|
||||
*/
|
||||
function um_add_security_checks( $args ) {
|
||||
// Ignore wp-admin preview.
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
} ?>
|
||||
}
|
||||
|
||||
// Ignore UM:Profile in view mode.
|
||||
if ( 'profile' === UM()->fields()->set_mode && true !== UM()->fields()->editing ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<p class="<?php echo esc_attr( UM()->honeypot ); ?>_name">
|
||||
<label for="<?php echo esc_attr( UM()->honeypot ) . '_' . $args['form_id']; ?>"><?php _e( 'Only fill in if you are not human' ); ?></label>
|
||||
<input type="hidden" name="<?php echo esc_attr( UM()->honeypot ); ?>" id="<?php echo esc_attr( UM()->honeypot ) . '_' . $args['form_id']; ?>" class="input" value="" size="25" autocomplete="off" />
|
||||
<label for="<?php echo esc_attr( UM()->honeypot . '_' . $args['form_id'] ); ?>"><?php esc_html_e( 'Only fill in if you are not human' ); ?></label>
|
||||
<input type="hidden" name="<?php echo esc_attr( UM()->honeypot ); ?>" id="<?php echo esc_attr( UM()->honeypot . '_' . $args['form_id'] ); ?>" class="input" value="" size="25" autocomplete="off" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
add_action( 'um_after_form_fields', 'um_add_security_checks' );
|
||||
add_action( 'um_account_page_hidden_fields', 'um_add_security_checks' );
|
||||
|
||||
|
||||
/**
|
||||
* Makes the honeypot invisible
|
||||
*/
|
||||
function um_add_form_honeypot_css() {
|
||||
?>
|
||||
<style type="text/css">
|
||||
.<?php echo esc_attr( UM()->honeypot ); ?>_name {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_head', 'um_add_form_honeypot_css' );
|
||||
|
||||
/**
|
||||
* Empty the honeypot value
|
||||
*/
|
||||
function um_add_form_honeypot_js() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery( window ).on( 'load', function() {
|
||||
jQuery('input[name="<?php echo esc_js( UM()->honeypot ); ?>"]').val('');
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_footer', 'um_add_form_honeypot_js', 99999999999999999 );
|
||||
@@ -672,24 +672,6 @@ function um_profile_dynamic_meta_desc() {
|
||||
$description = um_convert_tags( UM()->options()->get( 'profile_desc' ) );
|
||||
$url = um_user_profile_url( $user_id );
|
||||
|
||||
/**
|
||||
* Filters the profile SEO image size. Default 190. Available 'original'.
|
||||
*
|
||||
* @param {string} $image_size Image size.
|
||||
* @param {int} $user_id User ID.
|
||||
*
|
||||
* @return {array} Changed image type
|
||||
*
|
||||
* @since 2.5.5
|
||||
* @hook um_profile_dynamic_meta_image_size
|
||||
*
|
||||
* @example <caption>Change meta image to cover photo `cover_photo`.</caption>
|
||||
* function my_um_profile_dynamic_meta_image_size( $image_size, $user_id ) {
|
||||
* return 'original';
|
||||
* }
|
||||
* add_filter( 'um_profile_dynamic_meta_image_size', 'my_um_profile_dynamic_meta_image_size', 10, 2 );
|
||||
*/
|
||||
$image_size = apply_filters( 'um_profile_dynamic_meta_image_size', 190, $user_id );
|
||||
/**
|
||||
* Filters the profile SEO image type. Default 'profile_photo'. Available 'cover_photo', 'profile_photo'.
|
||||
*
|
||||
@@ -709,6 +691,29 @@ function um_profile_dynamic_meta_desc() {
|
||||
*/
|
||||
$image_type = apply_filters( 'um_profile_dynamic_meta_image_type', 'profile_photo', $user_id );
|
||||
|
||||
// The minimum size is 200 x 200 px, however, we recommend keeping it to 600 x 315 px.
|
||||
// If your image is smaller than 600 x 315 pixels, it will appear as a small image in the link preview.
|
||||
$default_image_size = 'cover_photo' === $image_type ? 600 : 200;
|
||||
|
||||
/**
|
||||
* Filters the profile SEO image size. Default 190. Available 'original'.
|
||||
*
|
||||
* @param {string} $image_size Image size.
|
||||
* @param {int} $user_id User ID.
|
||||
*
|
||||
* @return {array} Changed image type
|
||||
*
|
||||
* @since 2.5.5
|
||||
* @hook um_profile_dynamic_meta_image_size
|
||||
*
|
||||
* @example <caption>Change meta image to cover photo `cover_photo`.</caption>
|
||||
* function my_um_profile_dynamic_meta_image_size( $image_size, $user_id ) {
|
||||
* return 'original';
|
||||
* }
|
||||
* add_filter( 'um_profile_dynamic_meta_image_size', 'my_um_profile_dynamic_meta_image_size', 10, 2 );
|
||||
*/
|
||||
$image_size = apply_filters( 'um_profile_dynamic_meta_image_size', $default_image_size, $user_id );
|
||||
|
||||
if ( 'cover_photo' === $image_type ) {
|
||||
if ( is_numeric( $image_size ) ) {
|
||||
$sizes = UM()->options()->get( 'cover_thumb_sizes' );
|
||||
@@ -730,10 +735,17 @@ function um_profile_dynamic_meta_desc() {
|
||||
}
|
||||
|
||||
$image = current( explode( '?', $image ) ); // strip $_GET attributes from photo URL.
|
||||
$image_url = wp_parse_url( $image );
|
||||
$image_name = explode( '/', $image_url['path'] );
|
||||
$image_name = end( $image_name );
|
||||
$image_info = wp_check_filetype( $image_name );
|
||||
$image_path = wp_normalize_path( ABSPATH . wp_parse_url( $image, PHP_URL_PATH ) );
|
||||
$image_info = wp_check_filetype( $image_path );
|
||||
|
||||
$imagesizes = getimagesize( $image_path );
|
||||
if ( is_array( $imagesizes ) ) {
|
||||
$image_width = $imagesizes[0];
|
||||
$image_height = $imagesizes[1];
|
||||
} else {
|
||||
$image_width = $image_size;
|
||||
$image_height = $image_size;
|
||||
}
|
||||
|
||||
$person = array(
|
||||
'@context' => 'https://schema.org',
|
||||
@@ -796,10 +808,8 @@ function um_profile_dynamic_meta_desc() {
|
||||
<meta property="og:description" content="<?php echo esc_attr( $description ); ?>"/>
|
||||
<meta property="og:image" content="<?php echo esc_url( $image ); ?>"/>
|
||||
<meta property="og:image:alt" content="<?php esc_attr_e( 'Profile photo', 'ultimate-member' ); ?>"/>
|
||||
<?php if ( is_numeric( $image_size ) ) { ?>
|
||||
<meta property="og:image:height" content="<?php echo absint( $image_size ); ?>"/>
|
||||
<meta property="og:image:width" content="<?php echo absint( $image_size ); ?>"/>
|
||||
<?php } ?>
|
||||
<meta property="og:image:height" content="<?php echo absint( $image_height ); ?>"/>
|
||||
<meta property="og:image:width" content="<?php echo absint( $image_width ); ?>"/>
|
||||
<?php if ( is_ssl() ) { ?>
|
||||
<meta property="og:image:secure_url" content="<?php echo esc_url( $image ); ?>"/>
|
||||
<?php } ?>
|
||||
@@ -832,149 +842,141 @@ add_action( 'wp_head', 'um_profile_dynamic_meta_desc', 20 );
|
||||
* @param $args
|
||||
*/
|
||||
function um_profile_header_cover_area( $args ) {
|
||||
if ( isset( $args['cover_enabled'] ) && $args['cover_enabled'] == 1 ) {
|
||||
if ( empty( $args['cover_enabled'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$default_cover = UM()->options()->get( 'default_cover' );
|
||||
$default_cover = UM()->options()->get( 'default_cover' );
|
||||
$user_cover = um_user( 'cover_photo' );
|
||||
|
||||
$overlay = '<span class="um-cover-overlay">
|
||||
$cover_wrapper_classes = array( 'um-cover' );
|
||||
if ( $user_cover || ! empty( $default_cover['url'] ) ) {
|
||||
$cover_wrapper_classes[] = 'has-cover';
|
||||
}
|
||||
?>
|
||||
<div class="<?php echo esc_attr( implode( ' ', $cover_wrapper_classes ) ); ?>"
|
||||
data-user_id="<?php echo esc_attr( um_profile_id() ); ?>" data-ratio="<?php echo esc_attr( $args['cover_ratio'] ); ?>">
|
||||
<?php
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_cover_area_content
|
||||
* @description Cover area content change
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_cover_area_content', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_cover_area_content', 'my_cover_area_content', 10, 1 );
|
||||
* function my_cover_area_content( $user_id ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_cover_area_content', um_profile_id() );
|
||||
if ( true === UM()->fields()->editing ) {
|
||||
|
||||
$hide_remove = ' style="display:none;"';
|
||||
$remove_classes = array( 'um-reset-cover-photo' );
|
||||
if ( $user_cover ) {
|
||||
$hide_remove = '';
|
||||
$remove_classes[] = 'um-is-visible';
|
||||
}
|
||||
|
||||
$text = ! $user_cover ? __( 'Upload a cover photo', 'ultimate-member' ) : __( 'Change cover photo', 'ultimate-member' );
|
||||
$alt_text = $user_cover ? __( 'Upload a cover photo', 'ultimate-member' ) : __( 'Change cover photo', 'ultimate-member' );
|
||||
|
||||
$items = array(
|
||||
'<a href="javascript:void(0);" class="um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width" data-alt_text="' . esc_attr( $alt_text ) . '">' . esc_html( $text ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="' . esc_attr( implode( ' ', $remove_classes ) ) . '" data-user_id="' . esc_attr( um_profile_id() ) . '" ' . $hide_remove . '>' . esc_html__( 'Remove cover photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-dropdown-hide">' . esc_html__( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
$items = apply_filters( 'um_cover_area_content_dropdown_items', $items, um_profile_id() );
|
||||
|
||||
UM()->profile()->new_ui( 'bc', 'div.um-cover', 'click', $items );
|
||||
} elseif ( ! $user_cover && ! isset( UM()->user()->cannot_edit ) ) {
|
||||
$items = array(
|
||||
'<a href="javascript:void(0);" class="um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width">' . esc_html__( 'Upload a cover photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-dropdown-hide">' . esc_html__( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
$items = apply_filters( 'um_cover_area_content_dropdown_items', $items, um_profile_id() );
|
||||
|
||||
UM()->profile()->new_ui( 'bc', 'div.um-cover', 'click', $items );
|
||||
}
|
||||
|
||||
UM()->fields()->add_hidden_field( 'cover_photo' );
|
||||
?>
|
||||
<div class="um-cover-e" data-ratio="<?php echo esc_attr( $args['cover_ratio'] ); ?>">
|
||||
<?php
|
||||
if ( $user_cover ) {
|
||||
|
||||
$get_cover_size = $args['coversize'];
|
||||
if ( ! $get_cover_size || 'original' === $get_cover_size ) {
|
||||
$size = null;
|
||||
} else {
|
||||
$size = $get_cover_size;
|
||||
}
|
||||
|
||||
if ( wp_is_mobile() ) {
|
||||
// Set for mobile width = 300 by default but can be changed via filter
|
||||
$size = 300;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_mobile_cover_photo
|
||||
* @description Add size for mobile device
|
||||
* @input_vars
|
||||
* [{"var":"$size","type":"int","desc":"Form's agrument - Cover Photo size"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_mobile_cover_photo', 'change_size', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_mobile_cover_photo', 'um_change_cover_mobile_size', 10, 1 );
|
||||
* function um_change_cover_mobile_size( $size ) {
|
||||
* // your code here
|
||||
* return $size;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$size = apply_filters( 'um_mobile_cover_photo', $size );
|
||||
}
|
||||
|
||||
echo um_user( 'cover_photo', $size );
|
||||
|
||||
} elseif ( ! empty( $default_cover['url'] ) ) {
|
||||
|
||||
echo '<img src="' . esc_url( $default_cover['url'] ) . '" alt="" />';
|
||||
|
||||
} elseif ( ! isset( UM()->user()->cannot_edit ) ) {
|
||||
?>
|
||||
<a href="javascript:void(0);" class="um-cover-add"><span class="um-cover-add-i"><i
|
||||
class="um-icon-plus um-tip-n"
|
||||
title="<?php esc_attr_e( 'Upload a cover photo', 'ultimate-member' ); ?>"></i></span></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php if ( true === UM()->fields()->editing ) { ?>
|
||||
<span class="um-cover-overlay">
|
||||
<span class="um-cover-overlay-s">
|
||||
<ins>
|
||||
<i class="um-faicon-picture-o"></i>
|
||||
<span class="um-cover-overlay-t">' . __( 'Change your cover photo', 'ultimate-member' ) . '</span>
|
||||
<span class="um-cover-overlay-t"><?php esc_html_e( 'Change your cover photo', 'ultimate-member' ); ?></span>
|
||||
</ins>
|
||||
</span>
|
||||
</span>';
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-cover <?php if ( um_user( 'cover_photo' ) || ( $default_cover && $default_cover['url'] ) ) echo 'has-cover'; ?>"
|
||||
data-user_id="<?php echo esc_attr( um_profile_id() ); ?>" data-ratio="<?php echo esc_attr( $args['cover_ratio'] ); ?>">
|
||||
|
||||
<?php
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_cover_area_content
|
||||
* @description Cover area content change
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_cover_area_content', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_cover_area_content', 'my_cover_area_content', 10, 1 );
|
||||
* function my_cover_area_content( $user_id ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_cover_area_content', um_profile_id() );
|
||||
if ( true === UM()->fields()->editing ) {
|
||||
|
||||
$hide_remove = um_user( 'cover_photo' ) ? false : ' style="display:none;"';
|
||||
|
||||
$text = ! um_user( 'cover_photo' ) ? __( 'Upload a cover photo', 'ultimate-member' ) : __( 'Change cover photo', 'ultimate-member' ) ;
|
||||
|
||||
$items = array(
|
||||
'<a href="javascript:void(0);" class="um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width">' . $text . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-reset-cover-photo" data-user_id="' . um_profile_id() . '" ' . $hide_remove . '>' . __( 'Remove', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
$items = apply_filters( 'um_cover_area_content_dropdown_items', $items, um_profile_id() );
|
||||
|
||||
UM()->profile()->new_ui( 'bc', 'div.um-cover', 'click', $items );
|
||||
} else {
|
||||
|
||||
if ( ! isset( UM()->user()->cannot_edit ) && ! um_user( 'cover_photo' ) ) {
|
||||
|
||||
$items = array(
|
||||
'<a href="javascript:void(0);" class="um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width">' . __( 'Upload a cover photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
$items = apply_filters( 'um_cover_area_content_dropdown_items', $items, um_profile_id() );
|
||||
|
||||
UM()->profile()->new_ui( 'bc', 'div.um-cover', 'click', $items );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UM()->fields()->add_hidden_field( 'cover_photo' ); ?>
|
||||
|
||||
<div class="um-cover-e" data-ratio="<?php echo esc_attr( $args['cover_ratio'] ); ?>">
|
||||
|
||||
<?php if ( um_user( 'cover_photo' ) ) {
|
||||
|
||||
$get_cover_size = $args['coversize'];
|
||||
|
||||
if ( ! $get_cover_size || $get_cover_size == 'original' ) {
|
||||
$size = null;
|
||||
} else {
|
||||
$size = $get_cover_size;
|
||||
}
|
||||
|
||||
if ( wp_is_mobile() ) {
|
||||
// Set for mobile width = 300 by default but can be changed via filter
|
||||
$size = 300;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_mobile_cover_photo
|
||||
* @description Add size for mobile device
|
||||
* @input_vars
|
||||
* [{"var":"$size","type":"int","desc":"Form's agrument - Cover Photo size"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_mobile_cover_photo', 'change_size', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_mobile_cover_photo', 'um_change_cover_mobile_size', 10, 1 );
|
||||
* function um_change_cover_mobile_size( $size ) {
|
||||
* // your code here
|
||||
* return $size;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$size = apply_filters( 'um_mobile_cover_photo', $size );
|
||||
}
|
||||
|
||||
echo um_user( 'cover_photo', $size );
|
||||
|
||||
} elseif ( $default_cover && $default_cover['url'] ) {
|
||||
|
||||
$default_cover = $default_cover['url'];
|
||||
|
||||
echo '<img src="' . esc_url( $default_cover ) . '" alt="" />';
|
||||
|
||||
} else {
|
||||
|
||||
if ( ! isset( UM()->user()->cannot_edit ) ) { ?>
|
||||
|
||||
<a href="javascript:void(0);" class="um-cover-add"><span class="um-cover-add-i"><i
|
||||
class="um-icon-plus um-tip-n"
|
||||
title="<?php esc_attr_e( 'Upload a cover photo', 'ultimate-member' ); ?>"></i></span></a>
|
||||
|
||||
<?php }
|
||||
|
||||
} ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php echo $overlay; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
</span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
add_action( 'um_profile_header_cover_area', 'um_profile_header_cover_area', 9 );
|
||||
|
||||
@@ -1076,8 +1078,9 @@ function um_profile_header( $args ) {
|
||||
if ( ! um_profile( 'profile_photo' ) ) { // has profile photo
|
||||
|
||||
$items = array(
|
||||
'<a href="javascript:void(0);" class="um-manual-trigger" data-parent=".um-profile-photo" data-child=".um-btn-auto-width">' . __( 'Upload photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-manual-trigger" data-parent=".um-profile-photo" data-child=".um-btn-auto-width" data-alt_text="' . esc_attr__( 'Change photo', 'ultimate-member' ) . '">' . esc_html__( 'Upload photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-reset-profile-photo" data-user_id="' . esc_attr( um_profile_id() ) . '" data-default_src="' . esc_url( um_get_default_avatar_uri() ) . '" style="display:none;">' . esc_html__( 'Remove photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-dropdown-hide">' . esc_html__( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1108,9 +1111,9 @@ function um_profile_header( $args ) {
|
||||
} elseif ( true === UM()->fields()->editing ) {
|
||||
|
||||
$items = array(
|
||||
'<a href="javascript:void(0);" class="um-manual-trigger" data-parent=".um-profile-photo" data-child=".um-btn-auto-width">' . __( 'Change photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-reset-profile-photo" data-user_id="' . esc_attr( um_profile_id() ) . '" data-default_src="' . esc_url( um_get_default_avatar_uri() ) . '">' . __( 'Remove photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-manual-trigger" data-parent=".um-profile-photo" data-child=".um-btn-auto-width" data-alt_text="' . esc_attr__( 'Upload photo', 'ultimate-member' ) . '">' . esc_html__( 'Change photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-reset-profile-photo um-is-visible" data-user_id="' . esc_attr( um_profile_id() ) . '" data-default_src="' . esc_url( um_get_default_avatar_uri() ) . '">' . esc_html__( 'Remove photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-dropdown-hide">' . esc_html__( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -144,6 +144,18 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
$localize_data = apply_filters( 'um_enqueue_localize_data', $localize_data );
|
||||
wp_localize_script( 'um_scripts', 'um_scripts', $localize_data );
|
||||
|
||||
// Makes the honeypot.
|
||||
if ( ! empty( UM()->fields()->set_mode ) && ( 'profile' !== UM()->fields()->set_mode || true === UM()->fields()->editing ) ) {
|
||||
ob_start();
|
||||
?>
|
||||
jQuery( window ).on( 'load', function() {
|
||||
jQuery('input[name="<?php echo esc_js( UM()->honeypot ); ?>"]').val('');
|
||||
});
|
||||
<?php
|
||||
$inline_script = ob_get_clean();
|
||||
wp_add_inline_script( 'um_scripts', $inline_script );
|
||||
}
|
||||
|
||||
wp_register_script( 'um_dropdown', $js_url . 'dropdown' . $suffix . '.js', array( 'jquery' ), UM_VERSION, true );
|
||||
|
||||
wp_register_script( 'um_members', $js_url . 'um-members' . $suffix . '.js', array( 'jquery', 'wp-util', 'jquery-ui-slider', 'um_dropdown', 'wp-hooks', 'jquery-masonry', 'um_scripts' ), UM_VERSION, true );
|
||||
@@ -194,6 +206,18 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
$deps = array_merge( array( 'um_ui', 'um_tipsy', 'um_raty', 'select2', 'um_fileupload', 'um_common', 'um_responsive', 'um_modal' ), self::$fonticons_handlers );
|
||||
wp_register_style( 'um_styles', $css_url . 'um-styles' . $suffix . '.css', $deps, UM_VERSION );
|
||||
|
||||
// Makes the honeypot invisible.
|
||||
if ( ! empty( UM()->fields()->set_mode ) && ( 'profile' !== UM()->fields()->set_mode || true === UM()->fields()->editing ) ) {
|
||||
ob_start();
|
||||
?>
|
||||
.<?php echo esc_attr( UM()->honeypot ); ?>_name {
|
||||
display: none !important;
|
||||
}
|
||||
<?php
|
||||
$inline_styles = ob_get_clean();
|
||||
wp_add_inline_style( 'um_styles', $inline_styles );
|
||||
}
|
||||
|
||||
wp_register_style( 'um_members', $css_url . 'um-members' . $suffix . '.css', array( 'um_styles' ), UM_VERSION );
|
||||
// RTL styles.
|
||||
if ( is_rtl() ) {
|
||||
|
||||
@@ -218,9 +218,13 @@ function um_is_meta_value_exists( $key, $value, $return_user_id = false ) {
|
||||
return UM()->profile()->arr_user_slugs['is_' . $return_user_id][$key];
|
||||
}
|
||||
|
||||
if (!$return_user_id) {
|
||||
$count = $wpdb->get_var( $wpdb->prepare(
|
||||
"SELECT COUNT(*) as count FROM {$wpdb->usermeta} WHERE meta_key = %s AND meta_value = %s ",
|
||||
if ( ! $return_user_id ) {
|
||||
$count = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT COUNT(*) AS count
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = %s AND
|
||||
meta_value = %s ",
|
||||
$key,
|
||||
$value
|
||||
) );
|
||||
@@ -230,11 +234,16 @@ function um_is_meta_value_exists( $key, $value, $return_user_id = false ) {
|
||||
return $count;
|
||||
}
|
||||
|
||||
$user_id = $wpdb->get_var( $wpdb->prepare(
|
||||
"SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = %s AND meta_value = %s ",
|
||||
$key,
|
||||
$value
|
||||
) );
|
||||
$user_id = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT user_id
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = %s AND
|
||||
meta_value = %s",
|
||||
$key,
|
||||
$value
|
||||
)
|
||||
);
|
||||
|
||||
UM()->profile()->arr_user_slugs['is_' . $return_user_id][$key] = $user_id;
|
||||
|
||||
|
||||
+37
-4
@@ -3,10 +3,10 @@ Author URI: https://ultimatemember.com/
|
||||
Plugin URI: https://ultimatemember.com/
|
||||
Contributors: ultimatemember, champsupertramp, nsinelnikov
|
||||
Tags: community, member, membership, user-profile, user-registration
|
||||
Requires PHP: 5.6
|
||||
Requires at least: 5.5
|
||||
Requires PHP: 7.0
|
||||
Requires at least: 6.2
|
||||
Tested up to: 6.7
|
||||
Stable tag: 2.9.2
|
||||
Stable tag: 2.10.0
|
||||
License: GPLv3
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
@@ -39,7 +39,7 @@ Read about all of the plugin's features at [Ultimate Member](https://ultimatemem
|
||||
|
||||
= Paid Extensions =
|
||||
|
||||
Ultimate Member has a range of extensions that allow you to extend the power of the plugin. You can purchase all of these extensions at a significant discount with our [All Access Pass](https://ultimatemember.com/pricing/) or you can purchase extensions individually.
|
||||
Ultimate Member has a range of extensions that allow you to extend the power of the plugin. You can purchase all of these extensions at a significant discount with one of our [paid plans](https://ultimatemember.com/pricing/) or you can purchase extensions individually.
|
||||
|
||||
* [Zapier](https://ultimatemember.com/extensions/zapier/) - Allow to integrate the Zapier popular apps with Ultimate Member
|
||||
* [Stripe](https://ultimatemember.com/extensions/stripe/) - Sell paid memberships to access your website via Stripe subscriptions
|
||||
@@ -167,6 +167,36 @@ No specific extensions are needed. But we highly recommended keep active these P
|
||||
|
||||
IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSION 2.6.7 PATCHES SECURITY PRIVILEGE ESCALATION VULNERABILITY. PLEASE SEE [THIS ARTICLE](https://docs.ultimatemember.com/article/1866-security-incident-update-and-recommended-actions) FOR MORE INFORMATION
|
||||
|
||||
= 2.10.0 2025-02-17 =
|
||||
|
||||
**Enhancements**
|
||||
|
||||
* Added: User Profile `form-id` attribute and updated code for Profile/Cover photos actions dropdowns.
|
||||
* Added: Honeypot scripts/styles via `wp_add_inline_script()`, `wp_add_inline_style()` changed from direct adding in header and footer.
|
||||
* Updated: We've made improvements to requests for extension updates to boost stability.
|
||||
* Updated: PHP requirement - the minimum PHP version is now upgraded to 7.0.
|
||||
* Updated: Using $wpdb and WPCS for queries. Set minimum required version to 6.2 due to using %i for `$wpdb->prepare()`.
|
||||
* Updated: Revised wp-admin user actions handling. Now, the required capability is `edit_users` instead of `manage_options`.
|
||||
* Removed: User Profile hidden inputs on view mode.
|
||||
* Tweak: WPCS enhancements.
|
||||
|
||||
**Bugfixes**
|
||||
|
||||
* Fixed: Security issue CVE ID: CVE-2024-12276.
|
||||
* Fixed: Custom usermeta table metakeys for filtering in member directory (from `_money_spent` to `wc_money_spent_` and added `wc_order_count_`).
|
||||
* Fixed: Layout for "Download your data" and "Erase of your data" fields.
|
||||
* Fixed: Image sizes used for Open Graph meta in User Profile headers are now corrected.
|
||||
* Fixed: "Delete account text" settings visibility issue in wp-admin.
|
||||
* Fixed: The "Privacy Policy" field in the registration form. Disallowed HTML from the "Privacy Policy" content (like `<form>`) is filtered out by the `wp_kses()` function.
|
||||
* Fixed: Password fields are now sanitized the WordPress native way, with `wp_unslash()` omitted post-submission.
|
||||
|
||||
**Templates required update**
|
||||
|
||||
* gdpr-register.php
|
||||
* profile.php
|
||||
|
||||
**Cached and optimized/minified assets(JS/CSS) must be flushed/re-generated after upgrade**
|
||||
|
||||
= 2.9.2 2025-01-14 =
|
||||
|
||||
**Enhancements**
|
||||
@@ -237,6 +267,9 @@ IMPORTANT: PLEASE UPDATE THE PLUGIN TO AT LEAST VERSION 2.6.7 IMMEDIATELY. VERSI
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 2.10.0 =
|
||||
Increased the minimum PHP and WordPress requirements. The plugin now requires at least PHP 7.0 and WordPress 6.2. This version fixes a security related bug. Upgrade immediately.
|
||||
|
||||
= 2.9.2 =
|
||||
This version fixes a security related bug. Upgrade immediately.
|
||||
|
||||
|
||||
+35
-28
@@ -7,59 +7,66 @@
|
||||
* Page: "Register"
|
||||
* Call: function display_option()
|
||||
*
|
||||
* @version 2.6.1
|
||||
* @version 2.10.0
|
||||
*
|
||||
* @var object $um_content_query
|
||||
* @var array $args
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// The "Privacy Policy" field content can not contain forms.
|
||||
$allowed_html = UM()->get_allowed_html( 'templates' );
|
||||
unset( $allowed_html['form'] );
|
||||
|
||||
$content = '';
|
||||
if ( ! empty( $args['use_gdpr_content_id'] ) ) {
|
||||
$um_content_query = get_post( $args['use_gdpr_content_id'] );
|
||||
if ( ! empty( $um_content_query ) && ! is_wp_error( $um_content_query ) ) {
|
||||
$content = apply_filters( 'um_gdpr_policies_page_content', $um_content_query->post_content, $args );
|
||||
$content = apply_filters( 'the_content', $content, $um_content_query->ID );
|
||||
}
|
||||
}
|
||||
|
||||
$toggle_show = ! empty( $args['use_gdpr_toggle_show'] ) ? $args['use_gdpr_toggle_show'] : __( 'Show privacy policy', 'ultimate-member' );
|
||||
$toggle_hide = ! empty( $args['use_gdpr_toggle_hide'] ) ? $args['use_gdpr_toggle_hide'] : __( 'Hide privacy policy', 'ultimate-member' );
|
||||
$toggle_title = ! empty( $args['use_gdpr_toggle_show'] ) ? $args['use_gdpr_toggle_show'] : __( 'Show privacy policy', 'ultimate-member' );
|
||||
$confirm = ! empty( $args['use_gdpr_agreement'] ) ? $args['use_gdpr_agreement'] : __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' );
|
||||
|
||||
$form_errors = UM()->form()->errors;
|
||||
$error_message = ! empty( $args['use_gdpr_error_text'] ) ? $args['use_gdpr_error_text'] : __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' );
|
||||
?>
|
||||
|
||||
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
||||
<div class="um-field um-field-type_terms_conditions" data-key="use_terms_conditions_agreement" style="display:block;padding:0;">
|
||||
<div class="um-field-area">
|
||||
<div class="um-gdpr-content" style="display:none;">
|
||||
<?php if ( ! empty( $args['use_gdpr_content_id'] ) ) {
|
||||
$um_content_query = get_post( $args['use_gdpr_content_id'] );
|
||||
if ( ! empty( $um_content_query ) && ! is_wp_error( $um_content_query ) ) {
|
||||
$content = apply_filters( 'um_gdpr_policies_page_content', $um_content_query->post_content, $args );
|
||||
echo apply_filters( 'the_content', $content, $um_content_query->ID );
|
||||
}
|
||||
} ?>
|
||||
<?php
|
||||
if ( ! empty( $content ) ) {
|
||||
echo wp_kses( $content, $allowed_html );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php $toggle_show = ! empty( $args['use_gdpr_toggle_show'] ) ? $args['use_gdpr_toggle_show'] : __( 'Show privacy policy', 'ultimate-member' );
|
||||
$toggle_hide = ! empty( $args['use_gdpr_toggle_hide'] ) ? $args['use_gdpr_toggle_hide'] : __( 'Hide privacy policy', 'ultimate-member' );
|
||||
$toggle_title = ! empty( $args['use_gdpr_toggle_show'] ) ? $args['use_gdpr_toggle_show'] : __( 'Show privacy policy', 'ultimate-member' ); ?>
|
||||
|
||||
<a href="javascript:void(0);" class="um-toggle-gdpr" data-toggle-state="hidden"
|
||||
data-toggle-show="<?php echo esc_attr( $toggle_show ); ?>"
|
||||
data-toggle-hide="<?php echo esc_attr( $toggle_hide ); ?>">
|
||||
data-toggle-show="<?php echo esc_attr( $toggle_show ); ?>"
|
||||
data-toggle-hide="<?php echo esc_attr( $toggle_hide ); ?>">
|
||||
<?php echo esc_html( $toggle_title ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="um-field-area">
|
||||
|
||||
<?php $confirm = ! empty( $args['use_gdpr_agreement'] ) ? $args['use_gdpr_agreement'] : __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ); ?>
|
||||
|
||||
<label class="um-field-checkbox">
|
||||
<input type="checkbox" name="use_gdpr_agreement" value="1">
|
||||
<span class="um-field-checkbox-state"><i class="um-icon-android-checkbox-outline-blank"></i></span>
|
||||
<span class="um-field-checkbox-option"><?php echo esc_html( $confirm ); ?></span>
|
||||
</label>
|
||||
<div class="um-clear"></div>
|
||||
|
||||
<?php $errors = UM()->form()->errors;
|
||||
|
||||
if ( isset( $errors['use_gdpr_agreement'] ) ) {
|
||||
|
||||
$error_message = ! empty( $args['use_gdpr_error_text'] ) ? $args['use_gdpr_error_text'] : __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' ); ?>
|
||||
|
||||
<?php if ( isset( $form_errors['use_gdpr_agreement'] ) ) { ?>
|
||||
<p class="um-notice err">
|
||||
<i class="um-icon-ios-close-empty" onclick="jQuery(this).parent().fadeOut();"></i><?php echo esc_html( $error_message ) ?>
|
||||
<i class="um-icon-ios-close-empty" onclick="jQuery(this).parent().fadeOut();"></i><?php echo esc_html( $error_message ); ?>
|
||||
</p>
|
||||
<br/>
|
||||
<?php } ?>
|
||||
|
||||
<div class="um-clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+196
-187
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Page: "Profile"
|
||||
*
|
||||
* @version 2.6.9
|
||||
* @version 2.10.0
|
||||
*
|
||||
* @var string $mode
|
||||
* @var int $form_id
|
||||
@@ -17,200 +17,227 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
$description_key = UM()->profile()->get_show_bio_key( $args );
|
||||
?>
|
||||
|
||||
<div class="um <?php echo esc_attr( $this->get_class( $mode ) ); ?> um-<?php echo esc_attr( $form_id ); ?> um-role-<?php echo esc_attr( um_user( 'role' ) ); ?> ">
|
||||
|
||||
<div class="um-form" data-mode="<?php echo esc_attr( $mode ) ?>">
|
||||
|
||||
<div class="um <?php echo esc_attr( $this->get_class( $mode ) ); ?> um-<?php echo esc_attr( $form_id ); ?> um-role-<?php echo esc_attr( um_user( 'role' ) ); ?>">
|
||||
<div class="um-form" data-mode="<?php echo esc_attr( $mode ); ?>" data-form_id="<?php echo esc_attr( $form_id ); ?>">
|
||||
<?php
|
||||
/**
|
||||
* UM hook
|
||||
* Fires before User Profile header.
|
||||
* It's the first hook at User Profile wrapper.
|
||||
*
|
||||
* @type action
|
||||
* @title um_profile_before_header
|
||||
* @description Some actions before profile form header
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_profile_before_header', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_profile_before_header', 'my_profile_before_header', 10, 1 );
|
||||
* function my_profile_before_header( $args ) {
|
||||
* Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt):
|
||||
* 10 - `um_profile_completeness_show_notice()` displays Profile Completeness notices.
|
||||
*
|
||||
* @param {array} $args User Profile data.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_profile_before_header
|
||||
*
|
||||
* @example <caption>Display some content before User Profile.</caption>
|
||||
* function my_um_profile_before_header( $args ) {
|
||||
* // your code here
|
||||
* echo $notice;
|
||||
* }
|
||||
* ?>
|
||||
* add_action( 'um_profile_before_header', 'my_um_profile_before_header' );
|
||||
*/
|
||||
do_action( 'um_profile_before_header', $args );
|
||||
|
||||
if ( um_is_on_edit_profile() ) { ?>
|
||||
if ( um_is_on_edit_profile() ) {
|
||||
?>
|
||||
<form method="post" action="" data-description_key="<?php echo esc_attr( $description_key ); ?>">
|
||||
<?php }
|
||||
|
||||
<?php
|
||||
}
|
||||
/**
|
||||
* UM hook
|
||||
* Fires for displaying User Profile cover area.
|
||||
*
|
||||
* @type action
|
||||
* @title um_profile_header_cover_area
|
||||
* @description Profile header cover area
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_profile_header_cover_area', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_profile_header_cover_area', 'my_profile_header_cover_area', 10, 1 );
|
||||
* function my_profile_header_cover_area( $args ) {
|
||||
* Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt):
|
||||
* 9 - `um_profile_header_cover_area()` displays User Profile cover photo.
|
||||
*
|
||||
* @param {array} $args User Profile data.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_profile_header_cover_area
|
||||
*
|
||||
* @example <caption>Display some content before or after User Profile cover.</caption>
|
||||
* function my_um_profile_header_cover_area( $args ) {
|
||||
* // your code here
|
||||
* echo $content;
|
||||
* }
|
||||
* ?>
|
||||
* add_action( 'um_profile_header_cover_area', 'my_um_profile_header_cover_area' );
|
||||
*/
|
||||
do_action( 'um_profile_header_cover_area', $args );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
* Fires for displaying User Profile header.
|
||||
*
|
||||
* @type action
|
||||
* @title um_profile_header
|
||||
* @description Profile header area
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_profile_header', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_profile_header', 'my_profile_header', 10, 1 );
|
||||
* function my_profile_header( $args ) {
|
||||
* Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt):
|
||||
* 9 - `um_profile_header()` displays User Profile header.
|
||||
*
|
||||
* @param {array} $args User Profile data.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_profile_header
|
||||
*
|
||||
* @example <caption>Display some content before or after User Profile header.</caption>
|
||||
* function my_um_profile_header( $args ) {
|
||||
* // your code here
|
||||
* echo $content;
|
||||
* }
|
||||
* ?>
|
||||
* add_action( 'um_profile_header', 'my_um_profile_header' );
|
||||
*/
|
||||
do_action( 'um_profile_header', $args );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
* Filters classes of the User Profile navigation bar.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_navbar_classes
|
||||
* @description Additional classes for profile navbar
|
||||
* @input_vars
|
||||
* [{"var":"$classes","type":"string","desc":"UM Posts Tab query"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_navbar_classes', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_navbar_classes', 'my_profile_navbar_classes', 10, 1 );
|
||||
* function my_profile_navbar_classes( $classes ) {
|
||||
* Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt):
|
||||
* 10 - `um_followers_profile_navbar_classes()` from Followers extension class.
|
||||
* 10 - `profile_navbar_classes()` from Messaging extension class.
|
||||
*
|
||||
* @param {string} $classes User Profile navigation bar classes.
|
||||
*
|
||||
* @since 2.0
|
||||
* @hook um_profile_navbar_classes
|
||||
*
|
||||
* @return {string} User Profile navigation bar classes.
|
||||
*
|
||||
* @example <caption>Adds `my_custom_class` class to the navigation bar on the User Profile page.</caption>
|
||||
* function my_um_profile_navbar_classes( $classes ) {
|
||||
* // your code here
|
||||
* return $classes;
|
||||
* $classes .= ' my_custom_class';
|
||||
* echo $classes;
|
||||
* }
|
||||
* ?>
|
||||
* add_filter( 'um_profile_navbar_classes', 'my_um_profile_navbar_classes' );
|
||||
*/
|
||||
$classes = apply_filters( 'um_profile_navbar_classes', '' ); ?>
|
||||
$classes = apply_filters( 'um_profile_navbar_classes', '' );
|
||||
?>
|
||||
|
||||
<div class="um-profile-navbar <?php echo esc_attr( $classes ); ?>">
|
||||
<?php
|
||||
/**
|
||||
* UM hook
|
||||
* Fires for displaying User Profile navigation bar.
|
||||
*
|
||||
* @type action
|
||||
* @title um_profile_navbar
|
||||
* @description Profile navigation bar
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_profile_navbar', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_profile_navbar', 'my_profile_navbar', 10, 1 );
|
||||
* function my_profile_navbar( $args ) {
|
||||
* Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt):
|
||||
* 4 - `um_followers_add_profile_bar()` displays Followers button.
|
||||
* 5 - `add_profile_bar()` displays Messaging button.
|
||||
*
|
||||
* @param {array} $args User Profile data.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_profile_navbar
|
||||
*
|
||||
* @example <caption>Display some content before or after User Profile navigation bar.</caption>
|
||||
* function my_um_profile_navbar( $args ) {
|
||||
* // your code here
|
||||
* echo $content;
|
||||
* }
|
||||
* ?>
|
||||
* add_action( 'um_profile_navbar', 'my_um_profile_navbar' );
|
||||
*/
|
||||
do_action( 'um_profile_navbar', $args ); ?>
|
||||
do_action( 'um_profile_navbar', $args );
|
||||
?>
|
||||
<div class="um-clear"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* UM hook
|
||||
* Fires for displaying User Profile menu.
|
||||
*
|
||||
* @type action
|
||||
* @title um_profile_menu
|
||||
* @description Profile menu
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_profile_menu', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_profile_menu', 'my_profile_navbar', 10, 1 );
|
||||
* function my_profile_navbar( $args ) {
|
||||
* Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt):
|
||||
* 9 - `um_profile_menu()` displays User Profile menu.
|
||||
*
|
||||
* @param {array} $args User Profile data.
|
||||
*
|
||||
* @since 2.0
|
||||
* @hook um_profile_menu
|
||||
*
|
||||
* @example <caption>Display some content before or after User Profile menu.</caption>
|
||||
* function my_um_profile_menu( $args ) {
|
||||
* // your code here
|
||||
* echo $content;
|
||||
* }
|
||||
* ?>
|
||||
* add_action( 'um_profile_menu', 'my_um_profile_menu' );
|
||||
*/
|
||||
do_action( 'um_profile_menu', $args );
|
||||
|
||||
if ( um_is_on_edit_profile() || UM()->user()->preview ) {
|
||||
|
||||
$nav = 'main';
|
||||
$nav = 'main';
|
||||
$subnav = UM()->profile()->active_subnav();
|
||||
$subnav = ! empty( $subnav ) ? $subnav : 'default'; ?>
|
||||
|
||||
$subnav = ! empty( $subnav ) ? $subnav : 'default';
|
||||
?>
|
||||
<div class="um-profile-body <?php echo esc_attr( $nav . ' ' . $nav . '-' . $subnav ); ?>">
|
||||
|
||||
<?php
|
||||
/**
|
||||
* UM hook
|
||||
* Fires for adding content in User Profile nav menu content tab.
|
||||
* $nav profile menu tab key.
|
||||
*
|
||||
* @type action
|
||||
* @title um_profile_content_{$nav}
|
||||
* @description Custom hook to display tabbed content
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_profile_content_{$nav}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_profile_content_{$nav}', 'my_profile_content', 10, 1 );
|
||||
* function my_profile_content( $args ) {
|
||||
* Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt):
|
||||
* 10 - `um_profile_content_main()` displays `About` menu tab's content (v2).
|
||||
* 10 - `UM()->frontend()->profile()->about()` displays `About` menu tab's content (v3).
|
||||
* 10 - `um_profile_content_followers()` displays `Followers` menu tab's content.
|
||||
* 10 - `um_profile_content_following()` displays `Following` menu tab's content.
|
||||
* 10 - `um_profile_content_groups_list()` displays `User Groups List` menu tab's content.
|
||||
* 10 - `profile_tab_content()` displays `My Jobs` menu tab's content.
|
||||
* 10 - `profile_tab_dashboard_content()` displays `My Jobs Dashboard` menu tab's content.
|
||||
* 10 - `content_messages()` displays `Messages` menu tab's content.
|
||||
* 10 - `um_profile_content_private_content()` displays `Private Content` menu tab's content.
|
||||
* 10 - `um_profile_content_{$tab['tabid']}` displays custom Profile Tabs content.
|
||||
* 10 - `um_profile_content_reviews()` displays `Reviews` menu tab's content.
|
||||
* 10 - `show_wall()` displays `Activity` menu tab's content.
|
||||
*
|
||||
* @param {array} $args User Profile data.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_profile_content_{$nav}
|
||||
*
|
||||
* @example <caption>Display some content in User Profile `main` nav content tab.</caption>
|
||||
* function my_profile_content_main( $args ) {
|
||||
* // your code here
|
||||
* echo $content;
|
||||
* }
|
||||
* ?>
|
||||
* add_action( 'um_profile_content_main', 'my_profile_content_main' );
|
||||
*/
|
||||
do_action("um_profile_content_{$nav}", $args);
|
||||
|
||||
do_action( "um_profile_content_$nav", $args );
|
||||
/**
|
||||
* UM hook
|
||||
* Fires for adding content in User Profile nav > subnav menu content tab.
|
||||
* $nav profile menu tab key.
|
||||
* $subnav profile sub-menu tab key.
|
||||
*
|
||||
* @type action
|
||||
* @title um_profile_content_{$nav}_{$subnav}
|
||||
* @description Custom hook to display tabbed content
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_profile_content_{$nav}_{$subnav}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_profile_content_{$nav}_{$subnav}', 'my_profile_content', 10, 1 );
|
||||
* function my_profile_content( $args ) {
|
||||
* Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt):
|
||||
* 10 - `um_bbpress_user_topics()` displays `Topics` submenu of bbPress tab's content.
|
||||
* 10 - `um_bbpress_user_replies()` displays `Replies` submenu of bbPress tab's content.
|
||||
* 10 - `um_bbpress_user_favorites()` displays `Favorites` submenu of bbPress tab's content.
|
||||
* 10 - `um_bbpress_user_subscriptions()` displays `Subscriptions` submenu of bbPress tab's content.
|
||||
* 10 - `profile_content_forums_topics()` displays `Topics` submenu of ForumWP tab's content.
|
||||
* 10 - `profile_content_forums_replies()` displays `Replies` submenu of ForumWP tab's content.
|
||||
* 10 - `profile_content_subscriptions()` displays `Subscriptions` submenu of ForumWP tab's content.
|
||||
* 10 - `profile_content_bookmarks()` displays `Bookmarks` submenu of ForumWP tab's content.
|
||||
* 10 - `profile_content_likes()` displays `Likes` submenu of ForumWP tab's content.
|
||||
* 10 - `um_profile_content_friends_myfriends()` displays `My Friends` submenu of Friends tab's content.
|
||||
* 10 - `um_profile_content_friends_friendreqs()` displays `Friends Requests` submenu of Friends tab's content.
|
||||
* 10 - `um_profile_content_friends_sentreqs()` displays `Send Friends Requests` submenu of Friends tab's content.
|
||||
* 10 - `um_profile_content_badges_my_badges()` displays `My badges` submenu of myCRED tab's content.
|
||||
* 10 - `um_profile_content_badges_all_badges()` displays `All badges` submenu of myCRED tab's content.
|
||||
* 10 - `get_bookmarks_content()` displays `All bookmarks with folders` submenu of User Bookmarks tab's content.
|
||||
* 10 - `get_bookmarks_content_all()` displays `All bookmarks` submenu of User Bookmarks tab's content.
|
||||
* 10 - `get_bookmarks_content_users()` displays `All bookmarked users` submenu of User Bookmarks tab's content.
|
||||
* 10 - `user_notes_profile_tab()` displays `View Notes` submenu of User Notes tab's content.
|
||||
* 10 - `get_add_note_form()` displays `Add Note` submenu of User Notes tab's content.
|
||||
* 10 - `get_gallery_content()` displays `Albums` submenu of User Photos tab's content.
|
||||
* 10 - `get_gallery_photos_content()` displays `Photos` submenu of User Photos tab's content.
|
||||
* 10 - `um_profile_content_purchases()` displays `Purchases` submenu of Woocommerce tab's content.
|
||||
* 10 - `um_profile_content_product_reviews()` displays `Product Reviews` submenu of Woocommerce tab's content.
|
||||
*
|
||||
* @param {array} $args User Profile data.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_profile_content_{$nav}_{$subnav}
|
||||
*
|
||||
* @example <caption>Display some content in User Profile `main` nav and `step2` subnav content tab.</caption>
|
||||
* function my_profile_content_main_step2( $args ) {
|
||||
* // your code here
|
||||
* echo $content;
|
||||
* }
|
||||
* ?>
|
||||
* add_action( 'um_profile_content_main_step2', 'my_profile_content_main_step2' );
|
||||
*/
|
||||
do_action( "um_profile_content_{$nav}_{$subnav}", $args ); ?>
|
||||
|
||||
do_action( "um_profile_content_{$nav}_$subnav", $args );
|
||||
?>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
@@ -218,69 +245,51 @@ $description_key = UM()->profile()->get_show_bio_key( $args );
|
||||
|
||||
</form>
|
||||
|
||||
<?php }
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
$menu_enabled = UM()->options()->get( 'profile_menu' );
|
||||
$tabs = UM()->profile()->tabs_active();
|
||||
$profile_tabs = UM()->profile()->tabs_active();
|
||||
|
||||
$nav = UM()->profile()->active_tab();
|
||||
$nav = UM()->profile()->active_tab();
|
||||
$subnav = UM()->profile()->active_subnav();
|
||||
$subnav = ! empty( $subnav ) ? $subnav : 'default';
|
||||
|
||||
if ( $menu_enabled || ! empty( $tabs[ $nav ]['hidden'] ) ) { ?>
|
||||
|
||||
if ( $menu_enabled || ! empty( $profile_tabs[ $nav ]['hidden'] ) ) {
|
||||
?>
|
||||
<div class="um-profile-body <?php echo esc_attr( $nav . ' ' . $nav . '-' . $subnav ); ?>">
|
||||
|
||||
<?php
|
||||
// Custom hook to display tabbed content
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_profile_content_{$nav}
|
||||
* @description Custom hook to display tabbed content
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_profile_content_{$nav}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_profile_content_{$nav}', 'my_profile_content', 10, 1 );
|
||||
* function my_profile_content( $args ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action("um_profile_content_{$nav}", $args);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_profile_content_{$nav}_{$subnav}
|
||||
* @description Custom hook to display tabbed content
|
||||
* @input_vars
|
||||
* [{"var":"$args","type":"array","desc":"Profile form shortcode arguments"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_profile_content_{$nav}_{$subnav}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_profile_content_{$nav}_{$subnav}', 'my_profile_content', 10, 1 );
|
||||
* function my_profile_content( $args ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( "um_profile_content_{$nav}_{$subnav}", $args ); ?>
|
||||
|
||||
/** This action is documented in ultimate-member/templates/profile.php */
|
||||
do_action( "um_profile_content_$nav", $args );
|
||||
/** This action is documented in ultimate-member/templates/profile.php */
|
||||
do_action( "um_profile_content_{$nav}_$subnav", $args );
|
||||
?>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'um_profile_footer', $args ); ?>
|
||||
/**
|
||||
* Fires for adding content below User Profile menu.
|
||||
*
|
||||
* Internal Ultimate Member callbacks (Priority -> Callback name -> Excerpt):
|
||||
* 99 - `profile_footer_login_form()` displays User Login form related to messaging extension.
|
||||
*
|
||||
* @param {array} $args User Profile data.
|
||||
*
|
||||
* @since 2.0
|
||||
* @hook um_profile_footer
|
||||
*
|
||||
* @example <caption>Display some content in User Profile footer.</caption>
|
||||
* function my_um_profile_footer( $args ) {
|
||||
* // your code here
|
||||
* echo $content;
|
||||
* }
|
||||
* add_action( 'um_profile_footer', 'my_um_profile_footer' );
|
||||
*/
|
||||
do_action( 'um_profile_footer', $args );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+3
-3
@@ -3,13 +3,13 @@
|
||||
* Plugin Name: Ultimate Member
|
||||
* Plugin URI: http://ultimatemember.com/
|
||||
* Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
||||
* Version: 2.9.2
|
||||
* Version: 2.10.0
|
||||
* Author: Ultimate Member
|
||||
* Author URI: http://ultimatemember.com/
|
||||
* Text Domain: ultimate-member
|
||||
* Domain Path: /languages
|
||||
* Requires at least: 5.5
|
||||
* Requires PHP: 5.6
|
||||
* Requires at least: 6.2
|
||||
* Requires PHP: 7.0
|
||||
*
|
||||
* @package UM
|
||||
*/
|
||||
|
||||
+52
-58
@@ -70,12 +70,13 @@ if ( ! empty( $delete_options ) ) {
|
||||
|
||||
global $wp_roles;
|
||||
|
||||
$role_keys = get_option( 'um_roles', array() );
|
||||
|
||||
if ( class_exists( '\WP_Roles' ) ) {
|
||||
if ( ! isset( $wp_roles ) ) {
|
||||
$wp_roles = new \WP_Roles();
|
||||
}
|
||||
|
||||
$role_keys = get_option( 'um_roles', array() );
|
||||
if ( $role_keys ) {
|
||||
foreach ( $role_keys as $roleID ) {
|
||||
$role_meta = get_option( "um_role_{$roleID}_meta" );
|
||||
@@ -89,7 +90,6 @@ if ( ! empty( $delete_options ) ) {
|
||||
}
|
||||
|
||||
//remove user role meta
|
||||
$role_keys = get_option( 'um_roles', array() );
|
||||
if ( $role_keys ) {
|
||||
foreach ( $role_keys as $role_key ) {
|
||||
delete_option( 'um_role_' . $role_key . '_meta' );
|
||||
@@ -136,65 +136,59 @@ if ( ! empty( $delete_options ) ) {
|
||||
|
||||
$wpdb->query(
|
||||
"DELETE
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key LIKE '_um%' OR
|
||||
meta_key LIKE 'um%' OR
|
||||
meta_key LIKE 'reviews%' OR
|
||||
meta_key = 'submitted' OR
|
||||
meta_key = 'account_status' OR
|
||||
meta_key = 'password_rst_attempts' OR
|
||||
meta_key = 'profile_photo' OR
|
||||
meta_key = '_enable_new_follow' OR
|
||||
meta_key = '_enable_new_friend' OR
|
||||
meta_key = '_mylists' OR
|
||||
meta_key = '_enable_new_pm' OR
|
||||
meta_key = '_hidden_conversations' OR
|
||||
meta_key = '_pm_blocked' OR
|
||||
meta_key = '_notifications_prefs' OR
|
||||
meta_key = '_profile_progress' OR
|
||||
meta_key = '_completed' OR
|
||||
meta_key = '_cannot_add_review' OR
|
||||
meta_key = 'synced_profile_photo' OR
|
||||
meta_key = 'full_name' OR
|
||||
meta_key = '_reviews' OR
|
||||
meta_key = '_reviews_compound' OR
|
||||
meta_key = '_reviews_total' OR
|
||||
meta_key = '_reviews_avg'"
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key LIKE '_um%' OR
|
||||
meta_key LIKE 'um%' OR
|
||||
meta_key LIKE 'reviews%' OR
|
||||
meta_key = 'submitted' OR
|
||||
meta_key = 'account_status' OR
|
||||
meta_key = 'password_rst_attempts' OR
|
||||
meta_key = 'profile_photo' OR
|
||||
meta_key = '_enable_new_follow' OR
|
||||
meta_key = '_enable_new_friend' OR
|
||||
meta_key = '_mylists' OR
|
||||
meta_key = '_enable_new_pm' OR
|
||||
meta_key = '_hidden_conversations' OR
|
||||
meta_key = '_pm_blocked' OR
|
||||
meta_key = '_notifications_prefs' OR
|
||||
meta_key = '_profile_progress' OR
|
||||
meta_key = '_completed' OR
|
||||
meta_key = '_cannot_add_review' OR
|
||||
meta_key = 'synced_profile_photo' OR
|
||||
meta_key = 'full_name' OR
|
||||
meta_key = '_reviews' OR
|
||||
meta_key = '_reviews_compound' OR
|
||||
meta_key = '_reviews_total' OR
|
||||
meta_key = '_reviews_avg'"
|
||||
);
|
||||
|
||||
$wpdb->query(
|
||||
"DELETE
|
||||
FROM {$wpdb->postmeta}
|
||||
WHERE meta_key LIKE '_um%' OR
|
||||
meta_key LIKE 'um%'"
|
||||
FROM {$wpdb->postmeta}
|
||||
WHERE meta_key LIKE '_um%' OR
|
||||
meta_key LIKE 'um%'"
|
||||
);
|
||||
|
||||
//remove all tables from extensions
|
||||
$all_tables = "SHOW TABLES LIKE '{$wpdb->prefix}um\_%'";
|
||||
$results = $wpdb->get_results( $all_tables );
|
||||
// Remove all tables from extensions
|
||||
$results = $wpdb->get_results( "SHOW TABLES LIKE '{$wpdb->prefix}um\_%'" );
|
||||
if ( $results ) {
|
||||
foreach ( $results as $index => $value ) {
|
||||
foreach ( $value as $table_name ) {
|
||||
$um_groups_members = $wpdb->prefix . 'um_groups_members';
|
||||
if ( $table_name === $um_groups_members ) {
|
||||
$wpdb->query( "
|
||||
DELETE posts, term_rel, pmeta, terms, tax, commetns
|
||||
FROM {$wpdb->posts} posts
|
||||
LEFT JOIN {$wpdb->term_relationships} term_rel
|
||||
ON (posts.ID = term_rel.object_id)
|
||||
LEFT JOIN {$wpdb->postmeta} pmeta
|
||||
ON (posts.ID = pmeta.post_id)
|
||||
LEFT JOIN {$wpdb->terms} terms
|
||||
ON (term_rel.term_taxonomy_id = terms.term_id)
|
||||
LEFT JOIN {$wpdb->term_taxonomy} tax
|
||||
ON (term_rel.term_taxonomy_id = tax.term_taxonomy_id)
|
||||
LEFT JOIN {$wpdb->comments} commetns
|
||||
ON (commetns.comment_post_ID = posts.ID)
|
||||
WHERE posts.post_type = 'um_groups' OR posts.post_type = 'um_groups_discussion'"
|
||||
$wpdb->query(
|
||||
"DELETE posts, term_rel, pmeta, terms, tax, commetns
|
||||
FROM {$wpdb->posts} posts
|
||||
LEFT JOIN {$wpdb->term_relationships} term_rel ON (posts.ID = term_rel.object_id)
|
||||
LEFT JOIN {$wpdb->postmeta} pmeta ON (posts.ID = pmeta.post_id)
|
||||
LEFT JOIN {$wpdb->terms} terms ON (term_rel.term_taxonomy_id = terms.term_id)
|
||||
LEFT JOIN {$wpdb->term_taxonomy} tax ON (term_rel.term_taxonomy_id = tax.term_taxonomy_id)
|
||||
LEFT JOIN {$wpdb->comments} commetns ON (commetns.comment_post_ID = posts.ID)
|
||||
WHERE posts.post_type = 'um_groups' OR
|
||||
posts.post_type = 'um_groups_discussion'"
|
||||
);
|
||||
}
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $table_name is static variable
|
||||
$wpdb->query( "DROP TABLE IF EXISTS $table_name" );
|
||||
$wpdb->query( $wpdb->prepare( "DROP TABLE IF EXISTS %i", $table_name ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,13 +234,12 @@ if ( ! empty( $delete_options ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
//user tags
|
||||
$wpdb->query( "
|
||||
DELETE tax, terms
|
||||
FROM {$wpdb->term_taxonomy} tax
|
||||
LEFT JOIN {$wpdb->terms} terms
|
||||
ON (tax.term_taxonomy_id = terms.term_id)
|
||||
WHERE tax.taxonomy = 'um_user_tag'"
|
||||
// User tags
|
||||
$wpdb->query(
|
||||
"DELETE tax, terms
|
||||
FROM {$wpdb->term_taxonomy} tax
|
||||
LEFT JOIN {$wpdb->terms} terms ON (tax.term_taxonomy_id = terms.term_id)
|
||||
WHERE tax.taxonomy = 'um_user_tag'"
|
||||
);
|
||||
|
||||
//mailchimp
|
||||
@@ -259,9 +252,10 @@ if ( ! empty( $delete_options ) ) {
|
||||
"SELECT option_name
|
||||
FROM {$wpdb->options}
|
||||
WHERE option_name LIKE '_um%' OR
|
||||
option_name LIKE 'um_%' OR
|
||||
option_name LIKE 'widget_um%' OR
|
||||
option_name LIKE 'ultimatemember_%'" );
|
||||
option_name LIKE 'um_%' OR
|
||||
option_name LIKE 'widget_um%' OR
|
||||
option_name LIKE 'ultimatemember_%'"
|
||||
);
|
||||
|
||||
foreach ( $um_options as $um_option ) {
|
||||
delete_option( $um_option->option_name );
|
||||
|
||||
Reference in New Issue
Block a user