mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-17 21:53:43 +09:00
Merge branch 'release/2.0.22'
This commit is contained in:
@@ -7,7 +7,7 @@ Ultimate Member is the #1 user profile & membership plugin for WordPress. The pl
|
||||
|
||||
| Latest Version |Requires at least|Stable Tag|
|
||||
| :------------: |:------------:|:------------:|
|
||||
| 2.0.21 | WordPress 4.9 or higher| 2.0.21 |
|
||||
| 2.0.22 | WordPress 4.9 or higher| 2.0.22 |
|
||||
|
||||
|
||||
Features of the plugin include:
|
||||
@@ -48,7 +48,7 @@ GNU Version 2 or Any Later Version
|
||||
|
||||
Releases
|
||||
====================
|
||||
[Official Release Version: 2.0.21](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.21).
|
||||
[Official Release Version: 2.0.22](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.22).
|
||||
|
||||
[Official Release Version: 1.3.88](https://github.com/ultimatemember/ultimatemember/releases).
|
||||
|
||||
|
||||
@@ -295,9 +295,9 @@ p.um-notice.warning {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
|
||||
.um-field.um-is-conditional {
|
||||
/*.um-field.um-is-conditional {
|
||||
display: none;
|
||||
}
|
||||
}*/
|
||||
|
||||
.um-field-label {
|
||||
display: block;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+58
-28
@@ -234,16 +234,24 @@ function initImageUpload_UM( trigger ) {
|
||||
upload_text = '';
|
||||
}
|
||||
|
||||
var user_id = 0;
|
||||
|
||||
if( jQuery('#um_upload_single:visible').data('user_id') ){
|
||||
user_id = jQuery('#um_upload_single:visible').data('user_id');
|
||||
}
|
||||
|
||||
trigger.uploadFile({
|
||||
url: um_scripts.imageupload,
|
||||
url: wp.ajax.settings.url,
|
||||
method: "POST",
|
||||
multiple: false,
|
||||
formData: {
|
||||
key: trigger.data('key'),
|
||||
set_id: trigger.data('set_id'),
|
||||
action: 'um_imageupload',
|
||||
key: trigger.data('key'),
|
||||
set_id: trigger.data('set_id'),
|
||||
set_mode: trigger.data('set_mode'),
|
||||
_wpnonce: trigger.data('nonce'),
|
||||
timestamp: trigger.data('timestamp')
|
||||
timestamp: trigger.data('timestamp'),
|
||||
user_id: user_id
|
||||
},
|
||||
fileName: trigger.data('key'),
|
||||
allowedTypes: trigger.data('allowed_types'),
|
||||
@@ -258,36 +266,34 @@ function initImageUpload_UM( trigger ) {
|
||||
showDone: false,
|
||||
showFileCounter: false,
|
||||
showStatusAfterSuccess: true,
|
||||
returnType: 'json',
|
||||
onSubmit:function(files){
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-error-block').remove();
|
||||
|
||||
},
|
||||
onSuccess:function(files,data,xhr){
|
||||
onSuccess:function( files, response, xhr ){
|
||||
|
||||
trigger.selectedFiles = 0;
|
||||
|
||||
try{
|
||||
data = jQuery.parseJSON(data);
|
||||
} catch (e) {
|
||||
console.log( e, data );
|
||||
return;
|
||||
}
|
||||
if ( response.success && response.success == false || typeof response.data.error !== 'undefined' ) {
|
||||
|
||||
if (data.error && data.error != '') {
|
||||
|
||||
trigger.parents('.um-modal-body').append('<div class="um-error-block">'+data.error+'</div>');
|
||||
trigger.parents('.um-modal-body').append('<div class="um-error-block">'+response.data.error+'</div>');
|
||||
trigger.parents('.um-modal-body').find('.upload-statusbar').hide(0);
|
||||
um_modal_responsive();
|
||||
|
||||
} else {
|
||||
|
||||
jQuery.each( data, function(key, value) {
|
||||
|
||||
|
||||
jQuery.each( response.data, function( i, d ) {
|
||||
|
||||
var img_id = trigger.parents('.um-modal-body').find('.um-single-image-preview img');
|
||||
var img_id_h = trigger.parents('.um-modal-body').find('.um-single-image-preview');
|
||||
|
||||
img_id.attr("src", value);
|
||||
var cache_ts = new Date();
|
||||
|
||||
img_id.attr("src", d.url + "?"+cache_ts.getTime() );
|
||||
img_id.data("file", d.file );
|
||||
|
||||
img_id.load(function(){
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-modal-btn.um-finish-upload.disabled').removeClass('disabled');
|
||||
@@ -301,6 +307,9 @@ function initImageUpload_UM( trigger ) {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
onError: function ( e ){
|
||||
console.log( e );
|
||||
}
|
||||
});
|
||||
|
||||
@@ -326,13 +335,19 @@ function initFileUpload_UM( trigger ) {
|
||||
upload_text = '';
|
||||
}
|
||||
|
||||
if( jQuery('#um_upload_single:visible').data('user_id') ){
|
||||
user_id = jQuery('#um_upload_single:visible').data('user_id');
|
||||
}
|
||||
|
||||
trigger.uploadFile({
|
||||
url: um_scripts.fileupload,
|
||||
url: wp.ajax.settings.url,
|
||||
method: "POST",
|
||||
multiple: false,
|
||||
formData: {
|
||||
action: 'um_fileupload',
|
||||
key: trigger.data('key'),
|
||||
set_id: trigger.data('set_id'),
|
||||
user_id: trigger.data('user_id'),
|
||||
set_mode: trigger.data('set_mode'),
|
||||
_wpnonce: trigger.data('nonce'),
|
||||
timestamp: trigger.data('timestamp')
|
||||
@@ -355,14 +370,13 @@ function initFileUpload_UM( trigger ) {
|
||||
trigger.parents('.um-modal-body').find('.um-error-block').remove();
|
||||
|
||||
},
|
||||
onSuccess:function(files,data,xhr){
|
||||
onSuccess:function( files, response ,xhr ){
|
||||
|
||||
trigger.selectedFiles = 0;
|
||||
|
||||
data = jQuery.parseJSON(data);
|
||||
if (data.error && data.error != '') {
|
||||
if ( response.success && response.success == false || typeof response.data.error !== 'undefined' ) {
|
||||
|
||||
trigger.parents('.um-modal-body').append('<div class="um-error-block">'+data.error+'</div>');
|
||||
trigger.parents('.um-modal-body').append('<div class="um-error-block">'+ response.data.error+'</div>');
|
||||
trigger.parents('.um-modal-body').find('.upload-statusbar').hide(0);
|
||||
|
||||
setTimeout(function(){
|
||||
@@ -371,20 +385,33 @@ function initFileUpload_UM( trigger ) {
|
||||
|
||||
} else {
|
||||
|
||||
jQuery.each( data, function(key, value) {
|
||||
jQuery.each( response.data , function(key, value) {
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-modal-btn.um-finish-upload.disabled').removeClass('disabled');
|
||||
trigger.parents('.um-modal-body').find('.ajax-upload-dragdrop,.upload-statusbar').hide(0);
|
||||
trigger.parents('.um-modal-body').find('.um-single-file-preview').show(0);
|
||||
|
||||
if (key == 'icon') {
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo i').removeClass().addClass(value);
|
||||
if ( key == 'icon' ) {
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo i').removeClass().addClass( value );
|
||||
|
||||
} else if ( key == 'icon_bg' ) {
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo span.icon').css({'background-color' : value } );
|
||||
|
||||
} else if ( key == 'filename' ) {
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo span.filename').html(value);
|
||||
} else {
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo a').attr('data-file', value );
|
||||
|
||||
}else if( key == 'original_name' ){
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo a').attr('data-orignal-name', value );
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo span.filename').html( value );
|
||||
|
||||
} else if ( key == 'url' ) {
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo a').attr('href', value);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -395,6 +422,9 @@ function initFileUpload_UM( trigger ) {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
onError: function ( e ){
|
||||
console.log( e );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(t){"use strict";t(document).on("click","a.um-toggle-gdpr",function(){var e=jQuery(this);t(".um-gdpr-content").toggle("fast",function(){t(".um-gdpr-content").is(":visible")&&e.text(e.data("toggle-hide")),t(".um-gdpr-content").is(":hidden")&&e.text(e.data("toggle-show"))})})}(jQuery);
|
||||
!function(e){"use strict";e(document).on("click","a.um-toggle-gdpr",function(){var t=jQuery(this);e(".um-gdpr-content").toggle("fast",function(){e(".um-gdpr-content").is(":visible")&&t.text(t.data("toggle-hide")),e(".um-gdpr-content").is(":hidden")&&t.text(t.data("toggle-show"))})})}(jQuery);
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -16,7 +16,7 @@ jQuery(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-member-more a', function(e){
|
||||
jQuery(document.body).on('click', '.um-member-more a', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var block = jQuery(this).parents('.um-member');
|
||||
@@ -30,7 +30,7 @@ jQuery(document).ready(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-member-less a', function(e){
|
||||
jQuery(document.body).on('click', '.um-member-less a', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var block = jQuery(this).parents('.um-member');
|
||||
@@ -44,7 +44,7 @@ jQuery(document).ready(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-do-search', function(e){
|
||||
jQuery(document.body).on('click', '.um-do-search', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
jQuery(this).parents('form').find('input').filter(function(e){
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-directory .um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document).on("click",".um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),m=jQuery(this).parents(".um-members");return r.find(".um-member-more").hide(),r.find(".um-member-meta").slideDown(function(){UM_Member_Grid(m)}),r.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(m)},100),!1}),jQuery(document).on("click",".um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),m=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(m)}),!1}),jQuery(document).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").find("input").filter(function(e){if(0===this.value.length)return!0}).prop("disabled",!0),jQuery(this).parents("form").find("select").filter(function(e){if(0===this.value.length)return!0}).prop("disabled",!0),jQuery(this).parents("form").submit(),!1})});
|
||||
jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-directory .um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document.body).on("click",".um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),m=jQuery(this).parents(".um-members");return r.find(".um-member-more").hide(),r.find(".um-member-meta").slideDown(function(){UM_Member_Grid(m)}),r.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(m)},100),!1}),jQuery(document.body).on("click",".um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),m=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(m)}),!1}),jQuery(document.body).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").find("input").filter(function(e){if(0===this.value.length)return!0}).prop("disabled",!0),jQuery(this).parents("form").find("select").filter(function(e){if(0===this.value.length)return!0}).prop("disabled",!0),jQuery(this).parents("form").submit(),!1})});
|
||||
+46
-28
@@ -72,15 +72,19 @@ jQuery(document).ready(function() {
|
||||
jQuery(document).on('click', '.um-finish-upload.file:not(.disabled)', function(){
|
||||
|
||||
var key = jQuery(this).attr('data-key');
|
||||
|
||||
var preview = jQuery(this).parents('.um-modal-body').find('.um-single-file-preview').html();
|
||||
|
||||
um_remove_modal();
|
||||
|
||||
jQuery('.um-single-file-preview[data-key='+key+']').fadeIn().html( preview );
|
||||
|
||||
var file = jQuery('.um-field[data-key='+key+']').find('.um-single-fileinfo a').data('file');
|
||||
|
||||
jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( jQuery(this).attr('data-change') );
|
||||
|
||||
jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('input[type=hidden]').val( jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('.um-single-fileinfo a').attr('href') );
|
||||
jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('input[type="hidden"]').val( file );
|
||||
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-finish-upload.image:not(.disabled)', function(){
|
||||
@@ -90,13 +94,12 @@ jQuery(document).ready(function() {
|
||||
var img_c = jQuery(this).parents('.um-modal-body').find('.um-single-image-preview');
|
||||
var src = img_c.find('img').attr('src');
|
||||
var coord = img_c.attr('data-coord');
|
||||
|
||||
if ( jQuery(this).parents('#um_upload_single').attr('data-user_id') ) {
|
||||
var user_id = jQuery(this).parents('#um_upload_single').attr('data-user_id');
|
||||
} else {
|
||||
var user_id = 0;
|
||||
var file = img_c.find('img').data('file');
|
||||
var user_id = 0;
|
||||
if ( jQuery(this).parents('#um_upload_single').data('user_id') ) {
|
||||
user_id = jQuery(this).parents('#um_upload_single').data('user_id');
|
||||
}
|
||||
|
||||
|
||||
if ( coord ) {
|
||||
|
||||
jQuery(this).html( jQuery(this).attr('data-processing') ).addClass('disabled');
|
||||
@@ -104,32 +107,39 @@ jQuery(document).ready(function() {
|
||||
jQuery.ajax({
|
||||
url: um_scripts.resize_image,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
src : src,
|
||||
coord : coord,
|
||||
user_id : user_id,
|
||||
key: key
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
d = new Date();
|
||||
|
||||
if ( key == 'profile_photo') {
|
||||
jQuery('.um-profile-photo-img img').attr('src', data + "?"+d.getTime());
|
||||
}
|
||||
|
||||
if ( key == 'cover_photo') {
|
||||
jQuery('.um-cover-e').empty().html('<img src="' + data + "?"+d.getTime() + '" alt="" />');
|
||||
if ( jQuery('.um').hasClass('um-editing') ) {
|
||||
jQuery('.um-cover-overlay').show();
|
||||
success: function( response ){
|
||||
|
||||
if( response.success == true ){
|
||||
|
||||
d = new Date();
|
||||
|
||||
if ( key == 'profile_photo') {
|
||||
jQuery('.um-profile-photo-img img').attr('src', response.data.image.source_url + "?"+d.getTime());
|
||||
}
|
||||
|
||||
if ( key == 'cover_photo') {
|
||||
jQuery('.um-cover-e').empty().html('<img src="' + response.data.image.source_url + "?"+d.getTime() + '" alt="" />');
|
||||
if ( jQuery('.um').hasClass('um-editing') ) {
|
||||
jQuery('.um-cover-overlay').show();
|
||||
}
|
||||
}
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', response.data.image.source_url + "?"+d.getTime());
|
||||
|
||||
um_remove_modal();
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( elem.attr('data-change') );
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('input[type="hidden"]').val( response.data.image.filename );
|
||||
|
||||
}
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', data + "?"+d.getTime());
|
||||
um_remove_modal();
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( elem.attr('data-change') );
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('input[type=hidden]').val( data );
|
||||
|
||||
}
|
||||
});
|
||||
@@ -137,11 +147,14 @@ jQuery(document).ready(function() {
|
||||
} else {
|
||||
|
||||
d = new Date();
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', src + "?"+d.getTime());
|
||||
|
||||
um_remove_modal();
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( elem.attr('data-change') );
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('input[type=hidden]').val( src );
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('input[type=hidden]').val( file );
|
||||
|
||||
|
||||
}
|
||||
@@ -151,10 +164,10 @@ jQuery(document).ready(function() {
|
||||
|
||||
var modal_id = jQuery(this).attr('data-modal');
|
||||
|
||||
var size = 'normal';
|
||||
|
||||
if ( jQuery(this).data('modal-size') ) {
|
||||
var size = jQuery(this).data('modal-size');
|
||||
} else {
|
||||
var size = 'normal';
|
||||
}
|
||||
|
||||
if ( jQuery(this).data('modal-copy') ) {
|
||||
@@ -172,6 +185,11 @@ jQuery(document).ready(function() {
|
||||
if ( jQuery(this).parents('.um-cover').attr('data-user_id') ) {
|
||||
jQuery('#' + modal_id).attr('data-user_id', jQuery(this).parents('.um-cover').attr('data-user_id') );
|
||||
}
|
||||
|
||||
if( jQuery("input[type=hidden][name='user_id']").length > 0 ){
|
||||
jQuery('#' + modal_id).attr('data-user_id', jQuery("input[type=hidden][name='user_id']").val() );
|
||||
}
|
||||
|
||||
um_new_modal( modal_id, size );
|
||||
|
||||
} else {
|
||||
|
||||
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 a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-modal .um-single-file-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),t=jQuery(this).parents(".um-modal-body").find(".um-single-fileinfo a").attr("href");return a.find(".um-single-file-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive(),jQuery.ajax({url:um_scripts.remove_file,type:"post",data:{src:t}}),!1}),jQuery(document).on("click",".um-modal .um-single-image-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),t=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview img").attr("src");return jQuery("img.cropper-hidden").cropper("destroy"),a.find(".um-single-image-preview img").attr("src",""),a.find(".um-single-image-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive(),jQuery.ajax({url:um_scripts.remove_file,type:"post",data:{src:t}}),!1}),jQuery(document).on("click",".um-finish-upload.file:not(.disabled)",function(){var e=jQuery(this).attr("data-key"),a=jQuery(this).parents(".um-modal-body").find(".um-single-file-preview").html();um_remove_modal(),jQuery(".um-single-file-preview[data-key="+e+"]").fadeIn().html(a),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(jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-single-fileinfo a").attr("href"))}),jQuery(document).on("click",".um-finish-upload.image:not(.disabled)",function(){var e=jQuery(this),a=jQuery(this).attr("data-key"),t=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),r=t.find("img").attr("src"),i=t.attr("data-coord");if(jQuery(this).parents("#um_upload_single").attr("data-user_id"))var u=jQuery(this).parents("#um_upload_single").attr("data-user_id");else var u=0;i?(jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:um_scripts.resize_image,type:"POST",data:{src:r,coord:i,user_id:u,key:a},success:function(t){d=new Date,"profile_photo"==a&&jQuery(".um-profile-photo-img img").attr("src",t+"?"+d.getTime()),"cover_photo"==a&&(jQuery(".um-cover-e").empty().html('<img src="'+t+"?"+d.getTime()+'" alt="" />'),jQuery(".um").hasClass("um-editing")&&jQuery(".um-cover-overlay").show()),jQuery(".um-single-image-preview[data-key="+a+"]").fadeIn().find("img").attr("src",t+"?"+d.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+a+"]").parents(".um-field").find(".um-btn-auto-width").html(e.attr("data-change")),jQuery(".um-single-image-preview[data-key="+a+"]").parents(".um-field").find("input[type=hidden]").val(t)}})):(d=new Date,jQuery(".um-single-image-preview[data-key="+a+"]").fadeIn().find("img").attr("src",r+"?"+d.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+a+"]").parents(".um-field").find(".um-btn-auto-width").html(e.attr("data-change")),jQuery(".um-single-image-preview[data-key="+a+"]").parents(".um-field").find("input[type=hidden]").val(r))}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal");if(jQuery(this).data("modal-size"))var t=jQuery(this).data("modal-size");else var t="normal";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")),um_new_modal(a,t)):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 a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-modal .um-single-file-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),t=jQuery(this).parents(".um-modal-body").find(".um-single-fileinfo a").attr("href");return a.find(".um-single-file-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive(),jQuery.ajax({url:um_scripts.remove_file,type:"post",data:{src:t}}),!1}),jQuery(document).on("click",".um-modal .um-single-image-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),t=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview img").attr("src");return jQuery("img.cropper-hidden").cropper("destroy"),a.find(".um-single-image-preview img").attr("src",""),a.find(".um-single-image-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive(),jQuery.ajax({url:um_scripts.remove_file,type:"post",data:{src:t}}),!1}),jQuery(document).on("click",".um-finish-upload.file:not(.disabled)",function(){var e=jQuery(this).attr("data-key"),a=jQuery(this).parents(".um-modal-body").find(".um-single-file-preview").html();um_remove_modal(),jQuery(".um-single-file-preview[data-key="+e+"]").fadeIn().html(a);var t=jQuery(".um-field[data-key="+e+"]").find(".um-single-fileinfo a").data("file");jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-btn-auto-width").html(jQuery(this).attr("data-change")),jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find('input[type="hidden"]').val(t)}),jQuery(document).on("click",".um-finish-upload.image:not(.disabled)",function(){var a=jQuery(this),t=jQuery(this).attr("data-key"),e=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),i=e.find("img").attr("src"),r=e.attr("data-coord"),u=e.find("img").data("file"),m=0;jQuery(this).parents("#um_upload_single").data("user_id")&&(m=jQuery(this).parents("#um_upload_single").data("user_id")),r?(jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:um_scripts.resize_image,type:"POST",dataType:"json",data:{src:i,coord:r,user_id:m,key:t},success:function(e){1==e.success&&(d=new Date,"profile_photo"==t&&jQuery(".um-profile-photo-img img").attr("src",e.data.image.source_url+"?"+d.getTime()),"cover_photo"==t&&(jQuery(".um-cover-e").empty().html('<img src="'+e.data.image.source_url+"?"+d.getTime()+'" alt="" />'),jQuery(".um").hasClass("um-editing")&&jQuery(".um-cover-overlay").show()),jQuery(".um-single-image-preview[data-key="+t+"]").fadeIn().find("img").attr("src",e.data.image.source_url+"?"+d.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find(".um-btn-auto-width").html(a.attr("data-change")),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find('input[type="hidden"]').val(e.data.image.filename))}})):(d=new Date,jQuery(".um-single-image-preview[data-key="+t+"]").fadeIn().find("img").attr("src",i+"?"+d.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find(".um-btn-auto-width").html(a.attr("data-change")),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find("input[type=hidden]").val(u))}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal"),t="normal";if(jQuery(this).data("modal-size"))t=jQuery(this).data("modal-size");jQuery(this).data("modal-copy")&&(jQuery("#"+a).html(jQuery(this).parents(".um-field").find(".um-modal-hidden-content").html()),jQuery(this).parents(".um-profile-photo").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-profile-photo").attr("data-user_id")),jQuery(this).parents(".um-cover").attr("data-ratio")&&jQuery("#"+a).attr("data-ratio",jQuery(this).parents(".um-cover").attr("data-ratio")),jQuery(this).parents(".um-cover").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-cover").attr("data-user_id")),0<jQuery("input[type=hidden][name='user_id']").length&&jQuery("#"+a).attr("data-user_id",jQuery("input[type=hidden][name='user_id']").val())),um_new_modal(a,t)})});
|
||||
@@ -54,13 +54,11 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-reset-cover-photo', function(e){
|
||||
|
||||
var obj = jQuery(this);
|
||||
jQuery('.um-cover-overlay').hide();
|
||||
|
||||
jQuery('.um-cover-e').html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>');
|
||||
|
||||
jQuery('.um-dropdown').hide();
|
||||
|
||||
|
||||
um_responsive();
|
||||
|
||||
user_id = jQuery(this).attr('data-user_id');
|
||||
@@ -72,6 +70,9 @@ jQuery(document).ready(function() {
|
||||
data: {
|
||||
metakey: metakey,
|
||||
user_id: user_id
|
||||
},
|
||||
success: function( response ) {
|
||||
obj.hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
jQuery(document).ready(function(){function e(){if("undefined"!=typeof jQuery("textarea[id=um-meta-bio]").val()){var e=jQuery("textarea[id=um-meta-bio]").attr("data-character-limit"),t=e-jQuery("textarea[id=um-meta-bio]").val().length;jQuery("span.um-meta-bio-character span.um-bio-limit").text(t),t<5?jQuery("span.um-meta-bio-character").css("color","red"):jQuery("span.um-meta-bio-character").css("color","")}}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-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document).on("click",".um-cover a.um-cover-add, .um-photo a",function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document).on("click",".um-reset-profile-photo",function(e){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",jQuery.ajax({url:um_scripts.delete_profile_photo,type:"post",data:{metakey:metakey,user_id:user_id}})}),jQuery(document).on("click",".um-reset-cover-photo",function(e){jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>'),jQuery(".um-dropdown").hide(),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:um_scripts.delete_cover_photo,type:"post",data:{metakey:metakey,user_id:user_id}})}),e(),jQuery("textarea[id=um-meta-bio]").change(e),jQuery("textarea[id=um-meta-bio]").keyup(e),jQuery(".um-profile-edit a.um_delete-item").click(function(e){e.preventDefault();var t=confirm("Are you sure that you want to delete this user?");if(!t)return!1})});
|
||||
jQuery(document).ready(function(){function e(){if(void 0!==jQuery("textarea[id=um-meta-bio]").val()){var e=jQuery("textarea[id=um-meta-bio]").attr("data-character-limit")-jQuery("textarea[id=um-meta-bio]").val().length;jQuery("span.um-meta-bio-character span.um-bio-limit").text(e),e<5?jQuery("span.um-meta-bio-character").css("color","red"):jQuery("span.um-meta-bio-character").css("color","")}}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-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document).on("click",".um-cover a.um-cover-add, .um-photo a",function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document).on("click",".um-reset-profile-photo",function(e){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",jQuery.ajax({url:um_scripts.delete_profile_photo,type:"post",data:{metakey:metakey,user_id:user_id}})}),jQuery(document).on("click",".um-reset-cover-photo",function(e){var t=jQuery(this);jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>'),jQuery(".um-dropdown").hide(),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:um_scripts.delete_cover_photo,type:"post",data:{metakey:metakey,user_id:user_id},success:function(e){t.hide()}})}),e(),jQuery("textarea[id=um-meta-bio]").change(e),jQuery("textarea[id=um-meta-bio]").keyup(e),jQuery(".um-profile-edit a.um_delete-item").click(function(e){if(e.preventDefault(),!confirm("Are you sure that you want to delete this user?"))return!1})});
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+417
-411
@@ -4,416 +4,422 @@
|
||||
});*/
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
jQuery(document).on('click', '.um-dropdown a', function(e){
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-dropdown a.real_url', function(e){
|
||||
|
||||
window.location = jQuery(this).attr('href');
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-trigger-menu-on-click', function(e){
|
||||
jQuery('.um-dropdown').hide();
|
||||
menu = jQuery(this).find('.um-dropdown');
|
||||
menu.show();
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-dropdown-hide', function(e){
|
||||
|
||||
UM_hide_menus();
|
||||
});
|
||||
|
||||
jQuery(document).on('click', 'a.um-manual-trigger', function(){
|
||||
var child = jQuery(this).attr('data-child');
|
||||
var parent = jQuery(this).attr('data-parent');
|
||||
jQuery(this).parents( parent ).find( child ).trigger('click');
|
||||
});
|
||||
|
||||
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: 'a.live', offset: 3 });
|
||||
|
||||
jQuery(document).on('change', '.um-field-area input[type=radio]', function(){
|
||||
var field = jQuery(this).parents('.um-field-area');
|
||||
var this_field = jQuery(this).parents('label');
|
||||
field.find('.um-field-radio').removeClass('active');
|
||||
field.find('.um-field-radio').find('i').removeClass().addClass('um-icon-android-radio-button-off');
|
||||
this_field.addClass('active');
|
||||
this_field.find('i').removeClass().addClass('um-icon-android-radio-button-on');
|
||||
});
|
||||
|
||||
jQuery(document).on('change', '.um-field-area input[type=checkbox]', function(){
|
||||
|
||||
var field = jQuery(this).parents('.um-field-area');
|
||||
var this_field = jQuery(this).parents('label');
|
||||
if ( this_field.hasClass('active') ) {
|
||||
this_field.removeClass('active');
|
||||
this_field.find('i').removeClass().addClass('um-icon-android-checkbox-outline-blank');
|
||||
} else {
|
||||
this_field.addClass('active');
|
||||
this_field.find('i').removeClass().addClass('um-icon-android-checkbox-outline');
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('.um-datepicker').each(function(){
|
||||
elem = jQuery(this);
|
||||
|
||||
if ( elem.attr('data-disabled_weekdays') != '' ) {
|
||||
var disable = JSON.parse( elem.attr('data-disabled_weekdays') );
|
||||
} else {
|
||||
var disable = false;
|
||||
}
|
||||
|
||||
var years_n = elem.attr('data-years');
|
||||
|
||||
var minRange = elem.attr('data-date_min');
|
||||
var maxRange = elem.attr('data-date_max');
|
||||
|
||||
var minSplit = minRange.split(",");
|
||||
var maxSplit = maxRange.split(",");
|
||||
|
||||
var min = minSplit.length ? new Date(minSplit) : null;
|
||||
var max = minSplit.length ? new Date(maxSplit) : null;
|
||||
|
||||
// fix min date for safari
|
||||
if(min && min.toString() == 'Invalid Date' && minSplit.length == 3) {
|
||||
var minDateString = minSplit[1] + '/' + minSplit[2] + '/' + minSplit[0];
|
||||
min = new Date(Date.parse(minDateString));
|
||||
}
|
||||
|
||||
// fix max date for safari
|
||||
if(max && max.toString() == 'Invalid Date' && maxSplit.length == 3) {
|
||||
var maxDateString = maxSplit[1] + '/' + maxSplit[2] + '/' + maxSplit[0];
|
||||
max = new Date(Date.parse(maxDateString));
|
||||
}
|
||||
|
||||
elem.pickadate({
|
||||
selectYears: years_n,
|
||||
min: min,
|
||||
max: max,
|
||||
disable: disable,
|
||||
format: elem.attr('data-format'),
|
||||
formatSubmit: 'yyyy/mm/dd',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
});
|
||||
});
|
||||
|
||||
jQuery('.um-timepicker').each(function(){
|
||||
elem = jQuery(this);
|
||||
|
||||
elem.pickatime({
|
||||
format: elem.attr('data-format'),
|
||||
interval: parseInt( elem.attr('data-intervals') ),
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
});
|
||||
});
|
||||
|
||||
jQuery('.um-rating').um_raty({
|
||||
half: false,
|
||||
starType: 'i',
|
||||
number: function() {return jQuery(this).attr('data-number');},
|
||||
score: function() {return jQuery(this).attr('data-score');},
|
||||
scoreName: function(){return jQuery(this).attr('data-key');},
|
||||
hints: false,
|
||||
click: function(score, evt) {
|
||||
live_field = this.id;
|
||||
live_value = score;
|
||||
um_conditional();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('.um-rating-readonly').um_raty({
|
||||
half: false,
|
||||
starType: 'i',
|
||||
number: function() {return jQuery(this).attr('data-number');},
|
||||
score: function() {return jQuery(this).attr('data-score');},
|
||||
scoreName: function(){return jQuery(this).attr('data-key');},
|
||||
hints: false,
|
||||
readOnly: true
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
var src = jQuery(this).parents('.um-field').find('.um-single-image-preview img').attr('src');
|
||||
parent.find('.um-single-image-preview img').attr('src','');
|
||||
parent.find('.um-single-image-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.remove_file,
|
||||
type: 'post',
|
||||
data: {
|
||||
src: src
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
var src = jQuery(this).parents('.um-field').find('.um-single-fileinfo a').attr('href');
|
||||
parent.find('.um-single-file-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.remove_file,
|
||||
type: 'post',
|
||||
data: {
|
||||
src: src
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('.um-s1,.um-s2').css({'display':'block'});
|
||||
|
||||
jQuery(".um-s1").select2({
|
||||
|
||||
allowClear: true,
|
||||
});
|
||||
|
||||
jQuery(".um-s2").select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-field-group-head:not(.disabled)', function(){
|
||||
var field = jQuery(this).parents('.um-field-group');
|
||||
var limit = field.data('max_entries');
|
||||
|
||||
if ( field.find('.um-field-group-body').is(':hidden')){
|
||||
field.find('.um-field-group-body').show();
|
||||
} else {
|
||||
field.find('.um-field-group-body:first').clone().appendTo( field );
|
||||
}
|
||||
|
||||
increase_id = 0;
|
||||
field.find('.um-field-group-body').each(function(){
|
||||
increase_id++;
|
||||
jQuery(this).find('input').each(function(){
|
||||
var input = jQuery(this);
|
||||
input.attr('id', input.data('key') + '-' + increase_id );
|
||||
input.attr('name', input.data('key') + '-' + increase_id );
|
||||
input.parent().parent().find('label').attr('for', input.data('key') + '-' + increase_id );
|
||||
});
|
||||
});
|
||||
|
||||
if ( limit > 0 && field.find('.um-field-group-body').length == limit ) {
|
||||
|
||||
jQuery(this).addClass('disabled');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-field-group-cancel', function(e){
|
||||
e.preventDefault();
|
||||
var field = jQuery(this).parents('.um-field-group');
|
||||
|
||||
var limit = field.data('max_entries');
|
||||
|
||||
if ( field.find('.um-field-group-body').length > 1 ) {
|
||||
jQuery(this).parents('.um-field-group-body').remove();
|
||||
} else {
|
||||
jQuery(this).parents('.um-field-group-body').hide();
|
||||
}
|
||||
|
||||
if ( limit > 0 && field.find('.um-field-group-body').length < limit ) {
|
||||
field.find('.um-field-group-head').removeClass('disabled');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-ajax-paginate', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parent();
|
||||
parent.addClass('loading');
|
||||
var args = jQuery(this).data('args');
|
||||
var hook = jQuery(this).data('hook');
|
||||
var container = jQuery(this).parents('.um').find('.um-ajax-items');
|
||||
jQuery.ajax({
|
||||
url: um_scripts.ajax_paginate,
|
||||
type: 'post',
|
||||
data: {
|
||||
hook: hook,
|
||||
args: args
|
||||
},
|
||||
complete: function(){
|
||||
parent.removeClass('loading');
|
||||
},
|
||||
success: function(data){
|
||||
parent.remove();
|
||||
container.append( data );
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-ajax-action', function(e){
|
||||
e.preventDefault();
|
||||
var hook = jQuery(this).data('hook');
|
||||
var user_id = jQuery(this).data('user_id');
|
||||
var arguments = jQuery(this).data('arguments');
|
||||
|
||||
if ( jQuery(this).data('js-remove') ){
|
||||
jQuery(this).parents('.'+jQuery(this).data('js-remove')).fadeOut('fast');
|
||||
}
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.muted_action,
|
||||
type: 'post',
|
||||
data: {
|
||||
hook: hook,
|
||||
user_id: user_id,
|
||||
arguments: arguments
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '#um-search-button', function() {
|
||||
|
||||
jQuery(this).parents('form').submit();
|
||||
});
|
||||
|
||||
jQuery('.um-form input[class=um-button][type=submit]').removeAttr('disabled');
|
||||
|
||||
jQuery(document).one('click', '.um:not(.um-account) .um-form input[class=um-button][type=submit]:not(.um-has-recaptcha)', function() {
|
||||
jQuery(this).attr('disabled','disabled');
|
||||
jQuery(this).parents('form').submit();
|
||||
|
||||
});
|
||||
|
||||
|
||||
var um_select_options_cache = {};
|
||||
|
||||
/**
|
||||
* Find all select fields with parent select fields
|
||||
*/
|
||||
jQuery('select[data-um-parent]').each(function(){
|
||||
|
||||
var me = jQuery(this);
|
||||
var parent_option = me.data('um-parent');
|
||||
var um_ajax_url = me.data('um-ajax-url');
|
||||
var um_ajax_source = me.data('um-ajax-source');
|
||||
var original_value = me.val();
|
||||
|
||||
me.attr('data-um-init-field', true );
|
||||
|
||||
jQuery(document).on('change','select[name="'+parent_option+'"]',function(){
|
||||
var parent = jQuery(this);
|
||||
var form_id = parent.closest('form').find('input[type=hidden][name=form_id]').val();
|
||||
var arr_key = parent.val();
|
||||
|
||||
if( parent.val() != '' && typeof um_select_options_cache[ arr_key ] != 'object' ){
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.ajax_select_options,
|
||||
type: 'post',
|
||||
data: {
|
||||
parent_option_name: parent_option,
|
||||
parent_option: parent.val(),
|
||||
child_callback: um_ajax_source,
|
||||
child_name: me.attr('name'),
|
||||
form_id: form_id,
|
||||
},
|
||||
success: function( data ){
|
||||
|
||||
if( data.status == 'success' && parent.val() != '' ){
|
||||
um_field_populate_child_options( me, data, arr_key);
|
||||
}
|
||||
|
||||
if( typeof data.debug !== 'undefined' ){
|
||||
console.log( data );
|
||||
}
|
||||
},
|
||||
error: function( e ){
|
||||
console.log( e );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
if( parent.val() != '' && typeof um_select_options_cache[ arr_key ] == 'object' ){
|
||||
var data = um_select_options_cache[ arr_key ];
|
||||
um_field_populate_child_options( me, data, arr_key );
|
||||
}
|
||||
|
||||
if( parent.val() == '' ){
|
||||
me.find('option[value!=""]').remove();
|
||||
me.val('').trigger('change');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
jQuery('select[name="'+parent_option+'"]').trigger('change');
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Populates child options and cache ajax response
|
||||
* @param DOM me child option elem
|
||||
* @param array data
|
||||
* @param string key
|
||||
*/
|
||||
function um_field_populate_child_options( me, data, arr_key, arr_items ){
|
||||
|
||||
|
||||
var parent_option = me.data('um-parent');
|
||||
var child_name = me.attr('name');
|
||||
var parent_dom = jQuery('select[name="'+parent_option+'"]');
|
||||
me.find('option[value!=""]').remove();
|
||||
|
||||
if( ! me.hasClass('um-child-option-disabled') ){
|
||||
me.removeAttr('disabled');
|
||||
}
|
||||
|
||||
var arr_items = [];
|
||||
|
||||
jQuery.each( data.items, function(k,v){
|
||||
arr_items.push({id: k, text: v});
|
||||
});
|
||||
|
||||
me.select2('destroy');
|
||||
me.select2({
|
||||
data: arr_items,
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: 10,
|
||||
});
|
||||
|
||||
if( typeof data.field.default !== 'undefined' && ! me.data('um-original-value') ){
|
||||
me.val( data.field.default ).trigger('change');
|
||||
}else if( me.data('um-original-value') != '' ){
|
||||
me.val( me.data('um-original-value') ).trigger('change');
|
||||
}
|
||||
|
||||
if( data.field.editable == 0 ){
|
||||
me.addClass('um-child-option-disabled');
|
||||
me.attr('disabled','disabled');
|
||||
}
|
||||
|
||||
um_select_options_cache[ arr_key ] = data;
|
||||
|
||||
|
||||
}
|
||||
jQuery(document).on('click', '.um-dropdown a', function(e){
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-dropdown a.real_url', function(e){
|
||||
|
||||
window.location = jQuery(this).attr('href');
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-trigger-menu-on-click', function(e){
|
||||
jQuery('.um-dropdown').hide();
|
||||
menu = jQuery(this).find('.um-dropdown');
|
||||
menu.show();
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-dropdown-hide', function(e){
|
||||
|
||||
UM_hide_menus();
|
||||
});
|
||||
|
||||
jQuery(document).on('click', 'a.um-manual-trigger', function(){
|
||||
var child = jQuery(this).attr('data-child');
|
||||
var parent = jQuery(this).attr('data-parent');
|
||||
jQuery(this).parents( parent ).find( child ).trigger('click');
|
||||
});
|
||||
|
||||
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: 'a.live', offset: 3 });
|
||||
|
||||
jQuery(document).on('change', '.um-field-area input[type=radio]', function(){
|
||||
var field = jQuery(this).parents('.um-field-area');
|
||||
var this_field = jQuery(this).parents('label');
|
||||
field.find('.um-field-radio').removeClass('active');
|
||||
field.find('.um-field-radio').find('i').removeClass().addClass('um-icon-android-radio-button-off');
|
||||
this_field.addClass('active');
|
||||
this_field.find('i').removeClass().addClass('um-icon-android-radio-button-on');
|
||||
});
|
||||
|
||||
jQuery(document).on('change', '.um-field-area input[type=checkbox]', function(){
|
||||
|
||||
var field = jQuery(this).parents('.um-field-area');
|
||||
var this_field = jQuery(this).parents('label');
|
||||
if ( this_field.hasClass('active') ) {
|
||||
this_field.removeClass('active');
|
||||
this_field.find('i').removeClass().addClass('um-icon-android-checkbox-outline-blank');
|
||||
} else {
|
||||
this_field.addClass('active');
|
||||
this_field.find('i').removeClass().addClass('um-icon-android-checkbox-outline');
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('.um-datepicker').each(function(){
|
||||
elem = jQuery(this);
|
||||
|
||||
if ( elem.attr('data-disabled_weekdays') != '' ) {
|
||||
var disable = JSON.parse( elem.attr('data-disabled_weekdays') );
|
||||
} else {
|
||||
var disable = false;
|
||||
}
|
||||
|
||||
var years_n = elem.attr('data-years');
|
||||
|
||||
var minRange = elem.attr('data-date_min');
|
||||
var maxRange = elem.attr('data-date_max');
|
||||
|
||||
var minSplit = minRange.split(",");
|
||||
var maxSplit = maxRange.split(",");
|
||||
|
||||
var min = minSplit.length ? new Date(minSplit) : null;
|
||||
var max = minSplit.length ? new Date(maxSplit) : null;
|
||||
|
||||
// fix min date for safari
|
||||
if(min && min.toString() == 'Invalid Date' && minSplit.length == 3) {
|
||||
var minDateString = minSplit[1] + '/' + minSplit[2] + '/' + minSplit[0];
|
||||
min = new Date(Date.parse(minDateString));
|
||||
}
|
||||
|
||||
// fix max date for safari
|
||||
if(max && max.toString() == 'Invalid Date' && maxSplit.length == 3) {
|
||||
var maxDateString = maxSplit[1] + '/' + maxSplit[2] + '/' + maxSplit[0];
|
||||
max = new Date(Date.parse(maxDateString));
|
||||
}
|
||||
|
||||
elem.pickadate({
|
||||
selectYears: years_n,
|
||||
min: min,
|
||||
max: max,
|
||||
disable: disable,
|
||||
format: elem.attr('data-format'),
|
||||
formatSubmit: 'yyyy/mm/dd',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
});
|
||||
});
|
||||
|
||||
jQuery('.um-timepicker').each(function(){
|
||||
elem = jQuery(this);
|
||||
|
||||
elem.pickatime({
|
||||
format: elem.attr('data-format'),
|
||||
interval: parseInt( elem.attr('data-intervals') ),
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
});
|
||||
});
|
||||
|
||||
jQuery('.um-rating').um_raty({
|
||||
half: false,
|
||||
starType: 'i',
|
||||
number: function() {return jQuery(this).attr('data-number');},
|
||||
score: function() {return jQuery(this).attr('data-score');},
|
||||
scoreName: function(){return jQuery(this).attr('data-key');},
|
||||
hints: false,
|
||||
click: function(score, evt) {
|
||||
live_field = this.id;
|
||||
live_value = score;
|
||||
um_conditional();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('.um-rating-readonly').um_raty({
|
||||
half: false,
|
||||
starType: 'i',
|
||||
number: function() {return jQuery(this).attr('data-number');},
|
||||
score: function() {return jQuery(this).attr('data-score');},
|
||||
scoreName: function(){return jQuery(this).attr('data-key');},
|
||||
hints: false,
|
||||
readOnly: true
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
var src = jQuery(this).parents('.um-field').find('.um-single-image-preview img').attr('src');
|
||||
parent.find('.um-single-image-preview img').attr('src','');
|
||||
parent.find('.um-single-image-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.remove_file,
|
||||
type: 'post',
|
||||
data: {
|
||||
src: src
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
var src = jQuery(this).parents('.um-field').find('.um-single-fileinfo a').attr('href');
|
||||
parent.find('.um-single-file-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.remove_file,
|
||||
type: 'post',
|
||||
data: {
|
||||
src: src
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('.um-s1,.um-s2').css({'display':'block'});
|
||||
|
||||
jQuery(".um-s1").select2({
|
||||
|
||||
allowClear: true,
|
||||
});
|
||||
|
||||
jQuery(".um-s2").select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-field-group-head:not(.disabled)', function(){
|
||||
var field = jQuery(this).parents('.um-field-group');
|
||||
var limit = field.data('max_entries');
|
||||
|
||||
if ( field.find('.um-field-group-body').is(':hidden')){
|
||||
field.find('.um-field-group-body').show();
|
||||
} else {
|
||||
field.find('.um-field-group-body:first').clone().appendTo( field );
|
||||
}
|
||||
|
||||
increase_id = 0;
|
||||
field.find('.um-field-group-body').each(function(){
|
||||
increase_id++;
|
||||
jQuery(this).find('input').each(function(){
|
||||
var input = jQuery(this);
|
||||
input.attr('id', input.data('key') + '-' + increase_id );
|
||||
input.attr('name', input.data('key') + '-' + increase_id );
|
||||
input.parent().parent().find('label').attr('for', input.data('key') + '-' + increase_id );
|
||||
});
|
||||
});
|
||||
|
||||
if ( limit > 0 && field.find('.um-field-group-body').length == limit ) {
|
||||
|
||||
jQuery(this).addClass('disabled');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-field-group-cancel', function(e){
|
||||
e.preventDefault();
|
||||
var field = jQuery(this).parents('.um-field-group');
|
||||
|
||||
var limit = field.data('max_entries');
|
||||
|
||||
if ( field.find('.um-field-group-body').length > 1 ) {
|
||||
jQuery(this).parents('.um-field-group-body').remove();
|
||||
} else {
|
||||
jQuery(this).parents('.um-field-group-body').hide();
|
||||
}
|
||||
|
||||
if ( limit > 0 && field.find('.um-field-group-body').length < limit ) {
|
||||
field.find('.um-field-group-head').removeClass('disabled');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-ajax-paginate', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parent();
|
||||
parent.addClass('loading');
|
||||
var args = jQuery(this).data('args');
|
||||
var hook = jQuery(this).data('hook');
|
||||
var container = jQuery(this).parents('.um').find('.um-ajax-items');
|
||||
jQuery.ajax({
|
||||
url: um_scripts.ajax_paginate,
|
||||
type: 'post',
|
||||
data: {
|
||||
hook: hook,
|
||||
args: args
|
||||
},
|
||||
complete: function(){
|
||||
parent.removeClass('loading');
|
||||
},
|
||||
success: function(data){
|
||||
parent.remove();
|
||||
container.append( data );
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-ajax-action', function(e){
|
||||
e.preventDefault();
|
||||
var hook = jQuery(this).data('hook');
|
||||
var user_id = jQuery(this).data('user_id');
|
||||
var arguments = jQuery(this).data('arguments');
|
||||
|
||||
if ( jQuery(this).data('js-remove') ){
|
||||
jQuery(this).parents('.'+jQuery(this).data('js-remove')).fadeOut('fast');
|
||||
}
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.muted_action,
|
||||
type: 'post',
|
||||
data: {
|
||||
hook: hook,
|
||||
user_id: user_id,
|
||||
arguments: arguments
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '#um-search-button', function() {
|
||||
|
||||
jQuery(this).parents('form').submit();
|
||||
});
|
||||
|
||||
jQuery('.um-form input[class=um-button][type=submit]').removeAttr('disabled');
|
||||
|
||||
jQuery(document).one('click', '.um:not(.um-account) .um-form input[class=um-button][type=submit]:not(.um-has-recaptcha)', function() {
|
||||
jQuery(this).attr('disabled','disabled');
|
||||
jQuery(this).parents('form').submit();
|
||||
|
||||
});
|
||||
|
||||
|
||||
var um_select_options_cache = {};
|
||||
|
||||
/**
|
||||
* Find all select fields with parent select fields
|
||||
*/
|
||||
jQuery('select[data-um-parent]').each(function(){
|
||||
|
||||
var me = jQuery(this);
|
||||
var parent_option = me.data('um-parent');
|
||||
var um_ajax_url = me.data('um-ajax-url');
|
||||
var um_ajax_source = me.data('um-ajax-source');
|
||||
var original_value = me.val();
|
||||
|
||||
me.attr('data-um-init-field', true );
|
||||
|
||||
jQuery(document).on('change','select[name="'+parent_option+'"]',function(){
|
||||
var parent = jQuery(this);
|
||||
var form_id = parent.closest('form').find('input[type=hidden][name=form_id]').val();
|
||||
var arr_key = parent.val();
|
||||
|
||||
if( parent.val() != '' && typeof um_select_options_cache[ arr_key ] != 'object' ){
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.ajax_select_options,
|
||||
type: 'post',
|
||||
data: {
|
||||
parent_option_name: parent_option,
|
||||
parent_option: parent.val(),
|
||||
child_callback: um_ajax_source,
|
||||
child_name: me.attr('name'),
|
||||
members_directory: me.attr('data-mebers-directory'),
|
||||
form_id: form_id,
|
||||
},
|
||||
success: function( data ){
|
||||
if( data.status == 'success' && parent.val() != '' ){
|
||||
um_field_populate_child_options( me, data, arr_key);
|
||||
}
|
||||
|
||||
if( typeof data.debug !== 'undefined' ){
|
||||
console.log( data );
|
||||
}
|
||||
},
|
||||
error: function( e ){
|
||||
console.log( e );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
if( parent.val() != '' && typeof um_select_options_cache[ arr_key ] == 'object' ) {
|
||||
var data = um_select_options_cache[ arr_key ];
|
||||
um_field_populate_child_options( me, data, arr_key );
|
||||
}
|
||||
|
||||
if( parent.val() == '' ){
|
||||
me.find('option[value!=""]').remove();
|
||||
me.val('').trigger('change');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
jQuery('select[name="'+parent_option+'"]').trigger('change');
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Populates child options and cache ajax response
|
||||
* @param DOM me child option elem
|
||||
* @param array data
|
||||
* @param string key
|
||||
*/
|
||||
function um_field_populate_child_options( me, data, arr_key, arr_items ){
|
||||
|
||||
|
||||
var parent_option = me.data('um-parent');
|
||||
var child_name = me.attr('name');
|
||||
var parent_dom = jQuery('select[name="'+parent_option+'"]');
|
||||
me.find('option[value!=""]').remove();
|
||||
|
||||
if( ! me.hasClass('um-child-option-disabled') ){
|
||||
me.removeAttr('disabled');
|
||||
}
|
||||
|
||||
var arr_items = [],
|
||||
search_get = '';
|
||||
|
||||
if ( data.post.members_directory === 'yes' ) {
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
search_get = urlParams.get(data.post.child_name);
|
||||
}
|
||||
jQuery.each( data.items, function(k,v){
|
||||
arr_items.push({id: k, text: v, selected: (v === search_get) });
|
||||
});
|
||||
|
||||
me.select2('destroy');
|
||||
me.select2({
|
||||
data: arr_items,
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
|
||||
if ( data.post.members_directory !== 'yes' ) {
|
||||
if( typeof data.field.default !== 'undefined' && ! me.data('um-original-value') ){
|
||||
me.val( data.field.default ).trigger('change');
|
||||
}else if( me.data('um-original-value') != '' ){
|
||||
me.val( me.data('um-original-value') ).trigger('change');
|
||||
}
|
||||
|
||||
if( data.field.editable == 0 ){
|
||||
me.addClass('um-child-option-disabled');
|
||||
me.attr('disabled','disabled');
|
||||
}
|
||||
}
|
||||
um_select_options_cache[ arr_key ] = data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-2
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";function t(t){return!t.nodeName||e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])!==-1}function o(t){return e.isFunction(t)||e.isPlainObject(t)?t:{top:t,left:t}}var n=e.scrollTo=function(t,o,n){return e(window).scrollTo(t,o,n)};return n.defaults={axis:"xy",duration:0,limit:!0},e.fn.scrollTo=function(r,i,s){"object"==typeof i&&(s=i,i=0),"function"==typeof s&&(s={onAfter:s}),"max"===r&&(r=9e9),s=e.extend({},n.defaults,s),i=i||s.duration;var a=s.queue&&s.axis.length>1;return a&&(i/=2),s.offset=o(s.offset),s.over=o(s.over),this.each(function(){function f(t){var o=e.extend({},s,{queue:!0,duration:i,complete:t&&function(){t.call(l,m,s)}});d.animate(p,o)}if(null!==r){var u,c=t(this),l=c?this.contentWindow||window:this,d=e(l),m=r,p={};switch(typeof m){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(m)){m=o(m);break}if(m=c?e(m):e(m,l),!m.length)return;case"object":(m.is||m.style)&&(u=(m=e(m)).offset())}var h=e.isFunction(s.offset)&&s.offset(l,m)||s.offset;e.each(s.axis.split(""),function(e,t){var o="x"===t?"Left":"Top",r=o.toLowerCase(),i="scroll"+o,x=d[i](),v=n.max(l,t);if(u)p[i]=u[r]+(c?0:x-d.offset()[r]),s.margin&&(p[i]-=parseInt(m.css("margin"+o),10)||0,p[i]-=parseInt(m.css("border"+o+"Width"),10)||0),p[i]+=h[r]||0,s.over[r]&&(p[i]+=m["x"===t?"width":"height"]()*s.over[r]);else{var w=m[r];p[i]=w.slice&&"%"===w.slice(-1)?parseFloat(w)/100*v:w}s.limit&&/^\d+$/.test(p[i])&&(p[i]=p[i]<=0?0:Math.min(p[i],v)),!e&&s.axis.length>1&&(x===p[i]?p={}:a&&(f(s.onAfterFirst),p={}))}),f(s.onAfter)}})},n.max=function(o,n){var r="x"===n?"Width":"Height",i="scroll"+r;if(!t(o))return o[i]-e(o)[r.toLowerCase()]();var s="client"+r,a=o.ownerDocument||o.document,f=a.documentElement,u=a.body;return Math.max(f[i],u[i])-Math.min(f[s],u[s])},e.Tween.propHooks.scrollLeft=e.Tween.propHooks.scrollTop={get:function(t){return e(t.elem)[t.prop]()},set:function(t){var o=this.get(t);if(t.options.interrupt&&t._last&&t._last!==o)return e(t.elem).stop();var n=Math.round(t.now);o!==n&&(e(t.elem)[t.prop](n),t._last=this.get(t))}},n});
|
||||
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(w){"use strict";var y=w.scrollTo=function(e,t,o){return w(window).scrollTo(e,t,o)};function g(e){return!e.nodeName||-1!==w.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])}function t(e){return w.isFunction(e)||w.isPlainObject(e)?e:{top:e,left:e}}return y.defaults={axis:"xy",duration:0,limit:!0},w.fn.scrollTo=function(e,o,x){"object"==typeof o&&(x=o,o=0),"function"==typeof x&&(x={onAfter:x}),"max"===e&&(e=9e9),x=w.extend({},y.defaults,x),o=o||x.duration;var v=x.queue&&1<x.axis.length;return v&&(o/=2),x.offset=t(x.offset),x.over=t(x.over),this.each(function(){if(null!==e){var f,u=g(this),c=u?this.contentWindow||window:this,l=w(c),d=e,m={};switch(typeof d){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(d)){d=t(d);break}if(!(d=u?w(d):w(d,c)).length)return;case"object":(d.is||d.style)&&(f=(d=w(d)).offset())}var p=w.isFunction(x.offset)&&x.offset(c,d)||x.offset;w.each(x.axis.split(""),function(e,t){var o="x"===t?"Left":"Top",n=o.toLowerCase(),r="scroll"+o,i=l[r](),s=y.max(c,t);if(f)m[r]=f[n]+(u?0:i-l.offset()[n]),x.margin&&(m[r]-=parseInt(d.css("margin"+o),10)||0,m[r]-=parseInt(d.css("border"+o+"Width"),10)||0),m[r]+=p[n]||0,x.over[n]&&(m[r]+=d["x"===t?"width":"height"]()*x.over[n]);else{var a=d[n];m[r]=a.slice&&"%"===a.slice(-1)?parseFloat(a)/100*s:a}x.limit&&/^\d+$/.test(m[r])&&(m[r]=m[r]<=0?0:Math.min(m[r],s)),!e&&1<x.axis.length&&(i===m[r]?m={}:v&&(h(x.onAfterFirst),m={}))}),h(x.onAfter)}function h(e){var t=w.extend({},x,{queue:!0,duration:o,complete:e&&function(){e.call(c,d,x)}});l.animate(m,t)}})},y.max=function(e,t){var o="x"===t?"Width":"Height",n="scroll"+o;if(!g(e))return e[n]-w(e)[o.toLowerCase()]();var r="client"+o,i=e.ownerDocument||e.document,s=i.documentElement,a=i.body;return Math.max(s[n],a[n])-Math.min(s[r],a[r])},w.Tween.propHooks.scrollLeft=w.Tween.propHooks.scrollTop={get:function(e){return w(e.elem)[e.prop]()},set:function(e){var t=this.get(e);if(e.options.interrupt&&e._last&&e._last!==t)return w(e.elem).stop();var o=Math.round(e.now);t!==o&&(w(e.elem)[e.prop](o),e._last=this.get(e))}},y});
|
||||
Vendored
+1
-2
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(t){function e(t,e){return"function"==typeof t?t.call(e):t}function i(t){for(;t=t.parentNode;)if(t==document)return!0;return!1}function s(e,i){this.$element=t(e),this.options=i,this.enabled=!0,this.fixTitle()}s.prototype={show:function(){var i=this.getTitle();if(i&&this.enabled){var s=this.tip();s.find(".tipsy-inner")[this.options.html?"html":"text"](i),s[0].className="tipsy",s.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var n,o=t.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),a=s[0].offsetWidth,l=s[0].offsetHeight,f=e(this.options.gravity,this.$element[0]);switch(f.charAt(0)){case"n":n={top:o.top+o.height+this.options.offset,left:o.left+o.width/2-a/2};break;case"s":n={top:o.top-l-this.options.offset,left:o.left+o.width/2-a/2};break;case"e":n={top:o.top+o.height/2-l/2,left:o.left-a-this.options.offset};break;case"w":extra_gap=0,t("body").css("position").length>0&&"relative"==t("body").css("position")&&t("#wpadminbar").length&&(extra_gap=t("#wpadminbar").height()),n={top:o.top+o.height/2-l/2-extra_gap,left:o.left+o.width+this.options.offset}}2==f.length&&("w"==f.charAt(1)?n.left=o.left+o.width/2-15:n.left=o.left+o.width/2-a+15),s.css(n).addClass("tipsy-"+f),s.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+f.charAt(0),this.options.className&&s.addClass(e(this.options.className,this.$element[0])),this.options.fade?s.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):s.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){t(this).remove()}):this.tip().remove()},fixTitle:function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("original-title"))&&t.attr("original-title",t.attr("title")||"").removeAttr("title")},getTitle:function(){var t,e=this.$element,i=this.options;this.fixTitle();var t,i=this.options;return"string"==typeof i.title?t=e.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(t=i.title.call(e[0])),t=(""+t).replace(/(^\s*|\s*$)/,""),t||i.fallback},tip:function(){return this.$tip||(this.$tip=t('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},t.fn.tipsy=function(e){function i(i){var n=t.data(i,"tipsy");return n||(n=new s(i,t.fn.tipsy.elementOptions(i,e)),t.data(i,"tipsy",n)),n}function n(){var t=i(this);t.hoverState="in",0==e.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},e.delayIn))}function o(){var t=i(this);t.hoverState="out",0==e.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},e.delayOut)}if(e===!0)return this.data("tipsy");if("string"==typeof e){var a=this.data("tipsy");return a&&a[e](),this}if(e=t.extend({},t.fn.tipsy.defaults,e),e.live||this.each(function(){i(this)}),"manual"!=e.trigger){var l="hover"==e.trigger?"mouseenter":"focus",f="hover"==e.trigger?"mouseleave":"blur";e.live?t(document).on(l,this.selector,n).on(f,this.selector,o):this.bind(l,n).bind(f,o)}return this},t.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},t.fn.tipsy.revalidate=function(){t(".tipsy").each(function(){var e=t.data(this,"tipsy-pointee");e&&i(e)||t(this).remove()})},t.fn.tipsy.elementOptions=function(e,i){return t.metadata?t.extend({},i,t(e).metadata()):i},t.fn.tipsy.autoNS=function(){return t(this).offset().top>t(document).scrollTop()+t(window).height()/2?"s":"n"},t.fn.tipsy.autoWE=function(){return t(this).offset().left>t(document).scrollLeft()+t(window).width()/2?"e":"w"},t.fn.tipsy.autoBounds=function(e,i){return function(){var s={ns:i[0],ew:i.length>1&&i[1]},n=t(document).scrollTop()+e,o=t(document).scrollLeft()+e,a=t(this);return a.offset().top<n&&(s.ns="n"),a.offset().left<o&&(s.ew="w"),t(window).width()+t(document).scrollLeft()-a.offset().left<e&&(s.ew="e"),t(window).height()+t(document).scrollTop()-a.offset().top<e&&(s.ns="s"),s.ns+(s.ew?s.ew:"")}}}(jQuery);
|
||||
!function(l){function f(t,e){return"function"==typeof t?t.call(e):t}function h(t,e){this.$element=l(t),this.options=e,this.enabled=!0,this.fixTitle()}h.prototype={show:function(){var t=this.getTitle();if(t&&this.enabled){var e=this.tip();e.find(".tipsy-inner")[this.options.html?"html":"text"](t),e[0].className="tipsy",e.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var i,s=l.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),n=e[0].offsetWidth,o=e[0].offsetHeight,a=f(this.options.gravity,this.$element[0]);switch(a.charAt(0)){case"n":i={top:s.top+s.height+this.options.offset,left:s.left+s.width/2-n/2};break;case"s":i={top:s.top-o-this.options.offset,left:s.left+s.width/2-n/2};break;case"e":i={top:s.top+s.height/2-o/2,left:s.left-n-this.options.offset};break;case"w":(extra_gap=0)<l("body").css("position").length&&"relative"==l("body").css("position")&&l("#wpadminbar").length&&(extra_gap=l("#wpadminbar").height()),i={top:s.top+s.height/2-o/2-extra_gap,left:s.left+s.width+this.options.offset}}2==a.length&&("w"==a.charAt(1)?i.left=s.left+s.width/2-15:i.left=s.left+s.width/2-n+15),e.css(i).addClass("tipsy-"+a),e.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+a.charAt(0),this.options.className&&e.addClass(f(this.options.className,this.$element[0])),this.options.fade?e.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):e.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){l(this).remove()}):this.tip().remove()},fixTitle:function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("original-title"))&&t.attr("original-title",t.attr("title")||"").removeAttr("title")},getTitle:function(){var t,e=this.$element,i=this.options;return this.fixTitle(),"string"==typeof(i=this.options).title?t=e.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(t=i.title.call(e[0])),(t=(""+t).replace(/(^\s*|\s*$)/,""))||i.fallback},tip:function(){return this.$tip||(this.$tip=l('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},l.fn.tipsy=function(i){if(!0===i)return this.data("tipsy");if("string"==typeof i){var t=this.data("tipsy");return t&&t[i](),this}function e(t){var e=l.data(t,"tipsy");return e||(e=new h(t,l.fn.tipsy.elementOptions(t,i)),l.data(t,"tipsy",e)),e}function s(){var t=e(this);t.hoverState="in",0==i.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn))}function n(){var t=e(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)}if((i=l.extend({},l.fn.tipsy.defaults,i)).live||this.each(function(){e(this)}),"manual"!=i.trigger){var o="hover"==i.trigger?"mouseenter":"focus",a="hover"==i.trigger?"mouseleave":"blur";i.live?l(document).on(o,this.selector,s).on(a,this.selector,n):this.bind(o,s).bind(a,n)}return this},l.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},l.fn.tipsy.revalidate=function(){l(".tipsy").each(function(){var t=l.data(this,"tipsy-pointee");t&&function(t){for(;t=t.parentNode;)if(t==document)return!0;return!1}(t)||l(this).remove()})},l.fn.tipsy.elementOptions=function(t,e){return l.metadata?l.extend({},e,l(t).metadata()):e},l.fn.tipsy.autoNS=function(){return l(this).offset().top>l(document).scrollTop()+l(window).height()/2?"s":"n"},l.fn.tipsy.autoWE=function(){return l(this).offset().left>l(document).scrollLeft()+l(window).width()/2?"e":"w"},l.fn.tipsy.autoBounds=function(n,o){return function(){var t={ns:o[0],ew:1<o.length&&o[1]},e=l(document).scrollTop()+n,i=l(document).scrollLeft()+n,s=l(this);return s.offset().top<e&&(t.ns="n"),s.offset().left<i&&(t.ew="w"),l(window).width()+l(document).scrollLeft()-s.offset().left<n&&(t.ew="e"),l(window).height()+l(document).scrollTop()-s.offset().top<n&&(t.ns="s"),t.ns+(t.ew?t.ew:"")}}}(jQuery);
|
||||
@@ -94,7 +94,7 @@
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
#um-metaboxes-general h2 sup {
|
||||
#um-metaboxes-general h1 sup {
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
font-weight: 400;
|
||||
|
||||
@@ -30,23 +30,7 @@ jQuery(document).ready(function() {
|
||||
|
||||
|
||||
jQuery(document).on('click', '#um_opt_in_start', function (e) {
|
||||
var obj = jQuery(this);
|
||||
var dismiss = jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' );
|
||||
jQuery(this).prop('disabled', true).attr('disabled', 'disabled');
|
||||
|
||||
wp.ajax.send( 'um_opt_in_notice', {
|
||||
data: {
|
||||
nonce: um_admin_scripts.nonce
|
||||
},
|
||||
success: function( data ) {
|
||||
dismiss.trigger('click');
|
||||
obj.prop('disabled', false).removeAttr( 'disabled' );
|
||||
},
|
||||
error: function( data ) {
|
||||
obj.prop('disabled', false).removeAttr( 'disabled' );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ).trigger('click');
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -349,6 +349,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Render text field
|
||||
*
|
||||
* @param $field_data
|
||||
*
|
||||
* @return bool|string
|
||||
|
||||
@@ -362,7 +362,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
|
||||
|
||||
<div id="um-metaboxes-general" class="wrap">
|
||||
|
||||
<h2>Ultimate Member <sup><?php echo ultimatemember_version; ?></sup></h2>
|
||||
<h1>Ultimate Member <sup><?php echo ultimatemember_version; ?></sup></h1>
|
||||
|
||||
<?php wp_nonce_field( 'um-metaboxes-general' ); ?>
|
||||
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
||||
|
||||
@@ -31,7 +31,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
add_action( 'admin_notices', array( &$this, 'render_notices' ), 1 );
|
||||
|
||||
add_action( 'wp_ajax_um_dismiss_notice', array( &$this, 'dismiss_notice' ) );
|
||||
add_action( 'wp_ajax_um_opt_in_notice', array( &$this, 'opt_in_notice' ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -514,24 +513,18 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$optin_url = esc_url( add_query_arg( 'um_adm_action', 'opt_in' ) );
|
||||
|
||||
ob_start(); ?>
|
||||
|
||||
<p>
|
||||
<?php printf( __( 'Thanks for installing <strong>%s</strong>! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions for %s via our website. If you subscribe to our mailing list we will email you a 20%% discount code for our <a href="%s" target="_blank">extensions bundle</a> (you\'ll need to confirm your opt-in via email before the discount code can be sent).', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>
|
||||
<?php printf( __( 'Thanks for installing <strong>%s</strong>! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions. If you subscribe to our mailing list we will send you a 20%% discount code for our <a href="%s" target="_blank">extensions bundle</a>.', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="javascript:void(0);" id="um_opt_in_start" class="button button-primary"><?php _e( 'Subscribe to mailing list', 'ultimate-member' ) ?></a>
|
||||
<a href="http://ultimatemember.com/discount/" target="_blank" id="um_opt_in_start" class="button button-primary"><?php _e( 'Claim 20% discount code', 'ultimate-member' ) ?></a>
|
||||
|
||||
<a href="javascript:void(0);" class="button-secondary um_opt_in_link"><?php _e( 'No thanks', 'ultimate-member' ) ?></a>
|
||||
</p>
|
||||
|
||||
<p class="description" style="font-size: 11px;">
|
||||
<?php printf( __( 'By clicking the subscribe button you are agree to join our mailing list. See our <a href="%s" target="_blank">privacy policy</a>', 'ultimate-member' ), 'https://ultimatemember.com/privacy-policy/' ); ?>
|
||||
</p>
|
||||
|
||||
<?php $message = ob_get_clean();
|
||||
|
||||
$this->add_notice( 'opt_in_notice', array(
|
||||
@@ -566,7 +559,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
if ( ! empty( $arr_inactive_license_keys ) ) {
|
||||
$this->add_notice( 'license_key', array(
|
||||
'class' => 'error',
|
||||
'message' => '<p>' . sprintf( __( 'There are %d inactive %s license keys for this site. This site is not authorized to get plugin updates. You can active this site on <a href="%s">www.UltimateMember.com</a>.', 'ultimate-member' ), count( $arr_inactive_license_keys ) , ultimatemember_plugin_name, 'https://ultimatemember.com' ) . '</p>',
|
||||
'message' => '<p>' . sprintf( __( 'There are %d inactive %s license keys for this site. This site is not authorized to get plugin updates. You can active this site on <a href="%s">www.ultimatemember.com</a>.', 'ultimate-member' ), count( $arr_inactive_license_keys ) , ultimatemember_plugin_name, 'https://ultimatemember.com' ) . '</p>',
|
||||
), 3 );
|
||||
}
|
||||
|
||||
@@ -715,54 +708,5 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
|
||||
function opt_in_notice() {
|
||||
$nonce = isset( $_POST["nonce"] ) ? $_POST["nonce"] : "";
|
||||
if ( ! wp_verify_nonce( $nonce, "um-admin-nonce" ) ) {
|
||||
wp_send_json_error( esc_js( __( "Wrong Nonce", 'ultimate-member' ) ) );
|
||||
}
|
||||
|
||||
// Send a maximum of once per period
|
||||
$last_send = get_option( 'um_opt_in_last_send', false );
|
||||
if ( $last_send && $last_send > strtotime( '-1 day' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
UM()->setup()->install_basics();
|
||||
|
||||
$data['email'] = get_option( 'admin_email' );
|
||||
$data['send_discount'] = ! get_option( '__ultimatemember_coupon_sent' ) ? 1 : 0;
|
||||
$data['unique_sitekey'] = get_option( '__ultimatemember_sitekey' );
|
||||
|
||||
$request = wp_remote_post( 'https://ultimatemember.com/?um_action=checkin', array(
|
||||
'method' => 'POST',
|
||||
'timeout' => 45,
|
||||
'redirection' => 5,
|
||||
'httpversion' => '1.0',
|
||||
'blocking' => true,
|
||||
'body' => $data,
|
||||
'user-agent' => 'UM/' . ultimatemember_version . '; ' . get_bloginfo( 'url' ),
|
||||
) );
|
||||
|
||||
if ( ! is_wp_error( $request ) ) {
|
||||
$request = json_decode( wp_remote_retrieve_body( $request ), true );
|
||||
}
|
||||
|
||||
$request = ( $request ) ? maybe_unserialize( $request ) : false;
|
||||
|
||||
if ( ! empty( $request['id'] ) && ! empty( $request['list_id'] ) ) {
|
||||
update_option( 'um_opt_in_last_send', time() );
|
||||
|
||||
if ( $request['discount_ready'] ) {
|
||||
update_option( '__ultimatemember_coupon_sent', 1 );
|
||||
}
|
||||
}
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2381,6 +2381,7 @@ SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'Your
|
||||
SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php echo "\n"; ?>
|
||||
GD Library: <?php echo ( extension_loaded( 'gd' ) && function_exists('gd_info') ) ? 'PHP GD library is installed on your web server.' : 'PHP GD library is NOT installed on your web server.'; ?><?php echo "\n"; ?>
|
||||
Mail: <?php echo ( function_exists('mail') ) ? 'PHP mail function exist on your web server.' : 'PHP mail function doesn\'t exist on your web server.'; ?><?php echo "\n"; ?>
|
||||
Exif: <?php echo ( extension_loaded( 'exif' ) && function_exists('exif_imagetype') ) ? 'PHP Exif library is installed on your web server.' : 'PHP Exif library is NOT installed on your web server.'; ?><?php echo "\n"; ?>
|
||||
|
||||
|
||||
--- Session Configurations ---
|
||||
|
||||
@@ -150,7 +150,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
||||
|
||||
$all_packages = $this->get_packages();
|
||||
foreach ( $all_packages as $package ) {
|
||||
if ( version_compare( $um_last_version_upgrade, $package, '<' ) ) {
|
||||
if ( version_compare( $um_last_version_upgrade, $package, '<' ) && version_compare( $package, ultimatemember_version, '<=' ) ) {
|
||||
$diff_packages[] = $package;
|
||||
}
|
||||
}
|
||||
@@ -402,28 +402,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Parse packages dir for packages files
|
||||
*/
|
||||
/*function set_update_versions_() {
|
||||
$update_versions = array();
|
||||
$handle = opendir( $this->packages_dir );
|
||||
if ( $handle ) {
|
||||
while ( false !== ( $filename = readdir( $handle ) ) ) {
|
||||
if ( $filename != '.' && $filename != '..' ) {
|
||||
var_dump( $filename );
|
||||
if ( is_dir( $this->packages_dir . DIRECTORY_SEPARATOR . $filename ) ) {
|
||||
$update_versions[] = $filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir( $handle );
|
||||
|
||||
usort( $update_versions, array( &$this, 'version_compare_sort' ) );
|
||||
|
||||
$this->update_packages = $update_versions;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -314,7 +314,7 @@ $ListTable->wpc_set_pagination_args( array( 'total_items' => count( $emails ), '
|
||||
<input type="hidden" name="page" value="um_options" />
|
||||
<input type="hidden" name="tab" value="email" />
|
||||
<?php if ( ! empty( $_GET['section'] ) ) { ?>
|
||||
<input type="hidden" name="section" value="<?php echo $_GET['section'] ?>" />
|
||||
<input type="hidden" name="section" value="<?php echo esc_attr( $_GET['section'] ) ?>" />
|
||||
<?php }
|
||||
|
||||
$ListTable->display(); ?>
|
||||
|
||||
@@ -62,8 +62,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
//gravity forms compatibility filter
|
||||
$all_caps = apply_filters( 'members_get_capabilities', array_keys( $all_caps ) );
|
||||
$fields = array();
|
||||
foreach ( array_keys( $all_caps ) as $cap ) {
|
||||
foreach ( $all_caps as $cap ) {
|
||||
if ( is_numeric( $cap ) ) {
|
||||
continue;
|
||||
}
|
||||
$fields[ $cap ] = $cap;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
|
||||
'woocommerce' => '2.0.1',
|
||||
'restrict-content' => '2.0',
|
||||
'beaver-builder' => '2.0',
|
||||
'photos' => '1.1',
|
||||
'user-photos' => '2.0.1',
|
||||
'user-exporter' => '1.0.0',
|
||||
);
|
||||
|
||||
|
||||
|
||||
+29
-1
@@ -30,7 +30,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
* @method UM_Terms_Conditions_API Terms_Conditions_API()
|
||||
* @method UM_Private_Content_API Private_Content_API()
|
||||
* @method UM_User_Location_API User_Location_API()
|
||||
* @method UM_GDPR_API GDPR_API()
|
||||
* @method UM_Photos_API Photos_API()
|
||||
*
|
||||
*/
|
||||
final class UM extends UM_Functions {
|
||||
@@ -280,6 +280,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
|
||||
// include UM classes
|
||||
$this->includes();
|
||||
$this->plugins_loaded();
|
||||
|
||||
// include hook files
|
||||
add_action( 'plugins_loaded', array( &$this, 'init' ), 0 );
|
||||
@@ -300,6 +301,18 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
}
|
||||
|
||||
|
||||
public function plugins_loaded() {
|
||||
//gravity forms
|
||||
if ( ! function_exists('members_get_capabilities' ) ) {
|
||||
|
||||
function members_get_capabilities() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function old_update_patch() {
|
||||
global $um_woocommerce, $um_bbpress, $um_followers, $um_friends, $um_mailchimp, $um_messaging, $um_mycred, $um_notices, $um_notifications, $um_online, $um_private_content, $um_profile_completeness, $um_recaptcha, $um_reviews, $um_activity, $um_social_login, $um_user_tags, $um_verified;
|
||||
|
||||
@@ -540,6 +553,8 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->mobile();
|
||||
$this->external_integrations();
|
||||
$this->gdpr();
|
||||
$this->uploader();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1139,6 +1154,19 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
return $this->classes['files'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0.21
|
||||
*
|
||||
* @return um\core\Uploader
|
||||
*/
|
||||
function uploader() {
|
||||
if ( empty( $this->classes['uploader'] ) ) {
|
||||
$this->classes['uploader'] = new um\core\Uploader();
|
||||
}
|
||||
return $this->classes['uploader'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
|
||||
@@ -528,17 +528,24 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
* @return bool|array
|
||||
*/
|
||||
function get_post_privacy_settings( $post ) {
|
||||
$exclude = false;
|
||||
|
||||
//if logged in administrator all pages are visible
|
||||
if ( current_user_can( 'administrator' ) ) {
|
||||
return false;
|
||||
$exclude = true;
|
||||
}
|
||||
|
||||
//exlude from privacy UM default pages (except Members list and User(Profile) page)
|
||||
//exclude from privacy UM default pages (except Members list and User(Profile) page)
|
||||
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
|
||||
if ( um_is_core_post( $post, 'login' ) || um_is_core_post( $post, 'register' ) ||
|
||||
um_is_core_post( $post, 'account' ) || um_is_core_post( $post, 'logout' ) ||
|
||||
um_is_core_post( $post, 'password-reset' ) || ( is_user_logged_in() && um_is_core_post( $post, 'user' ) ) )
|
||||
return false;
|
||||
$exclude = true;
|
||||
}
|
||||
|
||||
$exclude = apply_filters( 'um_exclude_posts_from_privacy', $exclude, $post );
|
||||
if ( $exclude ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$restricted_posts = UM()->options()->get( 'restricted_access_post_metabox' );
|
||||
|
||||
@@ -32,6 +32,25 @@ if ( ! class_exists( 'um\core\AJAX_Common' ) ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_ajax_um_remove_file', array( UM()->files(), 'ajax_remove_file' ) );
|
||||
add_action( 'wp_ajax_um_delete_profile_photo', array( UM()->profile(), 'ajax_delete_profile_photo' ) );
|
||||
add_action( 'wp_ajax_um_delete_cover_photo', array( UM()->profile(), 'ajax_delete_cover_photo' ) );
|
||||
add_action( 'wp_ajax_um_select_options', array( UM()->form(), 'ajax_select_options' ) );
|
||||
add_action( 'wp_ajax_um_ajax_paginate', array( UM()->query(), 'ajax_paginate' ) );
|
||||
add_action( 'wp_ajax_um_muted_action', array( UM()->form(), 'ajax_muted_action' ) );
|
||||
add_action( 'wp_ajax_nopriv_um_remove_file', array( UM()->files(), 'ajax_remove_file' ) );
|
||||
add_action( 'wp_ajax_um_remove_file', array( UM()->files(), 'ajax_remove_file' ) );
|
||||
|
||||
add_action( 'wp_ajax_nopriv_um_fileupload', array( UM()->files(), 'ajax_file_upload' ) );
|
||||
add_action( 'wp_ajax_um_fileupload', array( UM()->files(), 'ajax_file_upload' ) );
|
||||
|
||||
add_action( 'wp_ajax_nopriv_um_imageupload', array( UM()->files(), 'ajax_image_upload' ) );
|
||||
add_action( 'wp_ajax_um_imageupload', array( UM()->files(), 'ajax_image_upload' ) );
|
||||
|
||||
add_action( 'wp_ajax_nopriv_um_resize_image', array( UM()->files(), 'ajax_resize_image' ) );
|
||||
add_action( 'wp_ajax_um_resize_image', array( UM()->files(), 'ajax_resize_image' ) );
|
||||
|
||||
|
||||
/**
|
||||
* Fallback for ajax urls
|
||||
|
||||
@@ -659,8 +659,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
* ?>
|
||||
*/
|
||||
$profile_privacy = apply_filters( 'um_profile_privacy_options', array(
|
||||
__( 'Everyone', 'ultimate-member' ),
|
||||
__( 'Only me', 'ultimate-member' )
|
||||
'Everyone' => __( 'Everyone', 'ultimate-member' ),
|
||||
'Only me' => __( 'Only me', 'ultimate-member' )
|
||||
) );
|
||||
|
||||
$this->predefined_fields = array(
|
||||
@@ -1117,7 +1117,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
'required' => 0,
|
||||
'public' => 1,
|
||||
'editable' => 1,
|
||||
'default' => __('Everyone','ultimate-member'),
|
||||
'default' => 'Everyone',
|
||||
'options' => $profile_privacy,
|
||||
'allowclear' => 0,
|
||||
'account_only' => true,
|
||||
|
||||
@@ -137,8 +137,6 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
*/
|
||||
$localize_data = apply_filters( 'um_enqueue_localize_data', array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
'fileupload' => UM()->get_ajax_route( 'um\core\Files', 'ajax_file_upload' ),
|
||||
'imageupload' => UM()->get_ajax_route( 'um\core\Files', 'ajax_image_upload' ),
|
||||
'remove_file' => UM()->get_ajax_route( 'um\core\Files', 'ajax_remove_file' ),
|
||||
'delete_profile_photo' => UM()->get_ajax_route( 'um\core\Profile', 'ajax_delete_profile_photo' ),
|
||||
'delete_cover_photo' => UM()->get_ajax_route( 'um\core\Profile', 'ajax_delete_cover_photo' ),
|
||||
@@ -318,7 +316,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
*/
|
||||
function load_functions() {
|
||||
|
||||
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry') );
|
||||
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry', 'wp-util') );
|
||||
wp_enqueue_script('um_functions');
|
||||
|
||||
wp_enqueue_script( 'um-gdpr', um_url . 'assets/js/um-gdpr' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, false );
|
||||
|
||||
@@ -2167,9 +2167,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
// add the contents of the buffer to the output variable
|
||||
$output .= ob_get_clean();
|
||||
|
||||
$output .= '<br /><span class="description">' . $placeholder . '</span>';
|
||||
} else {
|
||||
$output .= '<textarea ' . $disabled . ' style="height: ' . $height . ';" class="' . $this->get_class( $key, $data ) . '" name="' . $field_name . '" id="' . $field_id . '" placeholder="' . $placeholder . '">' . $field_value . '</textarea>';
|
||||
$output .= '<textarea ' . $disabled . ' style="height: ' . $height . ';" class="' . $this->get_class( $key, $data ) . '" name="' . $field_name . '" id="' . $field_id . '" placeholder="' . $placeholder . '">' . strip_tags( $field_value ) . '</textarea>';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
@@ -2219,28 +2219,21 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
/* Single Image Upload */
|
||||
case 'image':
|
||||
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '">';
|
||||
|
||||
if (in_array( $key, array( 'profile_photo', 'cover_photo' ) )) {
|
||||
$field_value = '';
|
||||
} else {
|
||||
$field_value = $this->field_value( $key, $default, $data );
|
||||
}
|
||||
|
||||
$output .= '<input type="hidden" name="' . $key . UM()->form()->form_suffix . '" id="' . $key . UM()->form()->form_suffix . '" value="' . $field_value . '" />';
|
||||
|
||||
if (isset( $data['label'] )) {
|
||||
$output .= $this->field_label( $label, $key, $data );
|
||||
}
|
||||
|
||||
$modal_label = ( isset( $data['label'] ) ) ? $data['label'] : __( 'Upload Photo', 'ultimate-member' );
|
||||
|
||||
$output .= '<div class="um-field-area" style="text-align: center">';
|
||||
|
||||
if ($this->field_value( $key, $default, $data )) {
|
||||
|
||||
if (!in_array( $key, array( 'profile_photo', 'cover_photo' ) )) {
|
||||
if ( ! in_array( $key, array( 'profile_photo', 'cover_photo' ) ) ) {
|
||||
if (isset( $this->set_mode ) && $this->set_mode == 'register') {
|
||||
$imgValue = $this->field_value( $key, $default, $data );
|
||||
$imgValue = UM()->uploader()->get_core_temp_url() . "/" . $this->field_value( $key, $default, $data );
|
||||
} else {
|
||||
$imgValue = um_user_uploads_uri() . $this->field_value( $key, $default, $data );
|
||||
}
|
||||
@@ -2248,29 +2241,20 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
} else {
|
||||
$img = '';
|
||||
}
|
||||
|
||||
$output .= '<div class="um-single-image-preview show ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">
|
||||
<a href="#" class="cancel"><i class="um-icon-close"></i></a>' . $img . '
|
||||
</div><a href="#" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . __( 'Change photo', 'ultimate-member' ) . '</a>';
|
||||
|
||||
} else {
|
||||
|
||||
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">
|
||||
<a href="#" class="cancel"><i class="um-icon-close"></i></a>
|
||||
<img src="" alt="" />
|
||||
<div class="um-clear"></div></div><a href="#" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . $button_text . '</a>';
|
||||
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
/* modal hidden */
|
||||
$output .= '<div class="um-modal-hidden-content">';
|
||||
|
||||
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
|
||||
|
||||
$output .= '<div class="um-modal-body">';
|
||||
|
||||
if (isset( $this->set_id )) {
|
||||
$set_id = $this->set_id;
|
||||
$set_mode = $this->set_mode;
|
||||
@@ -2278,12 +2262,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$set_id = 0;
|
||||
$set_mode = '';
|
||||
}
|
||||
|
||||
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
|
||||
|
||||
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-ratio="' . $ratio . '" data-min_width="' . $min_width . '" data-min_height="' . $min_height . '" data-coord=""><a href="#" class="cancel"><i class="um-icon-close"></i></a><img src="" alt="" /><div class="um-clear"></div></div><div class="um-clear"></div>';
|
||||
$output .= '<div class="um-single-image-upload" data-nonce="' . $nonce . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
|
||||
|
||||
$output .= '<div class="um-single-image-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-nonce="' . $nonce . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
|
||||
$output .= '<div class="um-modal-footer">
|
||||
<div class="um-modal-right">
|
||||
<a href="#" class="um-modal-btn um-finish-upload image disabled" data-key="' . $key . '" data-change="' . __( 'Change photo', 'ultimate-member' ) . '" data-processing="' . __( 'Processing...', 'ultimate-member' ) . '"> ' . __( 'Apply', 'ultimate-member' ) . '</a>
|
||||
@@ -2291,65 +2272,64 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
</div>
|
||||
<div class="um-clear"></div>
|
||||
</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
/* end */
|
||||
|
||||
if ($this->is_error( $key )) {
|
||||
$output .= $this->field_error( $this->show_error( $key ) );
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
/* Single File Upload */
|
||||
case 'file':
|
||||
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '">';
|
||||
|
||||
$output .= '<input type="hidden" name="' . $key . UM()->form()->form_suffix . '" id="' . $key . UM()->form()->form_suffix . '" value="' . $this->field_value( $key, $default, $data ) . '" />';
|
||||
|
||||
if (isset( $data['label'] )) {
|
||||
$output .= $this->field_label( $label, $key, $data );
|
||||
}
|
||||
|
||||
$modal_label = ( isset( $data['label'] ) ) ? $data['label'] : __( 'Upload Photo', 'ultimate-member' );
|
||||
|
||||
$output .= '<div class="um-field-area" style="text-align: center">';
|
||||
|
||||
if ($this->field_value( $key, $default, $data )) {
|
||||
$file_field_value = $this->field_value( $key, $default, $data );
|
||||
$file_type = wp_check_filetype( $file_field_value );
|
||||
$file_info = um_user( $data['metakey']."_metadata" );
|
||||
|
||||
$extension = pathinfo( $this->field_value( $key, $default, $data ), PATHINFO_EXTENSION );
|
||||
$file_field_name = $file_field_value;
|
||||
if( isset( $file_info['original_name'] ) && ! empty( $file_info['original_name'] ) ){
|
||||
$file_field_name = $file_info['original_name'];
|
||||
}
|
||||
|
||||
$output .= '<div class="um-single-file-preview show" data-key="' . $key . '">
|
||||
<a href="#" class="cancel"><i class="um-icon-close"></i></a>
|
||||
<div class="um-single-fileinfo">
|
||||
<a href="' . um_user_uploads_uri() . $this->field_value( $key, $default, $data ) . '" target="_blank">
|
||||
<span class="icon" style="background:' . UM()->files()->get_fonticon_bg_by_ext( $extension ) . '"><i class="' . UM()->files()->get_fonticon_by_ext( $extension ) . '"></i></span>
|
||||
<span class="filename">' . $this->field_value( $key, $default, $data ) . '</span>
|
||||
if( 'register' == $this->set_mode ){
|
||||
$file_url = UM()->uploader()->get_core_temp_dir() . "/" . $this->field_value( $key, $default, $data );
|
||||
}else{
|
||||
$file_url = um_user_uploads_uri() . $this->field_value( $key, $default, $data );
|
||||
}
|
||||
|
||||
if ( file_exists( um_user_uploads_dir() . $file_field_value ) ) {
|
||||
$output .= "<div class=\"um-single-file-preview show\" data-key=\"{$key}\">
|
||||
<a href=\"#\" class=\"cancel\"><i class=\"um-icon-close\"></i></a>
|
||||
<div class=\"um-single-fileinfo\">
|
||||
<a href=\"{$file_url}\" target=\"_blank\">
|
||||
<span class=\"icon\" style=\"background:" . UM()->files()->get_fonticon_bg_by_ext( $file_type['ext'] ) . "\"><i class=\"" . UM()->files()->get_fonticon_by_ext( $file_type['ext'] ) . "\"></i></span>
|
||||
<span class=\"filename\">{$file_field_name}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div><a href="#" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . __( 'Change file', 'ultimate-member' ) . '</a>';
|
||||
</div></div>";
|
||||
} else {
|
||||
$output .= "<div class=\"um-single-file-preview show\" data-key=\"{$key}\">" . __('This file has been removed.','ultimate-member') . "</div>";
|
||||
}
|
||||
|
||||
$output .= "<a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">" . __( 'Change file', 'ultimate-member' ) . "</a>";
|
||||
} else {
|
||||
|
||||
$output .= '<div class="um-single-file-preview" data-key="' . $key . '">
|
||||
</div><a href="#" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . $button_text . '</a>';
|
||||
|
||||
$output .= "<div class=\"um-single-file-preview\" data-key=\"{$key}\">
|
||||
</div><a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">{$button_text}</a>";
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
/* modal hidden */
|
||||
$output .= '<div class="um-modal-hidden-content">';
|
||||
|
||||
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
|
||||
|
||||
$output .= '<div class="um-modal-body">';
|
||||
|
||||
if (isset( $this->set_id )) {
|
||||
$set_id = $this->set_id;
|
||||
$set_mode = $this->set_mode;
|
||||
@@ -2357,7 +2337,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$set_id = 0;
|
||||
$set_mode = '';
|
||||
}
|
||||
|
||||
$output .= '<div class="um-single-file-preview">
|
||||
<a href="#" class="cancel"><i class="um-icon-close"></i></a>
|
||||
<div class="um-single-fileinfo">
|
||||
@@ -2367,11 +2346,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
</a>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
|
||||
|
||||
$output .= '<div class="um-single-file-upload" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-nonce="' . $nonce . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
|
||||
|
||||
$output .= '<div class="um-single-file-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-nonce="' . $nonce . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
|
||||
$output .= '<div class="um-modal-footer">
|
||||
<div class="um-modal-right">
|
||||
<a href="#" class="um-modal-btn um-finish-upload file disabled" data-key="' . $key . '" data-change="' . __( 'Change file' ) . '" data-processing="' . __( 'Processing...', 'ultimate-member' ) . '"> ' . __( 'Save', 'ultimate-member' ) . '</a>
|
||||
@@ -2379,20 +2355,15 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
</div>
|
||||
<div class="um-clear"></div>
|
||||
</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
/* end */
|
||||
|
||||
if ($this->is_error( $key )) {
|
||||
$output .= $this->field_error( $this->show_error( $key ) );
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
/* Select dropdown */
|
||||
case 'select':
|
||||
@@ -2620,7 +2591,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$um_field_checkbox_item_title = $v;
|
||||
|
||||
|
||||
if (!is_numeric( $k ) && in_array( $form_key, array( 'role' ) )) {
|
||||
if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role' ) ) ||
|
||||
( $this->set_mode == 'account' || um_is_core_page( 'account' ) ) ) {
|
||||
$option_value = $k;
|
||||
$um_field_checkbox_item_title = $v;
|
||||
}
|
||||
@@ -2917,7 +2889,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$um_field_checkbox_item_title = $v;
|
||||
$option_value = $v;
|
||||
|
||||
if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role' ) ) ) {
|
||||
if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role' ) ) ||
|
||||
( $this->set_mode == 'account' || um_is_core_page( 'account' ) ) ) {
|
||||
$um_field_checkbox_item_title = $v;
|
||||
$option_value = $k;
|
||||
}
|
||||
@@ -3503,39 +3476,51 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$output = null;
|
||||
|
||||
// get whole field data
|
||||
if (is_array( $data )) {
|
||||
if ( is_array( $data ) ) {
|
||||
$data = $this->get_field( $key );
|
||||
extract( $data );
|
||||
|
||||
if ( is_array( $data ) ) {
|
||||
extract( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset( $data['type'] )) return;
|
||||
|
||||
if (isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group') return;
|
||||
|
||||
if ( $visibility == 'edit' ) return;
|
||||
|
||||
//invisible on profile page
|
||||
if ( $type == 'password' ) return;
|
||||
|
||||
if ( in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
$_field_value = $this->field_value( $key, $default, $data );
|
||||
|
||||
if ( ! isset($_field_value) || $_field_value == '') return;
|
||||
}
|
||||
|
||||
if (!um_can_view_field( $data )) return;
|
||||
|
||||
// disable these fields in profile view only
|
||||
if (in_array( $key, array( 'user_password' ) ) && $this->set_mode == 'profile') {
|
||||
//hide if empty type
|
||||
if ( ! isset( $data['type'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!um_field_conditions_are_met( $data )) return;
|
||||
if ( isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
//invisible on profile page
|
||||
if ( $visibility == 'edit' || $type == 'password' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
//hide if empty
|
||||
if ( ! in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) ) ) {
|
||||
$_field_value = $this->field_value( $key, $default, $data );
|
||||
|
||||
if ( ! isset( $_field_value ) || $_field_value == '' ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! um_can_view_field( $data ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// disable these fields in profile view only
|
||||
if ( in_array( $key, array( 'user_password' ) ) && $this->set_mode == 'profile' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! um_field_conditions_are_met( $data ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( $type ) {
|
||||
|
||||
/* Default */
|
||||
default:
|
||||
|
||||
+230
-335
@@ -70,11 +70,15 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* Remove file by AJAX
|
||||
*/
|
||||
function ajax_remove_file() {
|
||||
UM()->check_frontend_ajax_nonce();
|
||||
|
||||
/**
|
||||
* @var $src
|
||||
*/
|
||||
extract( $_REQUEST );
|
||||
$this->delete_file( $src );
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
|
||||
@@ -82,33 +86,193 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* Resize image AJAX handler
|
||||
*/
|
||||
function ajax_resize_image() {
|
||||
$output = 0;
|
||||
UM()->check_frontend_ajax_nonce();
|
||||
|
||||
/**
|
||||
* @var $key
|
||||
* @var $src
|
||||
* @var $coord
|
||||
* @var $user_id
|
||||
*/
|
||||
extract( $_REQUEST );
|
||||
|
||||
if ( !isset($src) || !isset($coord) ) die( __('Invalid parameters') );
|
||||
|
||||
$coord_n = substr_count($coord, ",");
|
||||
if ( $coord_n != 3 ) die( __('Invalid coordinates') );
|
||||
|
||||
$um_is_temp_image = um_is_temp_image( $src );
|
||||
if ( !$um_is_temp_image ) die( __('Invalid Image file') );
|
||||
|
||||
$crop = explode(',', $coord );
|
||||
$crop = array_map('intval', $crop);
|
||||
|
||||
$uri = UM()->files()->resize_image( $um_is_temp_image, $crop );
|
||||
|
||||
// If you're updating a user
|
||||
if ( isset( $user_id ) && $user_id > 0 ) {
|
||||
$uri = UM()->files()->new_user_upload( $user_id, $um_is_temp_image, $key );
|
||||
if ( ! isset( $src ) || ! isset( $coord ) ) {
|
||||
wp_send_json_error( esc_js( __( 'Invalid parameters', 'ultimate-member' ) ) );
|
||||
}
|
||||
|
||||
$output = $uri;
|
||||
$coord_n = substr_count( $coord, "," );
|
||||
if ( $coord_n != 3 ) {
|
||||
wp_send_json_error( esc_js( __( 'Invalid coordinates', 'ultimate-member' ) ) );
|
||||
}
|
||||
|
||||
$image_path = um_is_file_owner( $src, $user_id, true );
|
||||
if ( ! $image_path ) {
|
||||
wp_send_json_error( esc_js( __( 'Invalid file ownership', 'ultimate-member' ) ) );
|
||||
}
|
||||
|
||||
$output = UM()->uploader()->resize_image( $image_path, $src, $key, $user_id, $coord );
|
||||
|
||||
delete_option( "um_cache_userdata_{$user_id}" );
|
||||
|
||||
if(is_array($output)){ print_r($output); }else{ echo $output; } die;
|
||||
wp_send_json_success( $output );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Image upload by AJAX
|
||||
*/
|
||||
function ajax_image_upload() {
|
||||
$ret['error'] = null;
|
||||
$ret = array();
|
||||
|
||||
$id = $_POST['key'];
|
||||
$timestamp = $_POST['timestamp'];
|
||||
$nonce = $_POST['_wpnonce'];
|
||||
$user_id = $_POST['user_id'];
|
||||
|
||||
UM()->fields()->set_id = $_POST['set_id'];
|
||||
UM()->fields()->set_mode = $_POST['set_mode'];
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_image_upload_nonce
|
||||
* @description Change Image Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$nonce","type":"bool","desc":"Nonce"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_image_upload_nonce', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_image_upload_nonce', 'my_image_upload_nonce', 10, 1 );
|
||||
* function my_image_upload_nonce( $nonce ) {
|
||||
* // your code here
|
||||
* return $nonce;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_image_upload_nonce = apply_filters("um_image_upload_nonce", true );
|
||||
|
||||
if( $um_image_upload_nonce ){
|
||||
if ( ! wp_verify_nonce( $nonce, "um_upload_nonce-{$timestamp}" ) && is_user_logged_in() ) {
|
||||
// This nonce is not valid.
|
||||
$ret['error'] = 'Invalid nonce';
|
||||
wp_send_json_error( $ret );
|
||||
}
|
||||
}
|
||||
|
||||
if( isset( $_FILES[ $id ]['name'] ) ) {
|
||||
|
||||
if( ! is_array( $_FILES[ $id ]['name'] ) ) {
|
||||
|
||||
$uploaded = UM()->uploader()->upload_image( $_FILES[ $id ], $user_id, $id );
|
||||
if ( isset( $uploaded['error'] ) ){
|
||||
|
||||
$ret['error'] = $uploaded['error'];
|
||||
|
||||
}else{
|
||||
$ts = current_time( 'timestamp' );
|
||||
$ret[ ] = $uploaded['handle_upload'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$ret['error'] = __('A theme or plugin compatibility issue','ultimate-member');
|
||||
}
|
||||
wp_send_json_success( $ret );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* File upload by AJAX
|
||||
*/
|
||||
function ajax_file_upload() {
|
||||
$ret['error'] = null;
|
||||
$ret = array();
|
||||
|
||||
/* commented for enable download files on registration form
|
||||
* if ( ! is_user_logged_in() ) {
|
||||
$ret['error'] = 'Invalid user';
|
||||
die( json_encode( $ret ) );
|
||||
}*/
|
||||
|
||||
$nonce = $_POST['_wpnonce'];
|
||||
$id = $_POST['key'];
|
||||
$timestamp = $_POST['timestamp'];
|
||||
|
||||
UM()->fields()->set_id = $_POST['set_id'];
|
||||
UM()->fields()->set_mode = $_POST['set_mode'];
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_file_upload_nonce
|
||||
* @description Change File Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$nonce","type":"bool","desc":"Nonce"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_file_upload_nonce', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_file_upload_nonce', 'my_file_upload_nonce', 10, 1 );
|
||||
* function my_file_upload_nonce( $nonce ) {
|
||||
* // your code here
|
||||
* return $nonce;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_file_upload_nonce = apply_filters("um_file_upload_nonce", true );
|
||||
|
||||
if ( $um_file_upload_nonce ) {
|
||||
if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in() ) {
|
||||
// This nonce is not valid.
|
||||
$ret['error'] = 'Invalid nonce';
|
||||
wp_send_json_error( $ret );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( isset( $_FILES[ $id ]['name'] ) ) {
|
||||
|
||||
if ( ! is_array( $_FILES[ $id ]['name'] ) ) {
|
||||
|
||||
$user_id = $_POST['user_id'];
|
||||
|
||||
$uploaded = UM()->uploader()->upload_file( $_FILES[ $id ], $user_id, $id );
|
||||
if ( isset( $uploaded['error'] ) ){
|
||||
|
||||
$ret['error'] = $uploaded['error'];
|
||||
|
||||
}else{
|
||||
|
||||
$uploaded_file = $uploaded['handle_upload'];
|
||||
$ret['url'] = $uploaded_file['file_info']['name'];
|
||||
$ret['icon'] = UM()->files()->get_fonticon_by_ext( $uploaded_file['file_info']['ext'] );
|
||||
$ret['icon_bg'] = UM()->files()->get_fonticon_bg_by_ext( $uploaded_file['file_info']['ext'] );
|
||||
$ret['filename'] = $uploaded_file['file_info']['basename'];
|
||||
$ret['original_name'] = $uploaded_file['file_info']['original_name'];
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$ret['error'] = __('A theme or plugin compatibility issue','ultimate-member');
|
||||
}
|
||||
|
||||
|
||||
wp_send_json_success( $ret );
|
||||
}
|
||||
|
||||
|
||||
@@ -331,6 +495,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
function path_only( $file ) {
|
||||
|
||||
return trailingslashit( dirname( $file ) );
|
||||
}
|
||||
|
||||
@@ -457,6 +622,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* @param $destination
|
||||
*/
|
||||
function upload_temp_file( $source, $destination ) {
|
||||
|
||||
move_uploaded_file( $source, $destination );
|
||||
}
|
||||
|
||||
@@ -553,159 +719,63 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function get_image_data( $file ) {
|
||||
function get_image_data( $file ) {
|
||||
|
||||
$finfo = finfo_open( FILEINFO_MIME_TYPE );
|
||||
|
||||
$mime_type = finfo_file( $finfo, $file );
|
||||
|
||||
if( function_exists('exif_imagetype') ){
|
||||
|
||||
$array_exif_image_mimes = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG );
|
||||
|
||||
$allowed_types = apply_filters('um_image_upload_allowed_exif_mimes', $array_exif_image_mimes );
|
||||
|
||||
if( ! in_array( @exif_imagetype( $file ), $allowed_types ) ) {
|
||||
|
||||
$array['invalid_image'] = true;
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$array_image_mimes = array('image/jpeg','image/png','image/gif');
|
||||
|
||||
$allowed_types = apply_filters('um_image_upload_allowed_mimes', $array_image_mimes );
|
||||
|
||||
if ( ! in_array( $mime_type, $allowed_types ) ) {
|
||||
|
||||
$array['invalid_image'] = true;
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$array['size'] = filesize( $file );
|
||||
|
||||
$array['image'] = @getimagesize( $file );
|
||||
$image_data = @getimagesize( $file );
|
||||
|
||||
if ( $array['image'] > 0 ) {
|
||||
$array['image'] = $image_data;
|
||||
|
||||
$array['invalid_image'] = false;
|
||||
$array['invalid_image'] = false;
|
||||
|
||||
list($width, $height, $type, $attr) = @getimagesize( $file );
|
||||
list($width, $height, $type, $attr) = $image_data;
|
||||
|
||||
$array['width'] = $width;
|
||||
$array['height'] = $height;
|
||||
$array['ratio'] = $width / $height;
|
||||
$array['width'] = $width;
|
||||
|
||||
$array['extension'] = $this->get_extension_by_mime_type( $array['image']['mime'] );
|
||||
$array['height'] = $height;
|
||||
|
||||
$array['ratio'] = $width / $height;
|
||||
|
||||
} else {
|
||||
$array['extension'] = $this->get_extension_by_mime_type( $mime_type );
|
||||
|
||||
$array['invalid_image'] = true;
|
||||
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check image upload and handle errors
|
||||
*
|
||||
* @param $file
|
||||
* @param $field
|
||||
*
|
||||
* @return null|string|void
|
||||
*/
|
||||
function check_image_upload( $file, $field ) {
|
||||
$error = null;
|
||||
|
||||
$fileinfo = $this->get_image_data( $file );
|
||||
$data = UM()->fields()->get_field( $field );
|
||||
|
||||
if ( $data == null ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_custom_image_handle_{$field}
|
||||
* @description Custom image handle
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Image Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_custom_image_handle_{$field}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_custom_image_handle_{$field}', 'my_custom_image_handle', 10, 1 );
|
||||
* function my_custom_image_handle( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters( "um_custom_image_handle_{$field}", array() );
|
||||
if ( ! $data ) {
|
||||
$error = __( 'This media type is not recognized.', 'ultimate-member' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_image_handle_global__option
|
||||
* @description Custom image global handle
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Image Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_image_handle_global__option', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_image_handle_global__option', 'my_image_handle_global', 10, 1 );
|
||||
* function my_image_handle_global( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters("um_image_handle_global__option", $data );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_image_handle_{$field}__option
|
||||
* @description Custom image handle for each $field
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Image Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_image_handle_{$field}__option', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_image_handle_{$field}__option', 'my_image_handle', 10, 1 );
|
||||
* function my_image_handle( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters( "um_image_handle_{$field}__option", $data );
|
||||
|
||||
if ( $fileinfo['invalid_image'] == true ) {
|
||||
$error = sprintf(__('Your image is invalid or too large!','ultimate-member') );
|
||||
} elseif ( isset( $data['allowed_types'] ) && !$this->in_array( $fileinfo['extension'], $data['allowed_types'] ) ) {
|
||||
$error = ( isset( $data['extension_error'] ) && !empty( $data['extension_error'] ) ) ? $data['extension_error'] : 'not allowed';
|
||||
} elseif ( isset($data['min_size']) && ( $fileinfo['size'] < $data['min_size'] ) ) {
|
||||
$error = $data['min_size_error'];
|
||||
} elseif ( isset($data['min_width']) && ( $fileinfo['width'] < $data['min_width'] ) ) {
|
||||
$error = sprintf(__('Your photo is too small. It must be at least %spx wide.','ultimate-member'), $data['min_width']);
|
||||
} elseif ( isset($data['min_height']) && ( $fileinfo['height'] < $data['min_height'] ) ) {
|
||||
$error = sprintf(__('Your photo is too small. It must be at least %spx wide.','ultimate-member'), $data['min_height']);
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check file upload and handle errors
|
||||
*
|
||||
* @param $file
|
||||
* @param $extension
|
||||
* @param $field
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
function check_file_upload( $file, $extension, $field ) {
|
||||
$error = null;
|
||||
|
||||
$fileinfo = $this->get_file_data( $file );
|
||||
$data = UM()->fields()->get_field( $field );
|
||||
|
||||
if ( !$this->in_array( $extension, $data['allowed_types'] ) ) {
|
||||
$error = ( isset( $data['extension_error'] ) && !empty( $data['extension_error'] ) ) ? $data['extension_error'] : 'not allowed';
|
||||
} elseif ( isset($data['min_size']) && ( $fileinfo['size'] < $data['min_size'] ) ) {
|
||||
$error = $data['min_size_error'];
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If a value exists in comma seperated list
|
||||
*
|
||||
@@ -714,7 +784,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function in_array( $value, $array ){
|
||||
function in_array( $value, $array ) {
|
||||
|
||||
if ( in_array( $value, explode(',', $array ) ) ){
|
||||
return true;
|
||||
@@ -777,7 +847,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
*/
|
||||
do_action( "um_after_remove_{$type}", $user_id );
|
||||
|
||||
$dir = $this->upload_basedir . $user_id . '/';
|
||||
$dir = $this->upload_basedir . $user_id . DIRECTORY_SEPARATOR;
|
||||
$prefix = $type;
|
||||
chdir($dir);
|
||||
$matches = glob($prefix.'*',GLOB_MARK);
|
||||
@@ -792,6 +862,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
rmdir( $dir );
|
||||
}
|
||||
|
||||
UM()->user()->remove_cache( $user_id );
|
||||
}
|
||||
|
||||
|
||||
@@ -1146,181 +1217,5 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Image upload by AJAX
|
||||
*/
|
||||
function ajax_image_upload() {
|
||||
$ret['error'] = null;
|
||||
$ret = array();
|
||||
|
||||
$id = $_POST['key'];
|
||||
$timestamp = $_POST['timestamp'];
|
||||
$nonce = $_POST['_wpnonce'];
|
||||
|
||||
UM()->fields()->set_id = $_POST['set_id'];
|
||||
UM()->fields()->set_mode = $_POST['set_mode'];
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_image_upload_nonce
|
||||
* @description Change Image Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$nonce","type":"bool","desc":"Nonce"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_image_upload_nonce', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_image_upload_nonce', 'my_image_upload_nonce', 10, 1 );
|
||||
* function my_image_upload_nonce( $nonce ) {
|
||||
* // your code here
|
||||
* return $nonce;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_image_upload_nonce = apply_filters("um_image_upload_nonce", true );
|
||||
|
||||
if( $um_image_upload_nonce ){
|
||||
if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in() ) {
|
||||
// This nonce is not valid.
|
||||
$ret['error'] = 'Invalid nonce';
|
||||
die( json_encode( $ret ) );
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_FILES[$id]['name'])) {
|
||||
|
||||
if(!is_array($_FILES[$id]['name'])) {
|
||||
|
||||
$temp = $_FILES[$id]["tmp_name"];
|
||||
$file = $id."-".$_FILES[$id]["name"];
|
||||
$file = sanitize_file_name($file);
|
||||
$ext = strtolower( pathinfo($file, PATHINFO_EXTENSION) );
|
||||
|
||||
$error = UM()->files()->check_image_upload( $temp, $id );
|
||||
if ( $error ){
|
||||
|
||||
$ret['error'] = $error;
|
||||
|
||||
} else {
|
||||
$file = "stream_photo_".md5($file)."_".uniqid().".".$ext;
|
||||
$ret[ ] = UM()->files()->new_image_upload_temp( $temp, $file, UM()->options()->get('image_compression') );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$ret['error'] = __('A theme or plugin compatibility issue','ultimate-member');
|
||||
}
|
||||
echo json_encode($ret);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function ajax_file_upload(){
|
||||
$ret['error'] = null;
|
||||
$ret = array();
|
||||
|
||||
/* commented for enable download files on registration form
|
||||
* if ( ! is_user_logged_in() ) {
|
||||
$ret['error'] = 'Invalid user';
|
||||
die( json_encode( $ret ) );
|
||||
}*/
|
||||
|
||||
$nonce = $_POST['_wpnonce'];
|
||||
$id = $_POST['key'];
|
||||
$timestamp = $_POST['timestamp'];
|
||||
|
||||
UM()->fields()->set_id = $_POST['set_id'];
|
||||
UM()->fields()->set_mode = $_POST['set_mode'];
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_file_upload_nonce
|
||||
* @description Change File Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$nonce","type":"bool","desc":"Nonce"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_file_upload_nonce', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_file_upload_nonce', 'my_file_upload_nonce', 10, 1 );
|
||||
* function my_file_upload_nonce( $nonce ) {
|
||||
* // your code here
|
||||
* return $nonce;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_file_upload_nonce = apply_filters("um_file_upload_nonce", true );
|
||||
|
||||
if ( $um_file_upload_nonce ) {
|
||||
if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in()) {
|
||||
// This nonce is not valid.
|
||||
$ret['error'] = 'Invalid nonce';
|
||||
die( json_encode( $ret ) );
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_FILES[$id]['name'])) {
|
||||
|
||||
if(!is_array($_FILES[$id]['name'])) {
|
||||
|
||||
$temp = $_FILES[$id]["tmp_name"];
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_upload_file_name
|
||||
* @description Change File Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$filename","type":"string","desc":"Filename"},
|
||||
* {"var":"$id","type":"int","desc":"ID"},
|
||||
* {"var":"$name","type":"string","desc":"Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_upload_file_name', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_upload_file_name', 'my_upload_file_name', 10, 3 );
|
||||
* function my_upload_file_name( $filename, $id, $name ) {
|
||||
* // your code here
|
||||
* return $filename;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$file = apply_filters( 'um_upload_file_name', $id . "-" . $_FILES[$id]["name"], $id, $_FILES[$id]["name"] );
|
||||
$file = sanitize_file_name($file);
|
||||
$extension = strtolower( pathinfo($file, PATHINFO_EXTENSION) );
|
||||
|
||||
$error = UM()->files()->check_file_upload( $temp, $extension, $id );
|
||||
if ( $error ){
|
||||
$ret['error'] = $error;
|
||||
} else {
|
||||
$ret[] = UM()->files()->new_file_upload_temp( $temp, $file );
|
||||
$ret['icon'] = UM()->files()->get_fonticon_by_ext( $extension );
|
||||
$ret['icon_bg'] = UM()->files()->get_fonticon_bg_by_ext( $extension );
|
||||
$ret['filename'] = $file;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$ret['error'] = __('A theme or plugin compatibility issue','ultimate-member');
|
||||
}
|
||||
echo json_encode($ret);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
*/
|
||||
function ajax_select_options() {
|
||||
|
||||
|
||||
$arr_options = array();
|
||||
$arr_options['status'] = 'success';
|
||||
$arr_options['post'] = $_POST;
|
||||
@@ -96,57 +97,66 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
$form_fields = UM()->fields()->get_fields();
|
||||
$arr_options['fields'] = $form_fields;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_ajax_select_options__debug_mode
|
||||
* @description Activate debug mode for AJAX select options
|
||||
* @input_vars
|
||||
* [{"var":"$debug_mode","type":"bool","desc":"Enable Debug mode"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_ajax_select_options__debug_mode', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_ajax_select_options__debug_mode', 'my_ajax_select_options__debug_mode', 10, 1 );
|
||||
* function my_ajax_select_options__debug_mode( $debug_mode ) {
|
||||
* // your code here
|
||||
* return $debug_mode;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$debug = apply_filters('um_ajax_select_options__debug_mode', false );
|
||||
if( $debug ){
|
||||
$arr_options['debug'] = array(
|
||||
$_POST,
|
||||
$form_fields,
|
||||
);
|
||||
}
|
||||
|
||||
if( isset( $_POST['child_callback'] ) && ! empty( $_POST['child_callback'] ) && isset( $form_fields[ $_POST['child_name'] ] ) ){
|
||||
|
||||
if ( $arr_options['post']['members_directory'] == 'yes' ) {
|
||||
$ajax_source_func = $_POST['child_callback'];
|
||||
|
||||
// If the requested callback function is added in the form or added in the field option, execute it with call_user_func.
|
||||
if( isset( $form_fields[ $_POST['child_name'] ]['custom_dropdown_options_source'] ) &&
|
||||
! empty( $form_fields[ $_POST['child_name'] ]['custom_dropdown_options_source'] ) &&
|
||||
$form_fields[ $_POST['child_name'] ]['custom_dropdown_options_source'] == $ajax_source_func ){
|
||||
|
||||
$arr_options['field'] = $form_fields[ $_POST['child_name'] ];
|
||||
if( function_exists( $ajax_source_func ) ){
|
||||
$arr_options['items'] = call_user_func( $ajax_source_func, $arr_options['field']['parent_dropdown_relationship'] );
|
||||
}
|
||||
|
||||
}else{
|
||||
$arr_options['status'] = 'error';
|
||||
$arr_options['message'] = __( 'This is not possible for security reasons.','ultimate-member');
|
||||
if( function_exists( $ajax_source_func ) ){
|
||||
$arr_options['items'] = call_user_func( $ajax_source_func, $arr_options['field']['parent_dropdown_relationship'] );
|
||||
wp_send_json( $arr_options );
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_ajax_select_options__debug_mode
|
||||
* @description Activate debug mode for AJAX select options
|
||||
* @input_vars
|
||||
* [{"var":"$debug_mode","type":"bool","desc":"Enable Debug mode"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_ajax_select_options__debug_mode', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_ajax_select_options__debug_mode', 'my_ajax_select_options__debug_mode', 10, 1 );
|
||||
* function my_ajax_select_options__debug_mode( $debug_mode ) {
|
||||
* // your code here
|
||||
* return $debug_mode;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$debug = apply_filters('um_ajax_select_options__debug_mode', false );
|
||||
if( $debug ){
|
||||
$arr_options['debug'] = array(
|
||||
$_POST,
|
||||
$form_fields,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
if( isset( $_POST['child_callback'] ) && ! empty( $_POST['child_callback'] ) && isset( $form_fields[ $_POST['child_name'] ] ) ){
|
||||
|
||||
wp_send_json( $arr_options );
|
||||
$ajax_source_func = $_POST['child_callback'];
|
||||
|
||||
// If the requested callback function is added in the form or added in the field option, execute it with call_user_func.
|
||||
if ( isset( $form_fields[ $_POST['child_name'] ]['custom_dropdown_options_source'] ) &&
|
||||
! empty( $form_fields[ $_POST['child_name'] ]['custom_dropdown_options_source'] ) &&
|
||||
$form_fields[ $_POST['child_name'] ]['custom_dropdown_options_source'] == $ajax_source_func ) {
|
||||
|
||||
$arr_options['field'] = $form_fields[ $_POST['child_name'] ];
|
||||
|
||||
if( function_exists( $ajax_source_func ) ){
|
||||
$arr_options['items'] = call_user_func( $ajax_source_func, $arr_options['field']['parent_dropdown_relationship'] );
|
||||
}
|
||||
|
||||
} else {
|
||||
$arr_options['status'] = 'error';
|
||||
$arr_options['message'] = __( 'This is not possible for security reasons.','ultimate-member');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
wp_send_json( $arr_options );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +322,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
|
||||
|
||||
if ( ! empty( $role ) &&
|
||||
( ! in_array( $role , $custom_field_roles ) || in_array( $role , $exclude_roles ) ) ) {
|
||||
( ! in_array( $role , $custom_field_roles ) || in_array( $role , $exclude_roles ) ) ) {
|
||||
wp_die( __( 'This is not possible for security reasons.','ultimate-member') );
|
||||
}
|
||||
|
||||
|
||||
@@ -88,14 +88,14 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prepare filter data
|
||||
*
|
||||
* @param $filter
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
function prepare_filter( $filter ) {
|
||||
$fields = UM()->builtin()->all_user_fields;
|
||||
$fields = UM()->builtin()->all_user_fields;
|
||||
|
||||
if ( isset( $fields[ $filter ] ) ) {
|
||||
$attrs = $fields[ $filter ];
|
||||
@@ -223,7 +223,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
}
|
||||
|
||||
return compact( 'type', 'attrs' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show filter
|
||||
@@ -231,11 +231,11 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
* @param $filter
|
||||
*/
|
||||
function show_filter( $filter ) {
|
||||
/**
|
||||
* @var $type
|
||||
* @var $attrs
|
||||
*/
|
||||
extract( $this->prepare_filter( $filter ) );
|
||||
/**
|
||||
* @var $type
|
||||
* @var $attrs
|
||||
*/
|
||||
extract( $this->prepare_filter( $filter ) );
|
||||
|
||||
switch ( $type ) {
|
||||
|
||||
@@ -243,9 +243,9 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
|
||||
?>
|
||||
|
||||
<select name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" class="um-s1" style="width: 100%" data-placeholder="<?php echo __( stripslashes( $attrs['label'] ), 'ultimate-member' ); ?>" <?php if ( ! empty( $attrs['custom_dropdown_options_source'] ) ) { ?> data-um-ajax-source="<?php echo $attrs['custom_dropdown_options_source'] ?>"<?php } ?>>
|
||||
<select name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" class="um-s1" style="width: 100%" data-placeholder="<?php echo __( stripslashes( $attrs['label'] ), 'ultimate-member' ); ?>" <?php if ( ! empty( $attrs['custom_dropdown_options_source'] ) ) { ?> data-um-parent="<?php echo $attrs['parent_dropdown_relationship']; ?>" data-mebers-directory="yes" data-um-ajax-source="<?php echo $attrs['custom_dropdown_options_source'] ?>"<?php } ?>>
|
||||
|
||||
<option></option>
|
||||
<option></option>
|
||||
|
||||
<?php foreach ( $attrs['options'] as $k => $v ) {
|
||||
|
||||
@@ -259,13 +259,14 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
if ( isset( $attrs['custom'] ) )
|
||||
$opt = $k;
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<option value="<?php echo $opt; ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?>><?php echo __( $v, 'ultimate-member'); ?></option>
|
||||
<option value="<?php echo $opt; ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?> <?php selected( isset( $_GET[$filter] ) && $_GET[$filter] == $v ) ?>><?php echo __( $v, 'ultimate-member'); ?></option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</select>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -275,7 +276,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
|
||||
?>
|
||||
|
||||
<input type="text" autocomplete="off" name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" placeholder="<?php echo isset( $attrs['label'] ) ? __( $attrs['label'], 'ultimate-member') : ''; ?>" value='<?php echo esc_attr( um_queried_search_value( $filter, false ) ); ?>' />
|
||||
<input type="text" autocomplete="off" name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" placeholder="<?php echo isset( $attrs['label'] ) ? __( $attrs['label'], 'ultimate-member') : ''; ?>" value='<?php echo esc_attr( um_queried_search_value( $filter, false ) ); ?>' />
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
@@ -384,19 +384,25 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Get editable UM user roles
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_editable_user_roles() {
|
||||
// User has roles so look for a UM Role one
|
||||
$um_roles_keys = get_option( 'um_roles' );
|
||||
$default_roles = array( 'subscriber' );
|
||||
|
||||
if ( ! empty( $um_roles_keys ) ) {
|
||||
// User has roles so look for a UM Role one
|
||||
$um_roles_keys = get_option( 'um_roles', array() );
|
||||
|
||||
if ( ! empty( $um_roles_keys ) && is_array( $um_roles_keys ) ) {
|
||||
$um_roles_keys = array_map( function( $item ) {
|
||||
return 'um_' . $item;
|
||||
}, $um_roles_keys );
|
||||
|
||||
return array_merge( $um_roles_keys, $default_roles );
|
||||
}
|
||||
|
||||
return array_merge( $um_roles_keys, array( 'subscriber' ) );
|
||||
return $default_roles;
|
||||
}
|
||||
|
||||
|
||||
@@ -584,16 +590,25 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
||||
|
||||
switch( $cap ) {
|
||||
case 'edit':
|
||||
if ( get_current_user_id() == $user_id && um_user( 'can_edit_profile' ) )
|
||||
$return = 1;
|
||||
elseif ( get_current_user_id() == $user_id && ! um_user( 'can_edit_profile' ) )
|
||||
$return = 0;
|
||||
elseif ( um_user( 'can_edit_everyone' ) )
|
||||
$return = 1;
|
||||
elseif ( ! um_user( 'can_edit_everyone' ) )
|
||||
$return = 0;
|
||||
elseif ( um_user( 'can_edit_roles' ) && ( empty( $current_user_roles ) || count( array_intersect( $current_user_roles, um_user( 'can_edit_roles' ) ) ) <= 0 ) )
|
||||
$return = 0;
|
||||
|
||||
if ( get_current_user_id() == $user_id ) {
|
||||
if ( um_user( 'can_edit_profile' ) ) {
|
||||
$return = 1;
|
||||
} else {
|
||||
$return = 0;
|
||||
}
|
||||
} else {
|
||||
if ( ! um_user( 'can_edit_everyone' ) ) {
|
||||
$return = 0;
|
||||
} else {
|
||||
if ( um_user( 'can_edit_roles' ) && ( empty( $current_user_roles ) || count( array_intersect( $current_user_roles, um_user( 'can_edit_roles' ) ) ) <= 0 ) ) {
|
||||
$return = 0;
|
||||
} else {
|
||||
$return = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -313,7 +313,10 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* @param $user_id
|
||||
* Generate User Profile Slug and seve to meta
|
||||
*
|
||||
* @param int $user_id
|
||||
* @param bool $force
|
||||
*/
|
||||
function generate_profile_slug( $user_id, $force = false ) {
|
||||
$userdata = get_userdata( $user_id );
|
||||
@@ -406,6 +409,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$user_in_url = trim( $user_in_url, $separate );
|
||||
}
|
||||
|
||||
$user_in_url = apply_filters( 'um_change_user_profile_slug', $user_in_url, $user_id );
|
||||
|
||||
if ( $force || empty( $current_profile_slug ) || $current_profile_slug != $user_in_url ) {
|
||||
update_user_meta( $user_id, "um_user_profile_url_slug_{$permalink_base}", $user_in_url );
|
||||
}
|
||||
@@ -1572,7 +1577,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
* @param $user_id
|
||||
* @param $case
|
||||
*
|
||||
* @return bool|mixed|void
|
||||
* @return bool
|
||||
*/
|
||||
function is_private_case( $user_id, $case ) {
|
||||
$privacy = get_user_meta( $user_id, 'profile_privacy', true );
|
||||
@@ -1884,6 +1889,5 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
return $hash_email_address;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
function um_members_directory_search( $args ) {
|
||||
$search_filters = array();
|
||||
|
||||
|
||||
if ( isset($args['search_fields']) ) {
|
||||
foreach( $args['search_fields'] as $k => $testfilter ){
|
||||
if ($testfilter && !in_array( $testfilter, (array)$search_filters ) ) {
|
||||
@@ -51,46 +51,47 @@ function um_members_directory_search( $args ) {
|
||||
|
||||
<div class="um-search um-search-<?php echo $count; ?>">
|
||||
|
||||
<form method="get" action="" />
|
||||
|
||||
<?php if ( isset( $_REQUEST['page_id'] ) && get_option('permalink_structure') == 0 ) { ?>
|
||||
|
||||
<input type="hidden" name="page_id" id="page_id" value="<?php echo esc_attr( $_REQUEST['page_id']); ?>" />
|
||||
|
||||
<?php }
|
||||
<form method="get" action="">
|
||||
|
||||
$i = 0;
|
||||
foreach( $search_filters as $filter ) {
|
||||
$i++;
|
||||
|
||||
if ( $i % 2 == 0 ) {
|
||||
$add_class = 'um-search-filter-2';
|
||||
} else {
|
||||
$add_class = '';
|
||||
}
|
||||
|
||||
echo '<div class="um-search-filter '. $add_class .'">'; UM()->members()->show_filter( $filter ); echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-clear"></div>
|
||||
|
||||
<div class="um-search-submit">
|
||||
<?php if ( isset( $_REQUEST['page_id'] ) && get_option('permalink_structure') == 0 ) { ?>
|
||||
|
||||
<input type="hidden" name="page_id" id="page_id" value="<?php echo esc_attr( $_REQUEST['page_id']); ?>" />
|
||||
|
||||
<?php }
|
||||
|
||||
$i = 0;
|
||||
foreach ( $search_filters as $filter ) {
|
||||
$i++;
|
||||
|
||||
if ( $i % 2 == 0 ) {
|
||||
$add_class = 'um-search-filter-2';
|
||||
} else {
|
||||
$add_class = '';
|
||||
} ?>
|
||||
|
||||
<div class="um-search-filter <?php echo $add_class ?>">
|
||||
<?php UM()->members()->show_filter( $filter ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="um-clear"></div>
|
||||
|
||||
<div class="um-search-submit">
|
||||
|
||||
<input type="hidden" name="um_search" id="um_search" value="1" />
|
||||
|
||||
<a href="#" class="um-button um-do-search"><?php _e('Search','ultimate-member'); ?></a>
|
||||
<a href="<?php echo UM()->permalinks()->get_current_url( true ); ?>" class="um-button um-alt"><?php _e('Reset','ultimate-member'); ?></a>
|
||||
|
||||
</div>
|
||||
<div class="um-clear"></div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="um_search" id="um_search" value="1" />
|
||||
|
||||
<a href="#" class="um-button um-do-search"><?php _e('Search','ultimate-member'); ?></a><a href="<?php echo UM()->permalinks()->get_current_url( true ); ?>" class="um-button um-alt"><?php _e('Reset','ultimate-member'); ?></a>
|
||||
|
||||
</div><div class="um-clear"></div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'um_members_directory_search', 'um_members_directory_search' );
|
||||
@@ -115,7 +116,7 @@ add_action( 'um_pre_directory_shortcode', 'um_pre_directory_shortcode' );
|
||||
*/
|
||||
function um_members_directory_head( $args ) {
|
||||
extract( $args );
|
||||
|
||||
|
||||
if ( isset($_REQUEST['um_search']) ) {
|
||||
$is_filtering = 1;
|
||||
} else if ( UM()->is_filtering == 1 ) {
|
||||
@@ -123,15 +124,15 @@ function um_members_directory_head( $args ) {
|
||||
} else {
|
||||
$is_filtering = 0;
|
||||
}
|
||||
|
||||
|
||||
if ( um_members('header') && $is_filtering && um_members('users_per_page') ) { ?>
|
||||
|
||||
|
||||
<div class="um-members-intro">
|
||||
|
||||
|
||||
<div class="um-members-total"><?php echo ( um_members('total_users') > 1 ) ? um_members('header') : um_members('header_single'); ?></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php }
|
||||
}
|
||||
add_action( 'um_members_directory_head', 'um_members_directory_head' );
|
||||
@@ -148,71 +149,71 @@ function um_members_directory_pagination( $args ) {
|
||||
|
||||
if ( isset( $args['search'] ) && $args['search'] == 1 && isset( $args['must_search'] ) && $args['must_search'] == 1 && !isset( $_REQUEST['um_search'] ) )
|
||||
return;
|
||||
|
||||
|
||||
if ( um_members('total_pages') > 1 ) { // needs pagination
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-members-pagidrop uimob340-show uimob500-show">
|
||||
|
||||
|
||||
<div class="um-members-pagidrop uimob340-show uimob500-show">
|
||||
|
||||
<?php _e('Jump to page:','ultimate-member'); ?>
|
||||
|
||||
|
||||
<?php if ( um_members('pages_to_show') && is_array( um_members('pages_to_show') ) ) { ?>
|
||||
<select onChange="window.location.href=this.value" class="um-s2" style="width: 100px">
|
||||
<select onChange="window.location.href=this.value" class="um-s2" style="width: 100px">
|
||||
<?php foreach( um_members('pages_to_show') as $i ) { ?>
|
||||
<option value="<?php echo UM()->permalinks()->add_query( 'members_page', $i ); ?>" <?php selected($i, um_members('page')); ?>><?php printf(__('%s of %d','ultimate-member'), $i, um_members('total_pages') ); ?></option>
|
||||
<option value="<?php echo UM()->permalinks()->add_query( 'members_page', $i ); ?>" <?php selected($i, um_members('page')); ?>><?php printf(__('%s of %d','ultimate-member'), $i, um_members('total_pages') ); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</select>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-members-pagi uimob340-hide uimob500-hide">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-members-pagi uimob340-hide uimob500-hide">
|
||||
|
||||
<?php if ( um_members('page') != 1 ) { ?>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('First Page','ultimate-member'); ?>"><i class="um-faicon-angle-double-left"></i></a>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('First Page','ultimate-member'); ?>"><i class="um-faicon-angle-double-left"></i></a>
|
||||
<?php } else { ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-double-left"></i></span>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-double-left"></i></span>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if ( um_members('page') > 1 ) { ?>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members('page') - 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('Previous','ultimate-member'); ?>"><i class="um-faicon-angle-left"></i></a>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members('page') - 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('Previous','ultimate-member'); ?>"><i class="um-faicon-angle-left"></i></a>
|
||||
<?php } else { ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-left"></i></span>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-left"></i></span>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if ( um_members('pages_to_show') && is_array( um_members('pages_to_show') ) ) { ?>
|
||||
<?php foreach( um_members('pages_to_show') as $i ) { ?>
|
||||
|
||||
|
||||
<?php if ( um_members('page') == $i ) { ?>
|
||||
<span class="pagi current"><?php echo $i; ?></span>
|
||||
<span class="pagi current"><?php echo $i; ?></span>
|
||||
<?php } else { ?>
|
||||
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', $i ); ?>" class="pagi"><?php echo $i; ?></a>
|
||||
|
||||
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', $i ); ?>" class="pagi"><?php echo $i; ?></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if ( um_members('page') != um_members('total_pages') ) { ?>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members('page') + 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('Next','ultimate-member'); ?>"><i class="um-faicon-angle-right"></i></a>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members('page') + 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('Next','ultimate-member'); ?>"><i class="um-faicon-angle-right"></i></a>
|
||||
<?php } else { ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-right"></i></span>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-right"></i></span>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if ( um_members('page') != um_members('total_pages') ) { ?>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members('total_pages') ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('Last Page','ultimate-member'); ?>"><i class="um-faicon-angle-double-right"></i></a>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members('total_pages') ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('Last Page','ultimate-member'); ?>"><i class="um-faicon-angle-double-right"></i></a>
|
||||
<?php } else { ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-double-right"></i></span>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-double-right"></i></span>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
add_action( 'um_members_directory_footer', 'um_members_directory_pagination' );
|
||||
|
||||
@@ -224,30 +225,30 @@ add_action( 'um_members_directory_footer', 'um_members_directory_pagination' );
|
||||
*/
|
||||
function um_members_directory_display( $args ) {
|
||||
extract( $args );
|
||||
|
||||
|
||||
if ( isset( $args['search'] ) && $args['search'] == 1 && isset( $args['must_search'] ) && $args['must_search'] == 1 && !isset( $_REQUEST['um_search'] ) )
|
||||
return;
|
||||
|
||||
if ( um_members('no_users') ) {
|
||||
|
||||
|
||||
if ( um_members('no_users') ) {
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-members-none">
|
||||
<p><?php echo $args['no_users']; ?></p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="um-members-none">
|
||||
<p><?php echo $args['no_users']; ?></p>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
$file = um_path . 'templates/members-grid.php';
|
||||
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/members-grid.php';
|
||||
|
||||
if ( file_exists( $theme_file ) ){
|
||||
$file = $theme_file;
|
||||
}
|
||||
|
||||
include $file;
|
||||
|
||||
}
|
||||
|
||||
$file = um_path . 'templates/members-grid.php';
|
||||
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/members-grid.php';
|
||||
|
||||
if ( file_exists( $theme_file ) ){
|
||||
$file = $theme_file;
|
||||
}
|
||||
|
||||
include $file;
|
||||
|
||||
}
|
||||
add_action( 'um_members_directory_display', 'um_members_directory_display' );
|
||||
@@ -221,9 +221,6 @@ function um_user_edit_profile( $args ) {
|
||||
|
||||
foreach ( $fields as $key => $array ) {
|
||||
|
||||
/*if ( ! um_can_edit_field( $fields[ $key ] ) )
|
||||
continue;*/
|
||||
|
||||
if ( ! um_can_edit_field( $fields[ $key ] ) && isset( $fields[ $key ]['editable'] ) && ! $fields[ $key ]['editable'] )
|
||||
continue;
|
||||
|
||||
@@ -234,7 +231,7 @@ function um_user_edit_profile( $args ) {
|
||||
if ( isset( $args['submitted'][ $key ] ) ) {
|
||||
|
||||
if ( isset( $fields[ $key ]['type'] ) && in_array( $fields[ $key ]['type'], array( 'image', 'file' ) ) &&
|
||||
( um_is_temp_upload( $args['submitted'][ $key ] ) || $args['submitted'][ $key ] == 'empty_file' ) ) {
|
||||
( um_is_temp_file( $args['submitted'][ $key ] ) || $args['submitted'][ $key ] == 'empty_file' ) ) {
|
||||
|
||||
$files[ $key ] = $args['submitted'][ $key ];
|
||||
|
||||
@@ -370,49 +367,7 @@ function um_user_edit_profile( $args ) {
|
||||
$files = apply_filters( 'um_user_pre_updating_files_array', $files );
|
||||
|
||||
if ( is_array( $files ) ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_before_user_upload
|
||||
* @description Before file uploaded on complete UM user profile.
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"},
|
||||
* {"var":"$files","type":"array","desc":"Files data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_before_user_upload', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_before_user_upload', 'my_before_user_upload', 10, 2 );
|
||||
* function my_before_user_upload( $user_id, $files ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_before_user_upload', um_user( 'ID' ), $files );
|
||||
UM()->user()->update_files( $files );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_after_user_upload
|
||||
* @description After complete UM user profile edit and file uploaded.
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"},
|
||||
* {"var":"$files","type":"array","desc":"Files data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_after_user_upload', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_after_user_upload', 'my_after_user_upload', 10, 2 );
|
||||
* function my_after_user_upload( $user_id, $files ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_after_user_upload', um_user( 'ID' ), $files );
|
||||
UM()->uploader()->move_temporary_files( um_user( 'ID' ), $files );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,7 +418,6 @@ function um_user_edit_profile( $args ) {
|
||||
$url = um_user_profile_url( um_user( 'ID' ) );
|
||||
exit( wp_redirect( um_edit_my_profile_cancel_uri( $url ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'um_user_edit_profile', 'um_user_edit_profile', 10 );
|
||||
|
||||
@@ -592,14 +546,15 @@ function um_profile_header_cover_area( $args ) {
|
||||
do_action( 'um_cover_area_content', um_profile_id() );
|
||||
if ( UM()->fields()->editing ) {
|
||||
|
||||
$hide_remove = um_profile( 'cover_photo' ) ? false : ' style="display:none;"';
|
||||
|
||||
$items = array(
|
||||
'<a href="#" class="um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width">' . __( 'Change cover photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="#" class="um-reset-cover-photo" data-user_id="' . um_profile_id() . '">' . __( 'Remove', 'ultimate-member' ) . '</a>',
|
||||
'<a href="#" class="um-reset-cover-photo" data-user_id="' . um_profile_id() . '" ' . $hide_remove . '>' . __( 'Remove', 'ultimate-member' ) . '</a>',
|
||||
'<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
echo UM()->profile()->new_ui( 'bc', 'div.um-cover', 'click', $items );
|
||||
|
||||
UM()->profile()->new_ui( 'bc', 'div.um-cover', 'click', $items );
|
||||
}
|
||||
|
||||
UM()->fields()->add_hidden_field( 'cover_photo' );
|
||||
@@ -1439,33 +1394,4 @@ function um_profile_menu( $args ) {
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'um_profile_menu', 'um_profile_menu', 9 );
|
||||
|
||||
|
||||
/**
|
||||
* Clean up file for new uploaded files
|
||||
*
|
||||
* @param integer $user_id
|
||||
* @param array $arr_files
|
||||
*/
|
||||
function um_before_user_upload( $user_id, $arr_files ) {
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
foreach ( $arr_files as $key => $filename ) {
|
||||
if ( um_user( $key ) ) {
|
||||
$old_filename = um_user( $key );
|
||||
|
||||
if ( basename( $filename ) != basename( um_user( $key ) ) ||
|
||||
in_array( $old_filename, array( basename( um_user( $key ) ), basename( $filename ) ) ) ||
|
||||
$filename == 'empty_file' ) {
|
||||
|
||||
$path = UM()->files()->upload_basedir;
|
||||
delete_user_meta( $user_id, $old_filename );
|
||||
if (file_exists( $path . $user_id . '/' . $old_filename )) {
|
||||
unlink( $path . $user_id . '/' . $old_filename );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( "um_before_user_upload", "um_before_user_upload", 10, 2 );
|
||||
add_action( 'um_profile_menu', 'um_profile_menu', 9 );
|
||||
@@ -637,7 +637,7 @@ function um_registration_save_files( $user_id, $args ) {
|
||||
if ( isset( $args['submitted'][$key] ) ) {
|
||||
|
||||
if ( isset( $fields[$key]['type'] ) && in_array( $fields[$key]['type'], array( 'image', 'file' ) ) &&
|
||||
( um_is_temp_upload( $args['submitted'][$key] ) || $args['submitted'][$key] == 'empty_file' )
|
||||
( um_is_temp_file( $args['submitted'][$key] ) || $args['submitted'][$key] == 'empty_file' )
|
||||
) {
|
||||
|
||||
$files[$key] = $args['submitted'][$key];
|
||||
@@ -671,49 +671,7 @@ function um_registration_save_files( $user_id, $args ) {
|
||||
$files = apply_filters( 'um_user_pre_updating_files_array', $files );
|
||||
|
||||
if ( !empty( $files ) ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_before_user_upload
|
||||
* @description Before file uploaded on complete UM user registration.
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"},
|
||||
* {"var":"$files","type":"array","desc":"Files data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_before_user_upload', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_before_user_upload', 'my_before_user_upload', 10, 2 );
|
||||
* function my_before_user_upload( $user_id, $files ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_before_user_upload', $user_id, $files );
|
||||
UM()->user()->update_files( $files );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_after_user_upload
|
||||
* @description After complete UM user registration and file uploaded.
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"},
|
||||
* {"var":"$files","type":"array","desc":"Files data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_after_user_upload', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_after_user_upload', 'my_after_user_upload', 10, 2 );
|
||||
* function my_after_user_upload( $user_id, $files ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_after_user_upload', $user_id, $files );
|
||||
UM()->uploader()->move_temporary_files( $user_id, $files );
|
||||
}
|
||||
}
|
||||
add_action( 'um_registration_set_extra_data', 'um_registration_save_files', 10, 2 );
|
||||
|
||||
@@ -3,42 +3,6 @@
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/**
|
||||
* Clean user temp uploads
|
||||
*
|
||||
* @param $user_id
|
||||
* @param $post_array
|
||||
*/
|
||||
function um_remove_unused_uploads( $user_id, $post_array ) {
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
$user_meta_keys = UM()->user()->profile;
|
||||
|
||||
$_array = array();
|
||||
foreach ( UM()->builtin()->custom_fields as $_field ) {
|
||||
if ( $_field['type'] == 'file' && ! empty( $user_meta_keys[ $_field['metakey'] ] ) )
|
||||
$_array[] = $user_meta_keys[ $_field['metakey'] ];
|
||||
}
|
||||
$_array = array_merge( $_array, $post_array );
|
||||
|
||||
|
||||
$files = glob( um_user_uploads_dir() . '*', GLOB_BRACE );
|
||||
$error = array();
|
||||
if ( file_exists( um_user_uploads_dir() ) && $files && isset( $_array ) && is_array( $_array ) ) {
|
||||
foreach ( $files as $file ) {
|
||||
$str = basename( $file );
|
||||
|
||||
if ( ! strstr( $str, 'profile_photo' ) && ! strstr( $str, 'cover_photo' ) &&
|
||||
! strstr( $str, 'stream_photo' ) && ! preg_grep( '/' . $str . '/', $_array ) ) {
|
||||
$error[] = $str;
|
||||
unlink( $file );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'um_after_user_upload','um_remove_unused_uploads', 10, 2 );
|
||||
|
||||
|
||||
/**
|
||||
* Adds main links to a logout widget
|
||||
*
|
||||
|
||||
@@ -220,25 +220,29 @@ add_filter( 'um_profile_field_filter_hook__date', 'um_profile_field_filter_hook_
|
||||
* @param $value
|
||||
* @param $data
|
||||
*
|
||||
* @return string|void
|
||||
* @return string
|
||||
*/
|
||||
function um_profile_field_filter_hook__file( $value, $data ) {
|
||||
$uri = um_user_uploads_uri() . $value;
|
||||
$extension = pathinfo( $uri, PATHINFO_EXTENSION);
|
||||
|
||||
if ( !file_exists( um_user_uploads_dir() . $value ) ) {
|
||||
$value = __('This file has been removed.');
|
||||
$file_type = wp_check_filetype( $value );
|
||||
|
||||
if ( ! file_exists( um_user_uploads_dir() . $value ) ) {
|
||||
$value = __('This file has been removed.','ultimate-member');
|
||||
} else {
|
||||
$file_info = um_user( $data['metakey']."_metadata" );
|
||||
if( isset( $file_info['original_name'] ) && ! empty( $file_info['original_name'] ) ){
|
||||
$value = $file_info['original_name'];
|
||||
}
|
||||
$value = '<div class="um-single-file-preview show">
|
||||
<div class="um-single-fileinfo">
|
||||
<a href="' . $uri . '" target="_blank">
|
||||
<span class="icon" style="background:'. UM()->files()->get_fonticon_bg_by_ext( $extension ) . '"><i class="'. UM()->files()->get_fonticon_by_ext( $extension ) .'"></i></span>
|
||||
<span class="filename">' . $value . '</span>
|
||||
<span class="icon" style="background:'. UM()->files()->get_fonticon_bg_by_ext( $file_type['ext'] ) . '"><i class="'. UM()->files()->get_fonticon_by_ext( $file_type['ext'] ) .'"></i></span>
|
||||
<span class="filename">' . esc_attr( $value ) . '</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'um_profile_field_filter_hook__file', 'um_profile_field_filter_hook__file', 99, 2 );
|
||||
|
||||
@@ -154,7 +154,8 @@ function um_add_search_to_query( $query_args, $args ){
|
||||
) );
|
||||
|
||||
if ( in_array( $filter_data['attrs']['type'], $types ) ) {
|
||||
$field_query = array_merge( $field_query, array(
|
||||
|
||||
$arr_meta_query = array(
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => serialize( strval( trim( $value ) ) ),
|
||||
@@ -162,11 +163,24 @@ function um_add_search_to_query( $query_args, $args ){
|
||||
),
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => serialize( intval( trim( $value ) ) ),
|
||||
'value' => '"' . trim( $value ) . '"',
|
||||
'compare' => 'LIKE',
|
||||
)
|
||||
) );
|
||||
);
|
||||
|
||||
if( is_numeric( $value ) ){
|
||||
|
||||
$arr_meta_query[ ] = array(
|
||||
'key' => $field,
|
||||
'value' => serialize( intval( trim( $value ) ) ),
|
||||
'compare' => 'LIKE',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$field_query = array_merge( $field_query, $arr_meta_query );
|
||||
}
|
||||
|
||||
} else {
|
||||
$field_query = array(
|
||||
array(
|
||||
@@ -436,30 +450,33 @@ add_filter( 'um_modify_sortby_parameter', 'um_sortby_last_login', 100, 2 );
|
||||
* @return mixed
|
||||
*/
|
||||
function um_modify_sortby_randomly( $query ) {
|
||||
if( um_is_session_started() === false ){
|
||||
@session_start();
|
||||
}
|
||||
|
||||
// Reset seed on load of initial
|
||||
if( ! isset( $_REQUEST['members_page'] ) || $_REQUEST['members_page'] == 0 || $_REQUEST['members_page'] == 1 ) {
|
||||
if( isset( $_SESSION['seed'] ) ) {
|
||||
unset( $_SESSION['seed'] );
|
||||
if( 'random' == $query->query_vars["orderby"] ) {
|
||||
|
||||
if( um_is_session_started() === false ){
|
||||
@session_start();
|
||||
}
|
||||
}
|
||||
|
||||
// Get seed from session variable if it exists
|
||||
$seed = false;
|
||||
if( isset( $_SESSION['seed'] ) ) {
|
||||
$seed = $_SESSION['seed'];
|
||||
}
|
||||
|
||||
// Set new seed if none exists
|
||||
if ( ! $seed ) {
|
||||
$seed = rand();
|
||||
$_SESSION['seed'] = $seed;
|
||||
}
|
||||
// Reset seed on load of initial
|
||||
if( ! isset( $_REQUEST['members_page'] ) || $_REQUEST['members_page'] == 0 || $_REQUEST['members_page'] == 1 ) {
|
||||
if( isset( $_SESSION['seed'] ) ) {
|
||||
unset( $_SESSION['seed'] );
|
||||
}
|
||||
}
|
||||
|
||||
if($query->query_vars["orderby"] == 'random') {
|
||||
// Get seed from session variable if it exists
|
||||
$seed = false;
|
||||
if( isset( $_SESSION['seed'] ) ) {
|
||||
$seed = $_SESSION['seed'];
|
||||
}
|
||||
|
||||
// Set new seed if none exists
|
||||
if ( ! $seed ) {
|
||||
$seed = rand();
|
||||
$_SESSION['seed'] = $seed;
|
||||
}
|
||||
|
||||
|
||||
$query->query_orderby = 'ORDER by RAND('. $seed.')';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
$dirname = dirname( __FILE__ );
|
||||
do {
|
||||
$dirname = dirname( $dirname );
|
||||
$wp_config = "{$dirname}/wp-config.php";
|
||||
$wp_load = "{$dirname}/wp-load.php";
|
||||
}
|
||||
while( !file_exists( $wp_config ) );
|
||||
|
||||
if ( ! file_exists( $wp_load ) ) {
|
||||
$dirs = glob( $dirname . '/*' , GLOB_ONLYDIR );
|
||||
|
||||
foreach ( $dirs as $key => $value ) {
|
||||
$wp_load = "{$value}/wp-load.php";
|
||||
if ( file_exists( $wp_load ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require_once( $wp_load );
|
||||
|
||||
$ret['error'] = null;
|
||||
$ret = array();
|
||||
|
||||
/* commented for enable download files on registration form
|
||||
* if ( ! is_user_logged_in() ) {
|
||||
$ret['error'] = 'Invalid user';
|
||||
die( json_encode( $ret ) );
|
||||
}*/
|
||||
|
||||
$nonce = $_POST['_wpnonce'];
|
||||
$id = $_POST['key'];
|
||||
$timestamp = $_POST['timestamp'];
|
||||
|
||||
UM()->fields()->set_id = $_POST['set_id'];
|
||||
UM()->fields()->set_mode = $_POST['set_mode'];
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_file_upload_nonce
|
||||
* @description Change File Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$nonce","type":"bool","desc":"Nonce"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_file_upload_nonce', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_file_upload_nonce', 'my_file_upload_nonce', 10, 1 );
|
||||
* function my_file_upload_nonce( $nonce ) {
|
||||
* // your code here
|
||||
* return $nonce;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_file_upload_nonce = apply_filters( "um_file_upload_nonce", true );
|
||||
|
||||
if( $um_file_upload_nonce ){
|
||||
if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in()) {
|
||||
// This nonce is not valid.
|
||||
$ret['error'] = 'Invalid nonce';
|
||||
die( json_encode( $ret ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(isset($_FILES[$id]['name'])) {
|
||||
|
||||
if(!is_array($_FILES[$id]['name'])) {
|
||||
|
||||
$temp = $_FILES[$id]["tmp_name"];
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_upload_file_name
|
||||
* @description Change File Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$filename","type":"string","desc":"Filename"},
|
||||
* {"var":"$id","type":"int","desc":"ID"},
|
||||
* {"var":"$name","type":"string","desc":"Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_upload_file_name', 'function_name', 10, 3 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_upload_file_name', 'my_upload_file_name', 10, 3 );
|
||||
* function my_upload_file_name( $filename, $id, $name ) {
|
||||
* // your code here
|
||||
* return $filename;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$file = apply_filters( 'um_upload_file_name', $id . "-" . $_FILES[ $id ]["name"], $id, $_FILES[ $id ]["name"] );
|
||||
$file = sanitize_file_name( $file );
|
||||
$extension = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) );
|
||||
|
||||
$error = UM()->files()->check_file_upload( $temp, $extension, $id );
|
||||
if ( $error ){
|
||||
$ret['error'] = $error;
|
||||
} else {
|
||||
$ret[] = UM()->files()->new_file_upload_temp( $temp, $file );
|
||||
$ret['icon'] = UM()->files()->get_fonticon_by_ext( $extension );
|
||||
$ret['icon_bg'] = UM()->files()->get_fonticon_bg_by_ext( $extension );
|
||||
$ret['filename'] = $file;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$ret['error'] = __('A theme or plugin compatibility issue','ultimate-member');
|
||||
}
|
||||
echo json_encode($ret);
|
||||
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
$dirname = dirname( __FILE__ );
|
||||
do {
|
||||
$dirname = dirname( $dirname );
|
||||
$wp_config = "{$dirname}/wp-config.php";
|
||||
$wp_load = "{$dirname}/wp-load.php";
|
||||
}
|
||||
while( !file_exists( $wp_config ) );
|
||||
|
||||
if ( !file_exists( $wp_load ) ) {
|
||||
$dirs = glob( $dirname . '/*' , GLOB_ONLYDIR );
|
||||
|
||||
|
||||
foreach ( $dirs as $key => $value ) {
|
||||
$wp_load = "{$value}/wp-load.php";
|
||||
if ( file_exists( $wp_load ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
require_once( $wp_load );
|
||||
|
||||
$ret['error'] = null;
|
||||
$ret = array();
|
||||
|
||||
$id = $_POST['key'];
|
||||
$timestamp = $_POST['timestamp'];
|
||||
$nonce = $_POST['_wpnonce'];
|
||||
|
||||
UM()->fields()->set_id = $_POST['set_id'];
|
||||
UM()->fields()->set_mode = $_POST['set_mode'];
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_image_upload_nonce
|
||||
* @description Change Image Upload nonce
|
||||
* @input_vars
|
||||
* [{"var":"$nonce","type":"bool","desc":"Nonce"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_image_upload_nonce', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_image_upload_nonce', 'my_image_upload_nonce', 10, 1 );
|
||||
* function my_image_upload_nonce( $nonce ) {
|
||||
* // your code here
|
||||
* return $nonce;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_image_upload_nonce = apply_filters( "um_image_upload_nonce", true );
|
||||
|
||||
if( $um_image_upload_nonce ){
|
||||
if ( ! wp_verify_nonce( $nonce, 'um_upload_nonce-'.$timestamp ) && is_user_logged_in() ) {
|
||||
// This nonce is not valid.
|
||||
$ret['error'] = 'Invalid nonce';
|
||||
die( json_encode( $ret ) );
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_FILES[$id]['name'])) {
|
||||
|
||||
if(!is_array($_FILES[$id]['name'])) {
|
||||
|
||||
$temp = $_FILES[$id]["tmp_name"];
|
||||
$file = $id."-".$_FILES[$id]["name"];
|
||||
$file = sanitize_file_name($file);
|
||||
$ext = strtolower( pathinfo($file, PATHINFO_EXTENSION) );
|
||||
|
||||
$error = UM()->files()->check_image_upload( $temp, $id );
|
||||
if ( $error ){
|
||||
|
||||
$ret['error'] = $error;
|
||||
|
||||
} else {
|
||||
$file = "stream_photo_".md5($file)."_".uniqid().".".$ext;
|
||||
$ret[ ] = UM()->files()->new_image_upload_temp( $temp, $file, UM()->options()->get('image_compression') );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$ret['error'] = __('A theme or plugin compatibility issue','ultimate-member');
|
||||
}
|
||||
echo json_encode($ret);
|
||||
@@ -774,6 +774,63 @@ function um_is_temp_image( $url ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check user's file ownership
|
||||
* @param string $url
|
||||
* @param integer $user_id
|
||||
* @return bool
|
||||
*/
|
||||
function um_is_file_owner( $url, $user_id = null, $image_path = false ){
|
||||
|
||||
if( strpos( $url, "/uploads/ultimatemember/{$user_id}/" ) !== false && is_user_logged_in() ){
|
||||
|
||||
$user_basedir = UM()->uploader()->get_upload_user_base_dir( $user_id );
|
||||
|
||||
$filename = wp_basename( parse_url( $url, PHP_URL_PATH ) );
|
||||
|
||||
$file = $user_basedir . '/' . $filename;
|
||||
if( file_exists( $file ) ){
|
||||
if( $image_path ){
|
||||
return $file;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
$user_basedir = UM()->uploader()->get_upload_user_base_dir( 'temp' );
|
||||
|
||||
$filename = wp_basename( parse_url( $url, PHP_URL_PATH ) );
|
||||
|
||||
$file = $user_basedir . '/' . $filename;
|
||||
if( file_exists( $file ) ){
|
||||
if( $image_path ){
|
||||
return $file;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if file is temporary
|
||||
* @param string $filename
|
||||
* @return bool
|
||||
*/
|
||||
function um_is_temp_file( $filename ){
|
||||
$user_basedir = UM()->uploader()->get_upload_user_base_dir( 'temp' );
|
||||
|
||||
$file = $user_basedir . '/' . $filename;
|
||||
|
||||
if( file_exists( $file ) ){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get core page url
|
||||
*
|
||||
@@ -1306,15 +1363,20 @@ function um_can_view_profile( $user_id ) {
|
||||
return ! UM()->user()->is_private_profile( $user_id );
|
||||
}
|
||||
|
||||
$temp_id = um_user('ID');
|
||||
um_fetch_user( get_current_user_id() );
|
||||
|
||||
if ( ! um_user( 'can_access_private_profile' ) && UM()->user()->is_private_profile( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$temp_id = um_user('ID');
|
||||
um_fetch_user( get_current_user_id() );
|
||||
|
||||
if ( um_user( 'can_view_roles' ) && $user_id != get_current_user_id() ) {
|
||||
if ( count( array_intersect( UM()->roles()->get_all_user_roles( $user_id ), um_user( 'can_view_roles' ) ) ) <= 0 ) {
|
||||
|
||||
$can_view_roles = um_user( 'can_view_roles' );
|
||||
|
||||
if( ! is_array( $can_view_roles ) ) $can_view_roles = array();
|
||||
|
||||
if ( count( array_intersect( UM()->roles()->get_all_user_roles( $user_id ), $can_view_roles ) ) <= 0 ) {
|
||||
um_fetch_user( $temp_id );
|
||||
return false;
|
||||
}
|
||||
@@ -1640,8 +1702,8 @@ function um_user_uploads_dir() {
|
||||
*/
|
||||
function um_closest_num( $array, $number ) {
|
||||
sort( $array );
|
||||
foreach ($array as $a) {
|
||||
if ($a >= $number) return $a;
|
||||
foreach ( $array as $a ) {
|
||||
if ( $a >= $number ) return $a;
|
||||
}
|
||||
|
||||
return end( $array );
|
||||
@@ -1659,17 +1721,20 @@ function um_closest_num( $array, $number ) {
|
||||
function um_get_cover_uri( $image, $attrs ) {
|
||||
$uri = false;
|
||||
$ext = '.' . pathinfo( $image, PATHINFO_EXTENSION );
|
||||
if (file_exists( UM()->files()->upload_basedir . um_user( 'ID' ) . '/cover_photo' . $ext )) {
|
||||
$uri = um_user_uploads_uri() . 'cover_photo' . $ext . '?' . current_time( 'timestamp' );
|
||||
if (file_exists( UM()->files()->upload_basedir . um_user( 'ID' ) . "/cover_photo{$ext}" ) ) {
|
||||
$uri = um_user_uploads_uri() . "/cover_photo{$ext}?" . current_time( 'timestamp' );
|
||||
}
|
||||
if (file_exists( UM()->files()->upload_basedir . um_user( 'ID' ) . '/cover_photo-' . $attrs . $ext )) {
|
||||
$uri = um_user_uploads_uri() . 'cover_photo-' . $attrs . $ext . '?' . current_time( 'timestamp' );
|
||||
|
||||
if ( file_exists( UM()->files()->upload_basedir . um_user( 'ID' ) . "/cover_photo-{$attrs}x{$attrs}{$ext}" ) ) {
|
||||
$uri = um_user_uploads_uri() . "/cover_photo-{$attrs}x{$attrs}{$ext}?". current_time( 'timestamp' );
|
||||
}else if ( file_exists( UM()->files()->upload_basedir . um_user( 'ID' ) . "/cover_photo-{$attrs}{$ext}" ) ) {
|
||||
$uri = um_user_uploads_uri() . "/cover_photo-{$attrs}{$ext}?" . current_time( 'timestamp' );
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get avatar URL instead of image
|
||||
*
|
||||
@@ -1696,7 +1761,6 @@ function um_get_avatar_uri( $image, $attrs ) {
|
||||
$uri = false;
|
||||
$find = false;
|
||||
$ext = '.' . pathinfo( $image, PATHINFO_EXTENSION );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -1719,26 +1783,26 @@ function um_get_avatar_uri( $image, $attrs ) {
|
||||
* ?>
|
||||
*/
|
||||
$cache_time = apply_filters( 'um_filter_avatar_cache_time', current_time( 'timestamp' ), um_user( 'ID' ) );
|
||||
|
||||
if( $attrs == 'original' && file_exists( um_user_uploads_dir() . "profile_photo{$ext}" ) ) {
|
||||
$uri = um_user_uploads_uri() . "profile_photo{$ext}";
|
||||
} else if (file_exists( um_user_uploads_dir() . "profile_photo-{$attrs}{$ext}" )) {
|
||||
} else if ( file_exists( um_user_uploads_dir() . "profile_photo-{$attrs}x{$attrs}{$ext}" ) ) {
|
||||
$uri = um_user_uploads_uri() . "profile_photo-{$attrs}x{$attrs}{$ext}";
|
||||
} else if ( file_exists( um_user_uploads_dir() . "profile_photo-{$attrs}{$ext}" ) ) {
|
||||
$uri = um_user_uploads_uri() . "profile_photo-{$attrs}{$ext}";
|
||||
} else {
|
||||
$sizes = UM()->options()->get( 'photo_thumb_sizes' );
|
||||
if (is_array( $sizes )) $find = um_closest_num( $sizes, $attrs );
|
||||
|
||||
if (file_exists( um_user_uploads_dir() . "profile_photo-{$find}{$ext}" )) {
|
||||
if ( is_array( $sizes ) ) $find = um_closest_num( $sizes, $attrs );
|
||||
if ( file_exists( um_user_uploads_dir() . "profile_photo-{$find}x{$find}{$ext}" ) ) {
|
||||
$uri = um_user_uploads_uri() . "profile_photo-{$find}x{$find}{$ext}";
|
||||
}else if ( file_exists( um_user_uploads_dir() . "profile_photo-{$find}{$ext}" ) ) {
|
||||
$uri = um_user_uploads_uri() . "profile_photo-{$find}{$ext}";
|
||||
} else if (file_exists( um_user_uploads_dir() . "profile_photo{$ext}" )) {
|
||||
} else if ( file_exists( um_user_uploads_dir() . "profile_photo{$ext}" ) ) {
|
||||
$uri = um_user_uploads_uri() . "profile_photo{$ext}";
|
||||
}
|
||||
}
|
||||
|
||||
if ( !empty( $cache_time ) ) {
|
||||
$uri .= "?{$cache_time}";
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
|
||||
+20
-1
@@ -6,7 +6,7 @@ Donate link:
|
||||
Tags: community, member, membership, user-profile, user-registration
|
||||
Requires at least: 4.1
|
||||
Tested up to: 4.9
|
||||
Stable tag: 2.0.21
|
||||
Stable tag: 2.0.22
|
||||
License: GNU Version 2 or Any Later Version
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
@@ -131,6 +131,25 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
||||
|
||||
= Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin =
|
||||
|
||||
= 2.0.22: August 10, 2018 =
|
||||
|
||||
* Enhancements:
|
||||
- Added an ability to filter user's profile slug "um_change_user_profile_slug"
|
||||
- Added an ability to filter pages for exclude restriction content settings "um_exclude_posts_from_privacy"
|
||||
|
||||
* Bugfixes:
|
||||
- Fixed callback functions in member directory search
|
||||
- Fixed Profile Privacy Settings for different languages
|
||||
- Fixed security vulnerabilities (File/Image uploader)
|
||||
- Fixed security vulnerabilities (HTML arguments)
|
||||
- Fixed search in members directory for some cases, when metadata format isn't correct
|
||||
- Fixed some cases in conditional logic
|
||||
- Fixed WP Capabilities list for Gravity Forms
|
||||
- Fixed View Profile capabilities
|
||||
|
||||
* Deprecated:
|
||||
- Filters "um_before_user_upload", "um_after_user_upload"
|
||||
|
||||
= 2.0.21: July 9, 2018 =
|
||||
|
||||
* Bugfixes:
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
continue;
|
||||
?>
|
||||
|
||||
<div class="um-member-tagline um-member-tagline-<?php echo $key;?>"><?php _e( $value, 'ultimate-member'); ?></div>
|
||||
<div class="um-member-tagline um-member-tagline-<?php echo esc_attr( $key );?>"><?php _e( $value, 'ultimate-member'); ?></div>
|
||||
|
||||
<?php
|
||||
} // end if
|
||||
@@ -124,7 +124,7 @@
|
||||
if ( ! $value )
|
||||
continue; ?>
|
||||
|
||||
<div class="um-member-metaline um-member-metaline-<?php echo $key; ?>"><span><strong><?php echo UM()->fields()->get_label( $key ); ?>:</strong> <?php _e( $value, 'ultimate-member'); ?></span></div>
|
||||
<div class="um-member-metaline um-member-metaline-<?php echo esc_attr( $key ); ?>"><span><strong><?php echo UM()->fields()->get_label( $key ); ?>:</strong> <?php _e( $value, 'ultimate-member'); ?></span></div>
|
||||
|
||||
<?php }
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
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.0.21
|
||||
Version: 2.0.22
|
||||
Author: Ultimate Member
|
||||
Author URI: http://ultimatemember.com/
|
||||
Text Domain: ultimate-member
|
||||
|
||||
Reference in New Issue
Block a user