mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Merge branch 'release/2.0.18'
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.17 | WordPress 4.9 or higher| 2.0.17 |
|
||||
| 2.0.18 | WordPress 4.9 or higher| 2.0.18 |
|
||||
|
||||
|
||||
Features of the plugin include:
|
||||
@@ -48,7 +48,7 @@ GNU Version 2 or Any Later Version
|
||||
|
||||
Releases
|
||||
====================
|
||||
[Official Release Version: 2.0.17](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.17).
|
||||
[Official Release Version: 2.0.18](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.18).
|
||||
|
||||
[Official Release Version: 1.3.88](https://github.com/ultimatemember/ultimatemember/releases).
|
||||
|
||||
|
||||
@@ -621,11 +621,40 @@ input[type=submit].um-button:hover {
|
||||
-moz-border-radius: 4px !important;
|
||||
-webkit-border-radius: 4px !important;
|
||||
border-radius: 4px !important;
|
||||
border-top: 1px solid rgba(0,0,0,0.0) !important;
|
||||
border-bottom: 2px solid rgba(0, 0, 0, 0.1) !important;
|
||||
-webkit-box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
a.um-button {
|
||||
font-size: 15px;
|
||||
border: none !important;
|
||||
display: block;
|
||||
width: 100%;
|
||||
line-height: 1em !important;
|
||||
padding: 16px 20px !important;
|
||||
text-decoration: none !important;
|
||||
text-align: center;
|
||||
text-transform: none !important;
|
||||
font-weight: normal !important;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
transition: 0.25s;
|
||||
box-sizing: border-box;
|
||||
-moz-border-radius: 4px !important;
|
||||
-webkit-border-radius: 4px !important;
|
||||
border-radius: 4px !important;
|
||||
-webkit-box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
a.um-button:hover {
|
||||
-webkit-box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
}
|
||||
|
||||
|
||||
.um-button.um-btn-auto-width {
|
||||
width: auto;
|
||||
|
||||
@@ -12,7 +12,6 @@ jQuery(document).ready( function (){
|
||||
function um_get_field_default_value( $dom ) {
|
||||
var default_value = '';
|
||||
var type = um_get_field_type($dom);
|
||||
|
||||
switch ( type ) {
|
||||
|
||||
case 'text':
|
||||
@@ -25,7 +24,6 @@ jQuery(document).ready( function (){
|
||||
|
||||
case 'multiselect':
|
||||
default_value = $dom.find('select').val();
|
||||
|
||||
break;
|
||||
|
||||
case 'radio':
|
||||
@@ -249,7 +247,6 @@ jQuery(document).ready( function (){
|
||||
}
|
||||
|
||||
if (condition.operator == 'equals to') {
|
||||
|
||||
if (condition.value == live_field_value && um_in_array(live_field_value, $owners_values[condition.owner])) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
@@ -505,17 +502,22 @@ jQuery(document).ready( function (){
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).on('change', '.um-field select, .um-field input[type=radio], .um-field input[type=checkbox]', function () {
|
||||
jQuery(document).on('change', '.um-field select, .um-field input[type="radio"], .um-field input[type="checkbox"]', function () {
|
||||
var me = jQuery(this);
|
||||
um_apply_conditions(me, false);
|
||||
});
|
||||
|
||||
jQuery(document).on('input change', '.um-field input[type=text]', function () {
|
||||
jQuery(document).on('input change', '.um-field input[type="text"]', function () {
|
||||
var me = jQuery(this);
|
||||
um_apply_conditions(me, false);
|
||||
});
|
||||
|
||||
jQuery(document).on('input change', '.um-field input[type=password]', function () {
|
||||
jQuery(document).on('input change', '.um-field input[type="number"]', function () {
|
||||
var me = jQuery(this);
|
||||
um_apply_conditions(me, false);
|
||||
});
|
||||
|
||||
jQuery(document).on('input change', '.um-field input[type="password"]', function () {
|
||||
var me = jQuery(this);
|
||||
um_apply_conditions(me, false);
|
||||
});
|
||||
|
||||
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
@@ -635,7 +635,6 @@ function um_modal_responsive() {
|
||||
}
|
||||
|
||||
function um_remove_modal(){
|
||||
|
||||
jQuery('img.cropper-hidden').cropper('destroy');
|
||||
|
||||
jQuery('body,html,textarea').css("overflow", "auto");
|
||||
@@ -670,6 +669,14 @@ function prepare_Modal() {
|
||||
|
||||
function remove_Modal() {
|
||||
if ( jQuery('.um-popup-overlay').length ) {
|
||||
jQuery( document ).trigger( 'um_before_modal_removed' );
|
||||
|
||||
if ( jQuery('.um-popup-autogrow:visible').length ) {
|
||||
jQuery('.um-popup-autogrow:visible').mCustomScrollbar("destroy");
|
||||
} else if ( jQuery('.um-popup-autogrow2:visible').length ) {
|
||||
jQuery('.um-popup-autogrow2:visible').mCustomScrollbar("destroy");
|
||||
}
|
||||
|
||||
jQuery('.tipsy').remove();
|
||||
jQuery('.um-popup').empty().remove();
|
||||
jQuery('.um-popup-overlay').empty().remove();
|
||||
|
||||
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
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),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 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");if(jQuery(this).parents("#um_upload_single").attr("data-user_id"))var u=jQuery(this).parents("#um_upload_single").attr("data-user_id");else u=0;r?(jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:um_scripts.resize_image,type:"POST",data:{src:i,coord:r,user_id:u,key:t},success:function(e){d=new Date,"profile_photo"==t&&jQuery(".um-profile-photo-img img").attr("src",e+"?"+d.getTime()),"cover_photo"==t&&(jQuery(".um-cover-e").empty().html('<img src="'+e+"?"+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+"?"+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)}})):(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(i))}),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 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)})});
|
||||
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){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){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
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);
|
||||
@@ -258,3 +258,7 @@ p.disabled-on-off .um-admin-yesno *{
|
||||
visibility: hidden;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.um-admin-cur-condition-template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -240,14 +240,6 @@ th.column-email.column-primary {
|
||||
}
|
||||
*/
|
||||
|
||||
.email_template_wrapper .reset_email_template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.email_template_wrapper.in_theme .reset_email_template {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.um_setting_ajax_button_response.complete {
|
||||
color:darkgreen;
|
||||
font-style: italic;
|
||||
|
||||
@@ -28,7 +28,6 @@ jQuery(document).ready(function() {
|
||||
jQuery('.tipsy').hide();
|
||||
|
||||
um_admin_remove_modal();
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_admin_ajax_data.ajax_url,
|
||||
type: 'POST',
|
||||
|
||||
@@ -3,13 +3,13 @@ jQuery(document).ready(function() {
|
||||
/* Remove field permanently */
|
||||
jQuery(document).on('click', '.um-admin-btns a span.remove', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
if (confirm('This will permanently delete this custom field from database')) {
|
||||
|
||||
|
||||
if ( confirm( 'This will permanently delete this custom field from database' ) ) {
|
||||
|
||||
jQuery(this).parents('a').remove();
|
||||
|
||||
|
||||
arg1 = jQuery(this).parents('a').data('arg1');
|
||||
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_admin_field_data.do_ajax_url,
|
||||
type: 'POST',
|
||||
@@ -21,13 +21,12 @@ jQuery(document).ready(function() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* Add a Field */
|
||||
jQuery(document).on('submit', 'form.um_add_field', function(e){
|
||||
|
||||
@@ -50,9 +49,8 @@ jQuery(document).ready(function() {
|
||||
form.css({'opacity': 1});
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
if (data.error){
|
||||
|
||||
|
||||
c = 0;
|
||||
jQuery.each(data.error, function(i, v){
|
||||
c++;
|
||||
@@ -61,11 +59,11 @@ jQuery(document).ready(function() {
|
||||
form.find('.um-admin-error-block').show().html(v);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
um_admin_modal_responsive();
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
jQuery('.um-col-demon-settings').data('in_row', '');
|
||||
jQuery('.um-col-demon-settings').data('in_sub_row', '');
|
||||
jQuery('.um-col-demon-settings').data('in_column', '');
|
||||
|
||||
@@ -198,21 +198,26 @@ jQuery(document).ready(function() {
|
||||
if ( jQuery(this).hasClass('disabled') )
|
||||
return false;
|
||||
|
||||
var content = jQuery(this).parents('.um-admin-btn-content');
|
||||
var length = content.find('.um-admin-cur-condition').length;
|
||||
var content = jQuery(this).parents('.um-admin-btn-content'),
|
||||
length = content.find('.um-admin-cur-condition').length;
|
||||
|
||||
if ( length < 5 ) {
|
||||
//content.find('select').select2('destroy');
|
||||
|
||||
var cloned = jQuery(this).parents('.um-admin-cur-condition').clone();
|
||||
cloned.find('input[type=text],select').each(function(){
|
||||
var template = jQuery('.um-admin-btn-content').find('.um-admin-cur-condition-template').clone();
|
||||
|
||||
template.find('input[type=text],select').each(function(){
|
||||
jQuery(this).attr('id', jQuery(this).attr('id') + length );
|
||||
jQuery(this).attr('name', jQuery(this).attr('name') + length );
|
||||
});
|
||||
cloned.find('input[type=text]').val('');
|
||||
cloned.find('.um-admin-new-condition').replaceWith('<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>');
|
||||
|
||||
cloned.appendTo( content );
|
||||
cloned.find('select').val('');
|
||||
template.find('input[type=text]').val('');
|
||||
template.find('select').val('');
|
||||
|
||||
template.appendTo( content );
|
||||
jQuery(template).removeClass("um-admin-cur-condition-template");
|
||||
jQuery(template).addClass("um-admin-cur-condition");
|
||||
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
} else {
|
||||
|
||||
@@ -216,4 +216,22 @@ jQuery(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
jQuery(document).on( 'click', '.um-admin-notice.is-dismissible .notice-dismiss', function(e) {
|
||||
var notice_key = jQuery(this).parents('.um-admin-notice').data('key');
|
||||
|
||||
wp.ajax.send( 'um_dimiss_notice', {
|
||||
data: {
|
||||
key: notice_key,
|
||||
nonce: um_admin_scripts.nonce
|
||||
},
|
||||
success: function( data ) {
|
||||
return true;
|
||||
},
|
||||
error: function( data ) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,42 +1,4 @@
|
||||
jQuery( document ).ready( function() {
|
||||
/**
|
||||
* Email templates
|
||||
*/
|
||||
/*jQuery( 'body' ).on( 'click', '.copy_email_template', function() {
|
||||
var obj = jQuery(this);
|
||||
|
||||
jQuery.ajax({
|
||||
url: php_data.copy_email_template,
|
||||
type: 'POST',
|
||||
data: { email_key : obj.parents('.email_template_wrapper').data('key') },
|
||||
success: function(data){
|
||||
obj.parents('.email_template_wrapper').addClass('in_theme');
|
||||
},
|
||||
error: function(data){
|
||||
alert('Something went wrong');
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
jQuery( 'body' ).on( 'click', '.reset_email_template', function() {
|
||||
var obj = jQuery(this);
|
||||
|
||||
jQuery.ajax({
|
||||
url: php_data.delete_email_template,
|
||||
type: 'POST',
|
||||
data: { email_key : obj.parents('.email_template_wrapper').data('key') },
|
||||
success: function(data){
|
||||
obj.parents('.email_template_wrapper').removeClass('in_theme');
|
||||
},
|
||||
error: function(data){
|
||||
alert('Something went wrong');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Licenses
|
||||
*/
|
||||
|
||||
@@ -167,27 +167,27 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
|
||||
function um_admin_pre_save_field_to_form( $array ){
|
||||
unset( $array['conditions'] );
|
||||
if ( isset($array['conditional_field']) && !empty( $array['conditional_action'] ) && !empty( $array['conditional_operator'] ) ) {
|
||||
$array['conditional_value'] = ! empty( $array['conditional_value'] ) ? $array['conditional_value'] : '';
|
||||
$array['conditional_value'] = isset( $array['conditional_value'] ) ? $array['conditional_value'] : '';
|
||||
$array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field1']) && !empty( $array['conditional_action1'] ) && !empty( $array['conditional_operator1'] ) ) {
|
||||
$array['conditional_value1'] = ! empty( $array['conditional_value1'] ) ? $array['conditional_value1'] : '';
|
||||
$array['conditional_value1'] = isset( $array['conditional_value1'] ) ? $array['conditional_value1'] : '';
|
||||
$array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field2']) && !empty( $array['conditional_action2'] ) && !empty( $array['conditional_operator2'] ) ) {
|
||||
$array['conditional_value2'] = ! empty( $array['conditional_value2'] ) ? $array['conditional_value2'] : '';
|
||||
$array['conditional_value2'] = isset( $array['conditional_value2'] ) ? $array['conditional_value2'] : '';
|
||||
$array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field3']) && !empty( $array['conditional_action3'] ) && !empty( $array['conditional_operator3'] ) ) {
|
||||
$array['conditional_value3'] = ! empty( $array['conditional_value3'] ) ? $array['conditional_value3'] : '';
|
||||
$array['conditional_value3'] = isset( $array['conditional_value3'] ) ? $array['conditional_value3'] : '';
|
||||
$array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field4']) && !empty( $array['conditional_action4'] ) && !empty( $array['conditional_operator4'] ) ) {
|
||||
$array['conditional_value4'] = ! empty( $array['conditional_value4'] ) ? $array['conditional_value4'] : '';
|
||||
$array['conditional_value4'] = isset( $array['conditional_value4'] ) ? $array['conditional_value4'] : '';
|
||||
$array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] );
|
||||
}
|
||||
|
||||
@@ -231,10 +231,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
|
||||
|
||||
<div class="um-admin-btn-content">
|
||||
|
||||
<p class="um-admin-reset-conditions"><a href="#" class="button button-primary"><?php _e( 'Reset all rules', 'ultimate-member' ); ?></a></p>
|
||||
<p><a href="#" class="um-admin-new-condition button button-primary um-admin-tipsy-n" title="Add new condition"><?php _e( 'Add new rule', 'ultimate-member' ); ?></a></p>
|
||||
<p class="um-admin-reset-conditions"><a href="#" class="button"><?php _e( 'Reset all rules', 'ultimate-member' ); ?></a></p>
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
<?php if ( isset( $edit_array['conditions'] ) ) {
|
||||
<?php if ( isset( $edit_array['conditions'] ) && count( $edit_array['conditions'] ) != 0 ) {
|
||||
|
||||
foreach ( $edit_array['conditions'] as $k => $arr ) {
|
||||
|
||||
@@ -247,11 +248,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
|
||||
<?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_value' . $k, $form_id ); ?>
|
||||
|
||||
<?php if ( $k == '' ) { ?>
|
||||
<p><a href="#" class="um-admin-new-condition button um-admin-tipsy-n" title="Add new condition"><i class="um-icon-plus" style="margin-right:0!important"></i></a></p>
|
||||
<?php } else { ?>
|
||||
<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
|
||||
<?php } ?>
|
||||
<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
@@ -274,7 +271,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
<div class="um-admin-cur-condition-template">
|
||||
|
||||
<?php $metabox->field_input( '_conditional_action', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_field', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
|
||||
|
||||
<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -659,6 +666,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
|
||||
$output['error'] = apply_filters( 'um_admin_field_update_error_handling', $output['error'], $array );
|
||||
|
||||
extract( $array['post'] );
|
||||
|
||||
if ( empty( $output['error'] ) ){
|
||||
|
||||
$save = array();
|
||||
|
||||
@@ -156,7 +156,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
|
||||
wp_enqueue_script( 'um_admin_settings' );
|
||||
|
||||
$localize_data = array(
|
||||
'delete_email_template' => UM()->get_ajax_route( 'um\core\Mail', 'delete_email_template' ),
|
||||
'onbeforeunload_text' => __( 'Are sure, maybe some settings not saved', 'ultimate-member' ),
|
||||
'texts' => array(
|
||||
'remove' => __( 'Remove', 'ultimate-member' ),
|
||||
@@ -303,7 +302,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
|
||||
* Load jQuery custom code
|
||||
*/
|
||||
function load_custom_scripts() {
|
||||
wp_register_script( 'um_admin_scripts', $this->js_url . 'um-admin-scripts.js', '', '', true );
|
||||
wp_register_script( 'um_admin_scripts', $this->js_url . 'um-admin-scripts.js', array('jquery','wp-util'), '', true );
|
||||
wp_enqueue_script( 'um_admin_scripts' );
|
||||
}
|
||||
|
||||
|
||||
@@ -731,15 +731,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
$value = $this->get_field_value( $field_data );
|
||||
|
||||
$options = '';
|
||||
foreach ( $field_data['options'] as $key=>$option ) {
|
||||
foreach ( $field_data['options'] as $key => $option ) {
|
||||
if ( ! empty( $field_data['multi'] ) ) {
|
||||
|
||||
if ( ! is_array( $value ) || empty( $value ) )
|
||||
$value = array();
|
||||
|
||||
$options .= '<option value="' . $key . '" ' . selected( in_array( $key, $value ), true, false ) . '>' . $option . '</option>';
|
||||
$options .= '<option value="' . $key . '" ' . selected( in_array( $key, $value ), true, false ) . '>' . esc_html( $option ) . '</option>';
|
||||
} else {
|
||||
$options .= '<option value="' . $key . '" ' . selected( (string)$key == $value, true, false ) . '>' . $option . '</option>';
|
||||
$options .= '<option value="' . $key . '" ' . selected( (string)$key == $value, true, false ) . '>' . esc_html( $option ) . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1040,11 +1040,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
ob_start(); ?>
|
||||
|
||||
<div class="email_template_wrapper <?php echo $field_data['in_theme'] ? 'in_theme' : '' ?>" data-key="<?php echo $field_data['id'] ?>" style="position: relative;">
|
||||
<!-- <input type="button" class="reset_email_template button" value="--><?php //_e( 'Reset Template to Default', 'ultimate-member' ) ?><!--" />-->
|
||||
<!--<div class="copy_button_overlay">
|
||||
<span><?php /*_e( 'Currently UM use default Email Template, you can edit this template after then you copy in to theme', 'ultimate-member' ) */?></span>
|
||||
<input type="button" class="copy_email_template button" value="<?php /*_e( 'Copy Template to Theme', 'ultimate-member' ) */?>" />
|
||||
</div>-->
|
||||
|
||||
<?php wp_editor( $value,
|
||||
$id,
|
||||
@@ -1057,7 +1052,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
'editor_class' => $class
|
||||
)
|
||||
); ?>
|
||||
|
||||
<span class="description">For default text for plain-text emails please see this <a href="https://docs.ultimatemember.com/article/1342-plain-text-email-default-templates#<?php echo $field_data['id'] ?>" target="_blank">doc</a></span>
|
||||
</div>
|
||||
|
||||
<?php $html = ob_get_clean();
|
||||
|
||||
@@ -1313,7 +1313,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
?>
|
||||
|
||||
<p>
|
||||
<input type="text" name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" placeholder="<?php _e( 'Value', 'ultimate-member' ); ?>" style="width: 150px!important;position: relative;top: -1px;" />
|
||||
<input type="text" name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" value="<?php echo isset( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" placeholder="<?php _e( 'Value', 'ultimate-member' ); ?>" style="width: 150px!important;position: relative;top: -1px;" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -29,6 +29,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
|
||||
add_action( 'admin_init', array( &$this, 'create_list' ), 10 );
|
||||
add_action( 'admin_notices', array( &$this, 'render_notices' ), 1 );
|
||||
|
||||
//add_action( 'wp_ajax_um_dimiss_notice', array( &$this, 'dimiss_notice' ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +40,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
$this->localize_note();
|
||||
$this->show_update_messages();
|
||||
$this->check_wrong_install_folder();
|
||||
//$this->admin_notice_tracking();
|
||||
$this->admin_notice_tracking();
|
||||
$this->need_upgrade();
|
||||
$this->check_wrong_licenses();
|
||||
|
||||
|
||||
//$this->future_changed();
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -135,7 +140,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
|
||||
$admin_notices = $this->get_admin_notices();
|
||||
|
||||
$hidden = get_user_meta( get_current_user_id(), 'um_hidden_admin_notices' );
|
||||
$hidden = get_user_meta( get_current_user_id(), 'um_hidden_admin_notices', true );
|
||||
$hidden = empty( $hidden ) ? array() : $hidden;
|
||||
|
||||
uasort( $admin_notices, array( &$this, 'notice_priority_sort' ) );
|
||||
@@ -186,9 +191,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
|
||||
$class = ! empty( $notice_data['class'] ) ? $notice_data['class'] : 'updated';
|
||||
|
||||
$dimissible = ! empty( $admin_notices[ $key ]['dimissible'] );
|
||||
|
||||
ob_start(); ?>
|
||||
|
||||
<div class="<?php echo esc_attr( $class ) ?> um-admin-notice">
|
||||
<div class="<?php echo esc_attr( $class ) ?> um-admin-notice notice <?php echo $dimissible ? 'is-dismissible' : '' ?>" data-key="<?php echo $key ?>">
|
||||
<?php echo ! empty( $notice_data['message'] ) ? $notice_data['message'] : '' ?>
|
||||
</div>
|
||||
|
||||
@@ -494,13 +501,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
*/
|
||||
public function admin_notice_tracking() {
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) )
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$hide_notice = get_option( 'um_tracking_notice' );
|
||||
|
||||
if ( $hide_notice )
|
||||
if ( $hide_notice ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$optin_url = esc_url( add_query_arg( 'um_adm_action', 'opt_into_tracking' ) );
|
||||
$optout_url = esc_url( add_query_arg( 'um_adm_action', 'opt_out_of_tracking' ) );
|
||||
@@ -508,7 +517,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
ob_start(); ?>
|
||||
|
||||
<p>
|
||||
<?php printf( __( 'Thanks for installing <strong>%s</strong>! The core plugin is free but we also sell extensions which allow us to continue developing and supporting the plugin full time. If you subscribe to our mailing list (no spam) we will email you a 20%% discount code which you can use to purchase the <a href="%s" target="_blank">extensions bundle</a>.', 'ultimate-member' ), 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 for %s via our website. If you subscribe to our mailing list we will immediately email you a 20%% discount code for our <a href="%s" target="_blank">extensions bundle</a> (you\'ll need to confirm your subscription via email).', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -517,9 +526,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
<a href="<?php echo esc_url( $optout_url ) ?>" class="button-secondary"><?php _e( 'No thanks', 'ultimate-member' ) ?></a>
|
||||
</p>
|
||||
|
||||
<p class="description" style="font-size: 11px;">
|
||||
<?php printf( __( 'By clicking the subscribe button you are agreeing to join our mailing list (managed via MailChimp). See our <a href="%s" target="_blank">privacy policy</a>', 'ultimate-member' ), 'https://ultimatemember.com/support/policy/' ); ?>
|
||||
</p>
|
||||
|
||||
<?php $message = ob_get_clean();
|
||||
|
||||
$this->add_notice( 'invalid_dir', array(
|
||||
$this->add_notice( 'tracking_notice', array(
|
||||
'class' => 'updated',
|
||||
'message' => $message,
|
||||
), 2 );
|
||||
@@ -595,5 +608,41 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check Future Changes notice
|
||||
*/
|
||||
function future_changed() {
|
||||
|
||||
ob_start(); ?>
|
||||
|
||||
<p>
|
||||
<?php printf( __( '<strong>%s</strong> future plans! Detailed future list is <a href="%s" target="_blank">here</a>', 'ultimate-member' ), ultimatemember_plugin_name, '#' ); ?>
|
||||
</p>
|
||||
|
||||
<?php $message = ob_get_clean();
|
||||
|
||||
$this->add_notice( 'future_changes', array(
|
||||
'class' => 'updated',
|
||||
'message' => $message,
|
||||
//'dimissible' => true,
|
||||
), 2 );
|
||||
}
|
||||
|
||||
|
||||
function dimiss_notice() {
|
||||
if ( empty( $_POST['key'] ) ) {
|
||||
wp_send_json_error( __( 'Wrong Data', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$hidden_notices = get_user_meta( get_current_user_id(), 'um_hidden_admin_notices', true );
|
||||
$hidden_notices = empty( $hidden_notices ) ? array() : $hidden_notices;
|
||||
$hidden_notices[] = $_POST['key'];
|
||||
|
||||
update_user_meta( get_current_user_id(), 'um_hidden_admin_notices', $hidden_notices );
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -617,7 +617,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
'id' => 'email_html',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Use HTML for E-mails?','ultimate-member' ),
|
||||
'tooltip' => __('If you enable HTML for e-mails, you can customize the HTML e-mail templates found in <strong>templates/email</strong> folder.','ultimate-member'),
|
||||
'tooltip' => __( 'If you plan use e-mails with HTML, please make sure that this option is enabled. Otherwise, HTML will be displayed as plain text.','ultimate-member'),
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -1692,8 +1692,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
$email_key = empty( $_GET['email'] ) ? '' : urldecode( $_GET['email'] );
|
||||
$emails = UM()->config()->email_notifications;
|
||||
|
||||
if ( empty( $email_key ) || empty( $emails[$email_key] ) )
|
||||
if ( empty( $email_key ) || empty( $emails[ $email_key ] ) ) {
|
||||
return $section;
|
||||
}
|
||||
|
||||
$in_theme = UM()->mail()->template_in_theme( $email_key );
|
||||
|
||||
@@ -1722,7 +1723,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
array(
|
||||
'id' => 'um_email_template',
|
||||
'type' => 'hidden',
|
||||
'value' => $email_key,
|
||||
'value' => $email_key,
|
||||
),
|
||||
array(
|
||||
'id' => $email_key . '_on',
|
||||
@@ -2526,18 +2527,16 @@ Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ?
|
||||
*/
|
||||
function save_email_templates( $settings ) {
|
||||
|
||||
if ( empty( $settings['um_email_template'] ) )
|
||||
if ( empty( $settings['um_email_template'] ) ) {
|
||||
return $settings;
|
||||
}
|
||||
|
||||
$template = $settings['um_email_template'];
|
||||
$content = stripslashes( $settings[$template] );
|
||||
$content = stripslashes( $settings[ $template ] );
|
||||
|
||||
$theme_template_path = UM()->mail()->get_template_file( 'theme', $template );
|
||||
|
||||
$in_theme = UM()->mail()->template_in_theme( $template );
|
||||
if ( ! $in_theme ) {
|
||||
UM()->mail()->copy_email_template( $template );
|
||||
}
|
||||
UM()->mail()->copy_email_template( $template );
|
||||
|
||||
$fp = fopen( $theme_template_path, "w" );
|
||||
$result = fputs( $fp, $content );
|
||||
@@ -2545,7 +2544,7 @@ Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ?
|
||||
|
||||
if ( $result !== false ) {
|
||||
unset( $settings['um_email_template'] );
|
||||
unset( $settings[$template] );
|
||||
unset( $settings[ $template ] );
|
||||
}
|
||||
|
||||
return $settings;
|
||||
|
||||
@@ -74,44 +74,64 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
//add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
|
||||
add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for major updates
|
||||
*
|
||||
*/
|
||||
/*function in_plugin_update_message( $args ) {
|
||||
function in_plugin_update_message( $args ) {
|
||||
$show_additional_notice = false;
|
||||
if ( isset( $args['new_version'] ) ) {
|
||||
$old_version_array = explode( '.', ultimatemember_version );
|
||||
$new_version_array = explode( '.', $args['new_version'] );
|
||||
|
||||
$lastversion = get_option( '%UNIQUE_ID%_last_version', false );
|
||||
if ( $lastversion && version_compare( $lastversion, %UNIQUE_ID%_current_version, '>' ) ) {
|
||||
$upgrade_notice = get_option( '%UNIQUE_ID%_major_update' . $lastversion );
|
||||
if ( $old_version_array[0] < $new_version_array[0] ) {
|
||||
$show_additional_notice = true;
|
||||
} else {
|
||||
if ( $old_version_array[1] < $new_version_array[1] ) {
|
||||
$show_additional_notice = true;
|
||||
}
|
||||
}
|
||||
|
||||
echo '<style type="text/css">
|
||||
.%UNIQUE_ID%_plugin_upgrade_notice {
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
background: #d53221;
|
||||
padding: 1em;
|
||||
margin: 9px 0;
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
}
|
||||
.%UNIQUE_ID%_plugin_upgrade_notice:before {
|
||||
content: "\f348";
|
||||
display: inline-block;
|
||||
font: 400 18px/1 dashicons;
|
||||
speak: none;
|
||||
margin: 0 8px 0 -2px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
vertical-align: top;
|
||||
}
|
||||
</style>' . wp_kses_post( $upgrade_notice );
|
||||
}
|
||||
}*/
|
||||
|
||||
if ( $show_additional_notice ) {
|
||||
ob_start(); ?>
|
||||
|
||||
<style type="text/css">
|
||||
.um_plugin_upgrade_notice {
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
background: #d53221;
|
||||
padding: 1em;
|
||||
margin: 9px 0;
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
}
|
||||
|
||||
.um_plugin_upgrade_notice:before {
|
||||
content: "\f348";
|
||||
display: inline-block;
|
||||
font: 400 18px/1 dashicons;
|
||||
speak: none;
|
||||
margin: 0 8px 0 -2px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
vertical-align: top;
|
||||
}
|
||||
</style>
|
||||
|
||||
<span class="um_plugin_upgrade_notice">
|
||||
<?php printf( __( '%s is a major update, and we highly recommend creating a full backup of your site before updating.', 'ultimate-member' ), $args['new_version'] ); ?>
|
||||
</span>
|
||||
|
||||
<?php ob_get_flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,53 +1,255 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Locate a template and return the path for inclusion.
|
||||
*
|
||||
* @access public
|
||||
* @param string $template_name
|
||||
* @param bool $html
|
||||
* @return string
|
||||
*/
|
||||
function um_upgrade20beta1_template_in_theme( $template_name, $html = false ) {
|
||||
$template_name_file = UM()->mail()->get_template_filename( $template_name );
|
||||
$ext = ! $html ? '.php' : '.html';
|
||||
|
||||
$blog_id = '';
|
||||
if ( ! $html ) {
|
||||
$blog_id = UM()->mail()->get_blog_id();
|
||||
}
|
||||
|
||||
// check if there is template at theme folder
|
||||
$template = locate_template( array(
|
||||
trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . $ext
|
||||
) );
|
||||
// Return what we found.
|
||||
return ! $template ? false : true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method returns expected path for template
|
||||
*
|
||||
* @access public
|
||||
* @param string $location
|
||||
* @param string $template_name
|
||||
* @param bool $html
|
||||
* @return string
|
||||
*/
|
||||
function um_upgrade20beta1_get_template_file( $location, $template_name, $html = false ) {
|
||||
$template_path = '';
|
||||
$template_name_file = UM()->mail()->get_template_filename( $template_name );
|
||||
$ext = ! $html ? '.php' : '.html';
|
||||
switch( $location ) {
|
||||
case 'theme':
|
||||
|
||||
$blog_id = '';
|
||||
if ( ! $html ) {
|
||||
$blog_id = UM()->mail()->get_blog_id();
|
||||
}
|
||||
|
||||
$template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' . $blog_id ). $template_name_file . $ext;
|
||||
break;
|
||||
case 'plugin':
|
||||
$path = ! empty( UM()->mail()->path_by_slug[ $template_name ] ) ? UM()->mail()->path_by_slug[ $template_name ] : um_path . 'templates/email';
|
||||
$template_path = trailingslashit( $path ) . $template_name . $ext;
|
||||
break;
|
||||
}
|
||||
return $template_path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajax copy template to the theme
|
||||
*
|
||||
* @param string $template
|
||||
* @return bool
|
||||
*/
|
||||
function um_upgrade20beta1_copy_email_template( $template ) {
|
||||
$in_theme = um_upgrade20beta1_template_in_theme( $template );
|
||||
if ( $in_theme ) {
|
||||
return false;
|
||||
}
|
||||
$plugin_template_path = um_upgrade20beta1_get_template_file( 'plugin', $template );
|
||||
$theme_template_path = um_upgrade20beta1_get_template_file( 'theme', $template );
|
||||
$temp_path = str_replace( trailingslashit( get_stylesheet_directory() ), '', $theme_template_path );
|
||||
$temp_path = str_replace( '/', DIRECTORY_SEPARATOR, $temp_path );
|
||||
$folders = explode( DIRECTORY_SEPARATOR, $temp_path );
|
||||
$folders = array_splice( $folders, 0, count( $folders ) - 1 );
|
||||
$cur_folder = '';
|
||||
$theme_dir = trailingslashit( get_stylesheet_directory() );
|
||||
foreach ( $folders as $folder ) {
|
||||
$prev_dir = $cur_folder;
|
||||
$cur_folder .= $folder . DIRECTORY_SEPARATOR;
|
||||
if ( ! is_dir( $theme_dir . $cur_folder ) && wp_is_writable( $theme_dir . $prev_dir ) ) {
|
||||
mkdir( $theme_dir . $cur_folder, 0777 );
|
||||
}
|
||||
}
|
||||
if ( file_exists( $plugin_template_path ) && copy( $plugin_template_path, $theme_template_path ) ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert email template content to file
|
||||
*
|
||||
* @param string $path Filepath
|
||||
* @param string $content Email template content
|
||||
*/
|
||||
function um_upgrade20beta1_insert_content( $path, $content ) {
|
||||
$fp = @fopen( $path, "w" );
|
||||
@fputs( $fp, $content );
|
||||
@fclose( $fp );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Transferring email templates to new logic
|
||||
*/
|
||||
$templates_in_theme = 0;
|
||||
function um_upgrade20beta1_email_templates_process() {
|
||||
$templates_in_theme = 0;
|
||||
$emails = UM()->config()->email_notifications;
|
||||
foreach ( $emails as $email_key => $value ) {
|
||||
|
||||
$in_theme = um_upgrade20beta1_template_in_theme( $email_key, true );
|
||||
$theme_template_path = um_upgrade20beta1_get_template_file( 'theme', $email_key );
|
||||
|
||||
if ( ! $in_theme ) {
|
||||
//there isn't HTML email template's file in theme, get from option
|
||||
//this value is correct for each multisite's subsites
|
||||
$setting_value = UM()->options()->get( $email_key );
|
||||
|
||||
$html_email = UM()->options()->get( 'email_html' );
|
||||
if ( $html_email ) {
|
||||
|
||||
if ( ! um_upgrade20beta1_copy_email_template( $email_key ) ) {
|
||||
|
||||
um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
|
||||
|
||||
} else {
|
||||
|
||||
$templates_in_theme++;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
//there is HTML email template in a theme's folder
|
||||
$theme_template_path_html = um_upgrade20beta1_get_template_file( 'theme', $email_key, true );
|
||||
|
||||
$setting_value = preg_replace( '/<\/body>|<\/head>|<html>|<\/html>|<body.*?>|<head.*?>/' , '', file_get_contents( $theme_template_path_html ) );
|
||||
|
||||
if ( file_exists( $theme_template_path_html ) ) {
|
||||
|
||||
$temp_path = str_replace( trailingslashit( get_stylesheet_directory() ), '', $theme_template_path );
|
||||
$temp_path = str_replace( '/', DIRECTORY_SEPARATOR, $temp_path );
|
||||
$folders = explode( DIRECTORY_SEPARATOR, $temp_path );
|
||||
$folders = array_splice( $folders, 0, count( $folders ) - 1 );
|
||||
$cur_folder = '';
|
||||
$theme_dir = trailingslashit( get_stylesheet_directory() );
|
||||
foreach ( $folders as $folder ) {
|
||||
$prev_dir = $cur_folder;
|
||||
$cur_folder .= $folder . DIRECTORY_SEPARATOR;
|
||||
if ( ! is_dir( $theme_dir . $cur_folder ) && wp_is_writable( $theme_dir . $prev_dir ) ) {
|
||||
mkdir( $theme_dir . $cur_folder, 0777 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( copy( $theme_template_path_html, $theme_template_path ) ) {
|
||||
|
||||
um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
|
||||
|
||||
$templates_in_theme++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$email_html = ( $templates_in_theme > 0 ) ? true : false;
|
||||
UM()->options()->update( 'email_html', $email_html );
|
||||
}
|
||||
|
||||
|
||||
if ( is_multisite() ) {
|
||||
$start_blog_id = get_current_blog_id();
|
||||
|
||||
$blog_ids = get_sites( array(
|
||||
'fields' => 'ids',
|
||||
) );
|
||||
|
||||
foreach ( $blog_ids as $blog_id ) {
|
||||
switch_to_blog( $blog_id );
|
||||
um_upgrade20beta1_email_templates_process();
|
||||
}
|
||||
|
||||
restore_current_blog();
|
||||
} else {
|
||||
um_upgrade20beta1_email_templates_process();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Transferring email templates to new logic
|
||||
*/
|
||||
/*$templates_in_theme = 0;
|
||||
$emails = UM()->config()->email_notifications;
|
||||
foreach ( $emails as $email_key => $value ) {
|
||||
|
||||
$in_theme = UM()->mail()->template_in_theme( $email_key, true );
|
||||
$theme_template_path = UM()->mail()->get_template_file( 'theme', $email_key );
|
||||
$in_theme = um_upgrade20beta1_template_in_theme( $email_key, true );
|
||||
$theme_template_path = um_upgrade20beta1_get_template_file( 'theme', $email_key );
|
||||
|
||||
if ( ! $in_theme ) {
|
||||
//there isn't HTML email template's file in theme, get from option
|
||||
//this value is correct for each multisite's subsites
|
||||
$setting_value = UM()->options()->get( $email_key );
|
||||
|
||||
$html_email = UM()->options()->get( 'email_html' );
|
||||
|
||||
if ( $html_email ) {
|
||||
if ( ! UM()->mail()->copy_email_template( $email_key ) ) {
|
||||
$setting_value = UM()->options()->get( $email_key );
|
||||
|
||||
$fp = fopen( $theme_template_path, "w" );
|
||||
$result = fputs( $fp, $setting_value );
|
||||
fclose( $fp );
|
||||
if ( ! um_upgrade20beta1_copy_email_template( $email_key ) ) {
|
||||
|
||||
um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
|
||||
|
||||
} else {
|
||||
|
||||
$templates_in_theme++;
|
||||
|
||||
}
|
||||
} else {
|
||||
$setting_value = UM()->options()->get( $email_key );
|
||||
|
||||
$fp = @fopen( $theme_template_path, "w" );
|
||||
$result = @fputs( $fp, $setting_value );
|
||||
fclose( $fp );
|
||||
um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$theme_template_path_html = UM()->mail()->get_template_file( 'theme', $email_key, true );
|
||||
//there is HTML email template in a theme's folder
|
||||
$theme_template_path_html = um_upgrade20beta1_get_template_file( 'theme', $email_key, true );
|
||||
|
||||
$setting_value = preg_replace( '/<\/body>|<\/head>|<html>|<\/html>|<body.*?>|<head.*?>/' , '', file_get_contents( $theme_template_path_html ) );
|
||||
|
||||
if ( file_exists( $theme_template_path_html ) ) {
|
||||
|
||||
if ( copy( $theme_template_path_html, $theme_template_path ) ) {
|
||||
$fp = fopen( $theme_template_path, "w" );
|
||||
$result = fputs( $fp, $setting_value );
|
||||
fclose( $fp );
|
||||
|
||||
um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );
|
||||
|
||||
$templates_in_theme++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $templates_in_theme > 0 ) {
|
||||
UM()->options()->update( 'email_html', true );
|
||||
} else {
|
||||
UM()->options()->update( 'email_html', false );
|
||||
}
|
||||
$email_html = ( $templates_in_theme > 0 ) ? true : false;
|
||||
UM()->options()->update( 'email_html', $email_html );*/
|
||||
@@ -136,6 +136,8 @@ function um_upgrade_cpt20beta1() {
|
||||
function um_upgrade_get_forums20beta1() {
|
||||
um_maybe_unset_time_limit();
|
||||
|
||||
remove_all_actions( 'pre_get_posts' );
|
||||
|
||||
$bb_forums = get_posts( array(
|
||||
'post_type' => 'forum',
|
||||
'numberposts' => -1,
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<div class="um-admin-metabox">
|
||||
|
||||
<?php
|
||||
foreach ( UM()->roles()->get_roles( __( 'All roles', 'ultimate-member' ) ) as $key => $value ) {
|
||||
$_um_profile_role = UM()->query()->get_meta_value( '_um_profile_role', $key );
|
||||
if ( ! empty( $_um_profile_role ) )
|
||||
$profile_role = $_um_profile_role;
|
||||
<?php $profile_role_array = array();
|
||||
foreach ( UM()->roles()->get_roles() as $key => $value ) {
|
||||
$_um_profile_role = UM()->query()->get_meta_value( '_um_profile_role', $key );
|
||||
if ( ! empty( $_um_profile_role ) ) {
|
||||
$profile_role_array[] = $_um_profile_role;
|
||||
}
|
||||
}
|
||||
|
||||
UM()->admin_forms( array(
|
||||
@@ -14,8 +15,8 @@
|
||||
array(
|
||||
'id' => '_um_profile_use_custom_settings',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
|
||||
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_profile_use_custom_settings', null, 0 ),
|
||||
'options' => array(
|
||||
0 => __( 'No', 'ultimate-member' ),
|
||||
@@ -23,13 +24,14 @@
|
||||
),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_role',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Please note if you make a profile form specific to a role then you must make sure that every other role is assigned a profile form', 'ultimate-member' ),
|
||||
'value' => ! empty( $profile_role ) ? $profile_role : 0,
|
||||
'options' => UM()->roles()->get_roles( __( 'All roles', 'ultimate-member' ) ),
|
||||
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
|
||||
'id' => '_um_profile_role',
|
||||
'type' => 'select',
|
||||
'multi' => true,
|
||||
'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Please note if you make a profile form specific to a role then you must make sure that every other role is assigned a profile form', 'ultimate-member' ),
|
||||
'value' => $profile_role_array,
|
||||
'options' => UM()->roles()->get_roles(),
|
||||
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
|
||||
),
|
||||
array(
|
||||
'id' => '_um_profile_template',
|
||||
|
||||
@@ -210,7 +210,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'_um_profile_header_menu' => 'bc',
|
||||
'_um_profile_empty_text' => 1,
|
||||
'_um_profile_empty_text_emo' => 1,
|
||||
'_um_profile_role' => '0',
|
||||
'_um_profile_role' => array(),
|
||||
'_um_profile_template' => 'profile',
|
||||
'_um_profile_max_width' => '1000px',
|
||||
'_um_profile_area_max_width' => '600px',
|
||||
|
||||
@@ -39,14 +39,14 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
|
||||
'instagram' => '2.0',
|
||||
'invitations' => '2.0',
|
||||
'mailchimp' => '2.0.1',
|
||||
'messaging' => '2.0.1',
|
||||
'messaging' => '2.0.5',
|
||||
'mycred' => '2.0',
|
||||
'notices' => '2.0.1',
|
||||
'notifications' => '2.0.1',
|
||||
'online' => '2.0',
|
||||
'private-content' => '2.0',
|
||||
'profile-completeness' => '2.0.1',
|
||||
'recaptcha' => '2.0',
|
||||
'recaptcha' => '2.0.2',
|
||||
'reviews' => '2.0.3',
|
||||
'social-activity' => '2.0.1',
|
||||
'social-login' => '2.0.1',
|
||||
@@ -57,7 +57,7 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
|
||||
'woocommerce' => '2.0.1',
|
||||
'restrict-content' => '2.0',
|
||||
'beaver-builder' => '2.0',
|
||||
'gdpr' => '1.0.0',
|
||||
'photos' => '1.1',
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -495,6 +495,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->metabox();
|
||||
$this->admin_upgrade()->init_packages_ajax_handlers();
|
||||
$this->admin_gdpr();
|
||||
$this->columns();
|
||||
} elseif ( $this->is_request( 'admin' ) ) {
|
||||
$this->admin();
|
||||
$this->admin_menu();
|
||||
@@ -533,7 +534,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->permalinks();
|
||||
$this->modal();
|
||||
$this->cron();
|
||||
//$this->tracking();
|
||||
$this->tracking();
|
||||
$this->mobile();
|
||||
$this->external_integrations();
|
||||
$this->gdpr();
|
||||
|
||||
@@ -1022,19 +1022,22 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
}
|
||||
|
||||
//post is private
|
||||
if ( '1' == $restriction['_um_accessible'] ) {
|
||||
if ( '0' == $restriction['_um_accessible'] ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
} elseif ( '1' == $restriction['_um_accessible'] ) {
|
||||
//if post for not logged in users and user is not logged in
|
||||
if ( ! is_user_logged_in() ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
if ( current_user_can( 'administrator' ) ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
}
|
||||
if ( current_user_can( 'administrator' ) ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
}
|
||||
|
||||
//if not single query when exclude if set _um_access_hide_from_queries
|
||||
//if not single query when exclude if set _um_access_hide_from_queries
|
||||
if ( empty( $restriction['_um_access_hide_from_queries'] ) ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
@@ -1044,10 +1047,10 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
//if post for logged in users and user is not logged in
|
||||
if ( is_user_logged_in() ) {
|
||||
|
||||
if ( current_user_can( 'administrator' ) ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
}
|
||||
if ( current_user_can( 'administrator' ) ) {
|
||||
$filtered_items[] = $menu_item;
|
||||
continue;
|
||||
}
|
||||
|
||||
$custom_restrict = $this->um_custom_restriction( $restriction );
|
||||
|
||||
@@ -1078,8 +1081,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
//add all other posts
|
||||
|
||||
@@ -756,7 +756,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
<div class="um-col-alt um-col-alt-b">
|
||||
<div class="um-left">
|
||||
<input type="submit" name="um_account_submit" id="um_account_submit" class="um-button" value="<?php echo ! empty( $tab_data['submit_title'] ) ? $tab_data['submit_title'] : $tab_data['title']; ?>" />
|
||||
<input type="submit" name="um_account_submit" id="um_account_submit_<?php echo $tab_id ?>" class="um-button" value="<?php echo ! empty( $tab_data['submit_title'] ) ? $tab_data['submit_title'] : $tab_data['title']; ?>" />
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -925,7 +925,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
'validate' => 'instagram_url',
|
||||
'url_text' => 'Instagram',
|
||||
'advanced' => 'social',
|
||||
'color' => '#3f729b',
|
||||
'color' => 'radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%,#d6249f 60%,#285AEB 90%)',
|
||||
'match' => 'https://instagram.com/',
|
||||
),
|
||||
|
||||
|
||||
@@ -263,7 +263,9 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
*/
|
||||
function load_selectjs() {
|
||||
|
||||
if ( class_exists( 'WooCommerce' ) ) {
|
||||
$dequeue_select2 = apply_filters( 'um_dequeue_select2_scripts', false );
|
||||
|
||||
if ( class_exists( 'WooCommerce' ) || $dequeue_select2 ) {
|
||||
wp_dequeue_style( 'select2' );
|
||||
wp_deregister_style( 'select2' );
|
||||
|
||||
|
||||
@@ -182,8 +182,38 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
*/
|
||||
function delete_field_from_form( $id, $form_id ) {
|
||||
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
||||
if (isset( $fields[$id] )) {
|
||||
unset( $fields[$id] );
|
||||
|
||||
if ( isset( $fields[ $id ] ) ) {
|
||||
$condition_fields = get_option( 'um_fields' );
|
||||
|
||||
foreach ( $condition_fields as $key => $value ) {
|
||||
$deleted_field = array_search( $id, $value );
|
||||
|
||||
if ( $key != $id && $deleted_field != false ) {
|
||||
$deleted_field_id = str_replace( 'conditional_field', '', $deleted_field );
|
||||
|
||||
if ( $deleted_field_id == '' ) {
|
||||
$arr_id = 0;
|
||||
} else {
|
||||
$arr_id = $deleted_field_id;
|
||||
}
|
||||
|
||||
unset( $condition_fields[ $key ][ 'conditional_action' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ][ $deleted_field ] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ]['conditions'][ $arr_id ] );
|
||||
|
||||
unset( $fields[ $key ][ 'conditional_action' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ][ $deleted_field ] );
|
||||
unset( $fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ]['conditions'][ $arr_id ] );
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'um_fields' , $condition_fields );
|
||||
unset( $fields[ $id ] );
|
||||
UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
|
||||
}
|
||||
}
|
||||
@@ -628,9 +658,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
} elseif ( ( um_user( $key ) || isset( $data['show_anyway'] ) ) && $this->viewing == true ) {
|
||||
|
||||
$value = um_filtered_value( $key, $data );
|
||||
|
||||
return $value;
|
||||
return um_filtered_value( $key, $data );
|
||||
|
||||
} elseif ( isset( UM()->user()->profile[ $key ] ) ) {
|
||||
|
||||
@@ -1106,10 +1134,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
*/
|
||||
function get_label( $key ) {
|
||||
$fields = UM()->builtin()->all_user_fields;
|
||||
if (isset( $fields[$key]['label'] ))
|
||||
return $fields[$key]['label'];
|
||||
if (isset( $fields[$key]['title'] ))
|
||||
return $fields[$key]['title'];
|
||||
if ( isset( $fields[$key]['label'] ) )
|
||||
return stripslashes( $fields[$key]['label'] );
|
||||
if ( isset( $fields[$key]['title'] ) )
|
||||
return stripslashes( $fields[$key]['title'] );
|
||||
|
||||
return '';
|
||||
}
|
||||
@@ -1690,7 +1718,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
case 'select':
|
||||
case 'radio':
|
||||
$form_key = str_replace( 'role_select', 'role', $key );
|
||||
$form_key = str_replace( array( 'role_select', 'role_radio' ), 'role', $key );
|
||||
$field_id = $form_key;
|
||||
break;
|
||||
default:
|
||||
@@ -2571,9 +2599,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
$options = $this->get_available_roles( $form_key, $options );
|
||||
|
||||
// add an empty option!
|
||||
$output .= '<option value=""></option>';
|
||||
|
||||
$field_value = '';
|
||||
@@ -2583,6 +2608,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$options_pair = true;
|
||||
}
|
||||
|
||||
$options = $this->get_available_roles( $form_key, $options );
|
||||
|
||||
// add options
|
||||
if ( ! empty( $options ) ) {
|
||||
foreach ( $options as $k => $v ) {
|
||||
@@ -2890,7 +2917,7 @@ 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', 'role_radio' ) ) ) {
|
||||
if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role' ) ) ) {
|
||||
$um_field_checkbox_item_title = $v;
|
||||
$option_value = $k;
|
||||
}
|
||||
@@ -2910,6 +2937,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$class = "um-icon-android-radio-button-off";
|
||||
}
|
||||
|
||||
|
||||
if (isset( $data['editable'] ) && $data['editable'] == 0) {
|
||||
$col_class .= " um-field-radio-state-disabled";
|
||||
}
|
||||
@@ -4010,23 +4038,23 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
switch ($act_id) {
|
||||
|
||||
case 'um_admin_duplicate_field':
|
||||
UM()->fields()->duplicate_field( $arg1, $arg2 );
|
||||
$this->duplicate_field( $arg1, $arg2 );
|
||||
break;
|
||||
|
||||
case 'um_admin_remove_field_global':
|
||||
UM()->fields()->delete_field_from_db( $arg1 );
|
||||
$this->delete_field_from_db( $arg1 );
|
||||
break;
|
||||
|
||||
case 'um_admin_remove_field':
|
||||
UM()->fields()->delete_field_from_form( $arg1, $arg2 );
|
||||
$this->delete_field_from_form( $arg1, $arg2 );
|
||||
break;
|
||||
|
||||
case 'um_admin_add_field_from_predefined':
|
||||
UM()->fields()->add_field_from_predefined( $arg1, $arg2, $position );
|
||||
$this->add_field_from_predefined( $arg1, $arg2, $position );
|
||||
break;
|
||||
|
||||
case 'um_admin_add_field_from_list':
|
||||
UM()->fields()->add_field_from_list( $arg1, $arg2, $position );
|
||||
$this->add_field_from_list( $arg1, $arg2, $position );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -1133,14 +1133,16 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
function format_bytes( $size , $precision = 1 ) {
|
||||
if ( is_numeric( $size ) ) {
|
||||
$base = log( $size, 1024 );
|
||||
$suffixes = array( '', 'kb', 'MB', 'GB', 'TB' );
|
||||
$computed_size = round( pow( 1024, $base - floor( $base ) ), $precision );
|
||||
$unit = $suffixes[ floor( $base ) ];
|
||||
|
||||
$base = log($size, 1024);
|
||||
$suffixes = array('', 'kb', 'MB', 'GB', 'TB');
|
||||
$computed_size = round(pow(1024, $base - floor($base)), $precision);
|
||||
$unit = $suffixes[ floor($base) ];
|
||||
|
||||
return $computed_size.' '.$unit;
|
||||
return $computed_size.' '.$unit;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
global $wp_roles;
|
||||
$role_keys = array_map( function( $item ) {
|
||||
return 'um_' . $item;
|
||||
}, get_option( 'um_roles' ) );
|
||||
}, get_option( 'um_roles', array() ) );
|
||||
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
|
||||
|
||||
if ( ! empty( $role ) &&
|
||||
|
||||
+104
-98
@@ -36,6 +36,23 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mandrill compatibility
|
||||
*
|
||||
* @param $nl2br
|
||||
* @param string $message
|
||||
* @return bool
|
||||
*/
|
||||
function mandrill_nl2br( $nl2br, $message = '' ) {
|
||||
// text emails
|
||||
if ( ! UM()->options()->get( 'email_html' ) ) {
|
||||
$nl2br = true;
|
||||
}
|
||||
|
||||
return $nl2br;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Init paths for email notifications
|
||||
*/
|
||||
@@ -66,72 +83,73 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Mandrill compatibility
|
||||
* Check blog ID on multisite, return '' if single site
|
||||
*
|
||||
* @param $nl2br
|
||||
* @param string $message
|
||||
* @return bool
|
||||
* @return string
|
||||
*/
|
||||
function mandrill_nl2br( $nl2br, $message = '' ) {
|
||||
// text emails
|
||||
if ( ! UM()->options()->get( 'email_html' ) ) {
|
||||
$nl2br = true;
|
||||
function get_blog_id() {
|
||||
$blog_id = '';
|
||||
if ( is_multisite() ) {
|
||||
$blog_id = '/' . get_current_blog_id();
|
||||
}
|
||||
|
||||
return $nl2br;
|
||||
return $blog_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send Email function
|
||||
* Locate a template and return the path for inclusion.
|
||||
*
|
||||
* @param string $email
|
||||
* @param null $template
|
||||
* @param array $args
|
||||
* @access public
|
||||
* @param string $template_name
|
||||
* @return string
|
||||
*/
|
||||
function send( $email, $template, $args = array() ) {
|
||||
function locate_template( $template_name ) {
|
||||
// check if there is template at theme folder
|
||||
$blog_id = $this->get_blog_id();
|
||||
|
||||
if ( ! is_email( $email ) ) return;
|
||||
if ( UM()->options()->get( $template . '_on' ) != 1 ) return;
|
||||
//get template file from current blog ID folder
|
||||
$template = locate_template( array(
|
||||
trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name . '.php'
|
||||
) );
|
||||
|
||||
$this->attachments = null;
|
||||
$this->headers = 'From: '. UM()->options()->get('mail_from') .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
|
||||
//if there isn't template at theme folder for current blog ID get template file from theme folder
|
||||
if ( is_multisite() && ! $template ) {
|
||||
$template = locate_template( array(
|
||||
trailingslashit( 'ultimate-member/email' ) . $template_name . '.php'
|
||||
) );
|
||||
}
|
||||
|
||||
//if there isn't template at theme folder get template file from plugin dir
|
||||
if ( ! $template ) {
|
||||
$path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
|
||||
$template = trailingslashit( $path ) . $template_name . '.php';
|
||||
}
|
||||
|
||||
// Return what we found.
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_send_subject
|
||||
* @description Change email notification subject
|
||||
* @title um_locate_email_template
|
||||
* @description Change email notification template path
|
||||
* @input_vars
|
||||
* [{"var":"$subject","type":"string","desc":"Subject"},
|
||||
* {"var":"$key","type":"string","desc":"Template Key"}]
|
||||
* [{"var":"$template","type":"string","desc":"Template Path"},
|
||||
* {"var":"$template_name","type":"string","desc":"Template Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_email_send_subject', 'function_name', 10, 2 ); ?>
|
||||
* <?php add_filter( 'um_locate_email_template', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_send_subject', 'my_email_send_subject', 10, 2 );
|
||||
* function my_email_send_subject( $subject, $key ) {
|
||||
* add_filter( 'um_locate_email_template', 'my_locate_email_template', 10, 2 );
|
||||
* function my_email_template_body_attrs( $template, $template_name ) {
|
||||
* // your code here
|
||||
* return $paths;
|
||||
* return $template;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template );
|
||||
$this->subject = um_convert_tags( $subject , $args );
|
||||
|
||||
$this->message = $this->prepare_template( $template, $args );
|
||||
|
||||
if ( UM()->options()->get( 'email_html' ) ) {
|
||||
$this->headers .= "Content-Type: text/html\r\n";
|
||||
} else {
|
||||
$this->headers .= "Content-Type: text/plain\r\n";
|
||||
}
|
||||
|
||||
// Send mail
|
||||
wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
|
||||
return apply_filters( 'um_locate_email_template', $template, $template_name );
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +331,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
|
||||
<body <?php echo $body_attrs ?>>
|
||||
|
||||
<?php echo $this->get_email_template( $slug, $args ); ?>
|
||||
<?php echo $this->get_email_template( $slug, $args ); ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -358,48 +376,55 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Locate a template and return the path for inclusion.
|
||||
* Send Email function
|
||||
*
|
||||
* @access public
|
||||
* @param string $template_name
|
||||
* @return string
|
||||
* @param string $email
|
||||
* @param null $template
|
||||
* @param array $args
|
||||
*/
|
||||
function locate_template( $template_name ) {
|
||||
// check if there is template at theme folder
|
||||
$template = locate_template( array(
|
||||
trailingslashit( 'ultimate-member/email' ) . $template_name . '.php'
|
||||
) );
|
||||
function send( $email, $template, $args = array() ) {
|
||||
|
||||
//if there isn't template at theme folder get template file from plugin dir
|
||||
if ( ! $template ) {
|
||||
$path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
|
||||
$template = trailingslashit( $path ) . $template_name . '.php';
|
||||
}
|
||||
if ( ! is_email( $email ) ) return;
|
||||
if ( UM()->options()->get( $template . '_on' ) != 1 ) return;
|
||||
|
||||
$this->attachments = null;
|
||||
$this->headers = 'From: '. UM()->options()->get('mail_from') .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n";
|
||||
|
||||
// Return what we found.
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_locate_email_template
|
||||
* @description Change email notification template path
|
||||
* @title um_email_send_subject
|
||||
* @description Change email notification subject
|
||||
* @input_vars
|
||||
* [{"var":"$template","type":"string","desc":"Template Path"},
|
||||
* {"var":"$template_name","type":"string","desc":"Template Name"}]
|
||||
* [{"var":"$subject","type":"string","desc":"Subject"},
|
||||
* {"var":"$key","type":"string","desc":"Template Key"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_locate_email_template', 'function_name', 10, 2 ); ?>
|
||||
* <?php add_filter( 'um_email_send_subject', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_locate_email_template', 'my_locate_email_template', 10, 2 );
|
||||
* function my_email_template_body_attrs( $template, $template_name ) {
|
||||
* add_filter( 'um_email_send_subject', 'my_email_send_subject', 10, 2 );
|
||||
* function my_email_send_subject( $subject, $key ) {
|
||||
* // your code here
|
||||
* return $template;
|
||||
* return $paths;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_locate_email_template', $template, $template_name );
|
||||
$subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template );
|
||||
$this->subject = um_convert_tags( $subject , $args );
|
||||
|
||||
$this->message = $this->prepare_template( $template, $args );
|
||||
|
||||
if ( UM()->options()->get( 'email_html' ) ) {
|
||||
$this->headers .= "Content-Type: text/html\r\n";
|
||||
} else {
|
||||
$this->headers .= "Content-Type: text/plain\r\n";
|
||||
}
|
||||
|
||||
// Send mail
|
||||
wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
|
||||
}
|
||||
|
||||
|
||||
@@ -439,16 +464,16 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
*
|
||||
* @access public
|
||||
* @param string $template_name
|
||||
* @param bool $html
|
||||
* @return string
|
||||
*/
|
||||
function template_in_theme( $template_name, $html = false ) {
|
||||
function template_in_theme( $template_name ) {
|
||||
$template_name_file = $this->get_template_filename( $template_name );
|
||||
$ext = ! $html ? '.php' : '.html';
|
||||
|
||||
// check if there is template at theme folder
|
||||
$blog_id = $this->get_blog_id();
|
||||
|
||||
// check if there is template at theme blog ID folder
|
||||
$template = locate_template( array(
|
||||
trailingslashit( 'ultimate-member/email' ) . $template_name_file . $ext
|
||||
trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . '.php'
|
||||
) );
|
||||
|
||||
// Return what we found.
|
||||
@@ -460,24 +485,26 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
* Method returns expected path for template
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $location
|
||||
* @param string $template_name
|
||||
* @param bool $html
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_template_file( $location, $template_name, $html = false ) {
|
||||
function get_template_file( $location, $template_name ) {
|
||||
$template_path = '';
|
||||
$template_name_file = $this->get_template_filename( $template_name );
|
||||
|
||||
$ext = ! $html ? '.php' : '.html';
|
||||
|
||||
switch( $location ) {
|
||||
case 'theme':
|
||||
$template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' ). $template_name_file . $ext;
|
||||
//save email template in blog ID folder if we use multisite
|
||||
$blog_id = $this->get_blog_id();
|
||||
|
||||
$template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' . $blog_id ). $template_name_file . '.php';
|
||||
break;
|
||||
case 'plugin':
|
||||
$path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email';
|
||||
$template_path = trailingslashit( $path ) . $template_name . $ext;
|
||||
$template_path = trailingslashit( $path ) . $template_name . '.php';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -488,10 +515,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
/**
|
||||
* Ajax copy template to the theme
|
||||
*
|
||||
* @param bool $template
|
||||
* @param string $template
|
||||
* @return bool
|
||||
*/
|
||||
function copy_email_template( $template = false ) {
|
||||
function copy_email_template( $template ) {
|
||||
|
||||
$in_theme = $this->template_in_theme( $template );
|
||||
if ( $in_theme ) {
|
||||
@@ -522,26 +549,5 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete Email Notification Template
|
||||
*/
|
||||
function delete_email_template() {
|
||||
$template = $_POST['email_key'];
|
||||
|
||||
$in_theme = $this->template_in_theme( $template );
|
||||
if ( ! $in_theme ) {
|
||||
wp_send_json_error( new \WP_Error( 'template_in_theme', __( 'Template does not exists in theme', 'ultimate-member' ) ) );
|
||||
}
|
||||
|
||||
$theme_template_path = $this->get_template_file( 'theme', $template );
|
||||
|
||||
if ( unlink( $theme_template_path ) ) {
|
||||
wp_send_json_success();
|
||||
} else {
|
||||
wp_send_json_error( new \WP_Error( 'template_not_exists', __( 'Can not remove template from theme', 'ultimate-member' ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,10 @@ if ( ! class_exists( 'um\core\Password' ) ) {
|
||||
|
||||
UM()->form()->post_form = $_POST;
|
||||
|
||||
if ( empty( UM()->form()->post_form['mode'] ) ) {
|
||||
UM()->form()->post_form['mode'] = 'password';
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
|
||||
@@ -130,51 +130,10 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
||||
* @return mixed|void
|
||||
*/
|
||||
function get_current_url( $no_query_params = false ) {
|
||||
/*
|
||||
* future fix
|
||||
* global $wp;
|
||||
echo home_url( $wp->request );
|
||||
*/
|
||||
$server_name_method = UM()->options()->get( 'current_url_method' );
|
||||
$server_name_method = ! empty( $server_name_method ) ? $server_name_method : 'SERVER_NAME';
|
||||
//use WP native function for fill $_SERVER variables by correct values
|
||||
wp_fix_server_vars();
|
||||
|
||||
$um_port_forwarding_url = UM()->options()->get( 'um_port_forwarding_url' );
|
||||
$um_port_forwarding_url = ! empty( $um_port_forwarding_url ) ? $um_port_forwarding_url : '';
|
||||
|
||||
$page_url = '';
|
||||
if ( is_multisite() ) {
|
||||
$blog_id = get_current_blog_id();
|
||||
$siteurl = get_site_url( $blog_id );
|
||||
|
||||
$network_permalink_structure = UM()->options()->get( 'network_permalink_structure' );
|
||||
|
||||
if( $network_permalink_structure == "sub-directory" ){
|
||||
$page_url .= "//";
|
||||
$page_url .= $_SERVER[ $server_name_method ];
|
||||
}else{
|
||||
$page_url .= $siteurl;
|
||||
}
|
||||
|
||||
if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
|
||||
$page_url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
||||
} else {
|
||||
$page_url .= $_SERVER["REQUEST_URI"];
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( !isset( $_SERVER['SERVER_NAME'] ) )
|
||||
return '';
|
||||
|
||||
$page_url .= "//";
|
||||
|
||||
if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
|
||||
$page_url .= $_SERVER[ $server_name_method ].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
||||
|
||||
} else {
|
||||
$page_url .= $_SERVER[ $server_name_method ].$_SERVER["REQUEST_URI"];
|
||||
}
|
||||
|
||||
}
|
||||
$page_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
|
||||
if ( $no_query_params == true ) {
|
||||
$page_url = strtok( $page_url, '?' );
|
||||
@@ -201,7 +160,7 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
return apply_filters( 'um_get_current_page_url', set_url_scheme( $page_url ) );
|
||||
return apply_filters( 'um_get_current_page_url', $page_url );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -118,18 +118,20 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
|
||||
// disable private tabs
|
||||
if ( ! is_admin() ) {
|
||||
if( is_user_logged_in() ) {
|
||||
$user_id = um_user('ID');
|
||||
um_fetch_user( get_current_user_id() );
|
||||
}
|
||||
if ( is_user_logged_in() ) {
|
||||
$user_id = um_user('ID');
|
||||
um_fetch_user( get_current_user_id() );
|
||||
}
|
||||
|
||||
foreach ( $tabs as $id => $tab ) {
|
||||
if ( ! $this->can_view_tab( $id ) ) {
|
||||
unset( $tabs[$id] );
|
||||
unset( $tabs[ $id ] );
|
||||
}
|
||||
}
|
||||
if( is_user_logged_in() ) {
|
||||
um_fetch_user( $user_id );
|
||||
}
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
um_fetch_user( $user_id );
|
||||
}
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
@@ -143,10 +145,13 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
*/
|
||||
function tabs_active() {
|
||||
$tabs = $this->tabs();
|
||||
foreach( $tabs as $id => $info ) {
|
||||
if ( ! UM()->options()->get('profile_tab_'.$id) && !isset( $info['_builtin'] ) && !isset( $info['custom'] ) )
|
||||
|
||||
foreach ( $tabs as $id => $info ) {
|
||||
if ( ! UM()->options()->get( 'profile_tab_' . $id ) && ! isset( $info['_builtin'] ) && ! isset( $info['custom'] ) ) {
|
||||
unset( $tabs[ $id ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
@@ -212,28 +217,38 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
* @return bool
|
||||
*/
|
||||
function can_view_tab( $tab ) {
|
||||
$privacy = intval( UM()->options()->get( 'profile_tab_' . $tab . '_privacy' ) );
|
||||
|
||||
$target_id = UM()->user()->target_id;
|
||||
if ( empty( $target_id ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$can_view = false;
|
||||
|
||||
switch( $privacy ) {
|
||||
$privacy = intval( UM()->options()->get( 'profile_tab_' . $tab . '_privacy' ) );
|
||||
switch ( $privacy ) {
|
||||
case 0:
|
||||
$can_view = true;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$can_view = is_user_logged_in() ? false : true;
|
||||
$can_view = ! is_user_logged_in();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$can_view = is_user_logged_in() ? true : false;
|
||||
$can_view = is_user_logged_in();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$can_view = get_current_user_id() == um_user( 'ID' ) ? true : false;
|
||||
$can_view = is_user_logged_in() && get_current_user_id() === $target_id;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$can_view = false;
|
||||
if( is_user_logged_in() ) {
|
||||
$roles = UM()->options()->get( 'profile_tab_' . $tab . '_roles' );
|
||||
if( is_array( $roles )
|
||||
&& in_array( UM()->user()->get_role(), $roles ) ) {
|
||||
if ( is_user_logged_in() ) {
|
||||
$roles = (array) UM()->options()->get( 'profile_tab_' . $tab . '_roles' );
|
||||
|
||||
$current_user_roles = um_user( 'roles' );
|
||||
if ( ! empty( $current_user_roles ) && count( array_intersect( $current_user_roles, $roles ) ) > 0 ) {
|
||||
$can_view = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ if ( ! class_exists( 'um\core\REST_API' ) ) {
|
||||
add_action( 'template_redirect', array( $this, 'process_query' ), -1 );
|
||||
add_filter( 'query_vars', array( $this, 'query_vars' ) );
|
||||
|
||||
add_filter( 'um_user_profile_additional_fields', array( $this, 'user_key_field' ), 3, 2 );
|
||||
//add_filter( 'um_user_profile_additional_fields', array( $this, 'user_key_field' ), 3, 2 );
|
||||
|
||||
add_action( 'personal_options_update', array( $this, 'update_key' ) );
|
||||
add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
|
||||
//add_action( 'personal_options_update', array( $this, 'update_key' ) );
|
||||
//add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
|
||||
|
||||
// Determine if JSON_PRETTY_PRINT is available
|
||||
$this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
|
||||
|
||||
@@ -205,6 +205,30 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
|
||||
$user_id = username_exists( um_queried_user() );
|
||||
|
||||
//Try
|
||||
if ( ! $user_id ) {
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
|
||||
// Search by Profile Slug
|
||||
$args = array(
|
||||
"fields" => 'ids',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'um_user_profile_url_slug_'.$permalink_base,
|
||||
'value' => strtolower( um_queried_user() ),
|
||||
'compare' => '='
|
||||
)
|
||||
),
|
||||
'number' => 1
|
||||
);
|
||||
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
if ( $ids->total_users > 0 ) {
|
||||
$user_id = current( $ids->get_results() );
|
||||
}
|
||||
}
|
||||
|
||||
// Try nice name
|
||||
if ( !$user_id ) {
|
||||
$slug = um_queried_user();
|
||||
|
||||
@@ -418,6 +418,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
||||
$um_roles_keys = array_map( function( $item ) {
|
||||
return 'um_' . $item;
|
||||
}, $um_roles_keys );
|
||||
|
||||
}
|
||||
|
||||
$orders = array();
|
||||
@@ -571,21 +572,25 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
||||
* @return bool|int
|
||||
*/
|
||||
function um_current_user_can( $cap, $user_id ) {
|
||||
if ( ! is_user_logged_in() )
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = 1;
|
||||
|
||||
um_fetch_user( get_current_user_id() );
|
||||
|
||||
$current_user_roles = UM()->roles()->get_all_user_roles( $user_id );
|
||||
|
||||
switch( $cap ) {
|
||||
case 'edit':
|
||||
if ( get_current_user_id() == $user_id && um_user( 'can_edit_profile' ) )
|
||||
$return = 1;
|
||||
elseif ( ! um_user( 'can_edit_everyone' ) )
|
||||
elseif ( get_current_user_id() == $user_id && ! um_user( 'can_edit_profile' ) )
|
||||
$return = 0;
|
||||
elseif ( get_current_user_id() == $user_id && ! um_user( 'can_edit_profile') )
|
||||
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;
|
||||
@@ -618,6 +623,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
||||
|
||||
$user_id = get_current_user_id();
|
||||
$role = UM()->roles()->get_priority_user_role( $user_id );
|
||||
|
||||
$permissions = $this->role_data( $role );
|
||||
|
||||
/**
|
||||
@@ -647,6 +653,9 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
||||
if ( isset( $permissions[ $permission ] ) && is_serialized( $permissions[ $permission ] ) )
|
||||
return unserialize( $permissions[ $permission ] );
|
||||
|
||||
if ( isset( $permissions[ $permission ] ) && is_array( $permissions[ $permission ] ) )
|
||||
return $permissions[ $permission ];
|
||||
|
||||
if ( isset( $permissions[ $permission ] ) && $permissions[ $permission ] == 1 )
|
||||
return true;
|
||||
|
||||
|
||||
@@ -522,8 +522,18 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
$use_custom = get_post_meta( $this->form_id, "_um_{$mode}_use_custom_settings", true );
|
||||
if ( $use_custom ) { // Custom Form settings
|
||||
$current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() );
|
||||
if ( ! empty( $args['role'] ) && ! in_array( $args['role'], $current_user_roles ) ) {
|
||||
return '';
|
||||
|
||||
//backward compatibility between single/multi role form's setting
|
||||
if ( ! empty( $args['role'] ) ) {
|
||||
if ( is_array( $args['role'] ) ) {
|
||||
if ( ! count( array_intersect( $args['role'], $current_user_roles ) ) ) {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
if ( ! in_array( $args['role'], $current_user_roles ) ) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ if ( ! class_exists( 'um\core\Tracking' ) ) {
|
||||
|
||||
$request = wp_remote_post( 'https://ultimatemember.com/?um_action=checkin', array(
|
||||
'method' => 'POST',
|
||||
'timeout' => 20,
|
||||
'timeout' => 45,
|
||||
'redirection' => 5,
|
||||
'httpversion' => '1.0',
|
||||
'blocking' => true,
|
||||
|
||||
@@ -1467,6 +1467,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
function get_admin_actions() {
|
||||
$items = array();
|
||||
$actions = array();
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -1488,12 +1489,16 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$actions = apply_filters('um_admin_user_actions_hook', $actions );
|
||||
if ( !isset( $actions ) || empty( $actions ) ) return false;
|
||||
foreach($actions as $id => $arr ) {
|
||||
$url = add_query_arg('um_action', $id );
|
||||
$url = add_query_arg('uid', um_profile_id(), $url );
|
||||
$items[] = '<a href="' . $url .'" class="real_url '.$id.'-item">' . $arr['label'] . '</a>';
|
||||
$actions = apply_filters( 'um_admin_user_actions_hook', $actions );
|
||||
if ( ! isset( $actions ) || empty( $actions ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $actions as $id => $arr ) {
|
||||
$url = add_query_arg( array( 'um_action' => $id, 'uid' => um_profile_id() ) );
|
||||
/*$url = add_query_arg( 'um_action', $id );
|
||||
$url = add_query_arg( 'uid', um_profile_id(), $url );*/
|
||||
$items[] = '<a href="' . $url .'" class="real_url ' . esc_attr( $id ) . '-item">' . $arr['label'] . '</a>';
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
@@ -1652,18 +1657,12 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*/
|
||||
$changes = apply_filters('um_before_update_profile', $changes, $this->id );
|
||||
|
||||
// save or update profile meta
|
||||
foreach ( $changes as $key => $value ) {
|
||||
if ( ! in_array( $key, $this->update_user_keys ) ) {
|
||||
|
||||
update_user_meta( $this->id, $key, $value );
|
||||
|
||||
} else {
|
||||
|
||||
$args[$key] = esc_attr( $changes[$key] );
|
||||
|
||||
$args[ $key ] = esc_attr( $changes[ $key ] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,32 +9,34 @@ function um_action_request_process() {
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $_REQUEST['um_action'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['uid'] ) && ! UM()->user()->user_exists_by_id( $_REQUEST['uid'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $_REQUEST['uid'] ) ) {
|
||||
if ( is_super_admin( $_REQUEST['uid'] ) ) {
|
||||
wp_die( __( 'Super administrators can not be modified.','ultimate-member' ) );
|
||||
wp_die( __( 'Super administrators can not be modified.', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['um_action'] ) && $_REQUEST['um_action'] != "edit" && ! current_user_can( 'edit_users' ) ) {
|
||||
wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
|
||||
}
|
||||
// if ( isset( $_REQUEST['um_action'] ) && $_REQUEST['um_action'] != "edit" && ! current_user_can( 'edit_users' ) ) {
|
||||
// wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
|
||||
// }
|
||||
|
||||
if ( isset( $_REQUEST['uid'] ) ) {
|
||||
$uid = $_REQUEST['uid'];
|
||||
}
|
||||
|
||||
|
||||
switch ( $_REQUEST['um_action'] ) {
|
||||
|
||||
default:
|
||||
$uid = isset( $_REQUEST['uid'] ) ? $_REQUEST['uid'] : 0;
|
||||
/**
|
||||
@@ -59,63 +61,90 @@ function um_action_request_process() {
|
||||
*/
|
||||
do_action( 'um_action_user_request_hook', $_REQUEST['um_action'], $uid );
|
||||
break;
|
||||
|
||||
|
||||
case 'edit':
|
||||
UM()->fields()->editing = true;
|
||||
if ( !um_can_edit_my_profile() ) {
|
||||
$url = um_edit_my_profile_cancel_uri();
|
||||
exit( wp_redirect( $url ) );
|
||||
if ( ! um_is_myprofile() ) {
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
}
|
||||
} else {
|
||||
if ( ! um_can_edit_my_profile() ) {
|
||||
$url = um_edit_my_profile_cancel_uri();
|
||||
exit( wp_redirect( $url ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'um_switch_user':
|
||||
if ( !current_user_can('delete_users') ) {
|
||||
if ( ! current_user_can( 'delete_users' ) ) {
|
||||
return;
|
||||
}
|
||||
UM()->user()->auto_login( $_REQUEST['uid'] );
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
|
||||
case 'um_reject_membership':
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->reject();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
|
||||
case 'um_approve_membership':
|
||||
case 'um_reenable':
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->approve();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->approve();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_put_as_pending':
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->pending();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
|
||||
case 'um_resend_activation':
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->email_pending();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
|
||||
case 'um_deactivate':
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->deactivate();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
|
||||
case 'um_delete':
|
||||
if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) {
|
||||
wp_die( __('You do not have permission to delete this user.','ultimate-member') );
|
||||
wp_die( __( 'You do not have permission to delete this user.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->delete();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'init', 'um_action_request_process', 10 );
|
||||
add_action( 'template_redirect', 'um_action_request_process', 10000 );
|
||||
@@ -1064,113 +1064,104 @@ add_action( 'um_pre_profile_shortcode', 'um_pre_profile_shortcode' );
|
||||
* @param $args
|
||||
*/
|
||||
function um_add_edit_icon( $args ) {
|
||||
$output = '';
|
||||
|
||||
if (!is_user_logged_in()) return; // not allowed for guests
|
||||
|
||||
if (isset( UM()->user()->cannot_edit ) && UM()->user()->cannot_edit == 1) return; // do not proceed if user cannot edit
|
||||
|
||||
if (UM()->fields()->editing == true) {
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-profile-edit um-profile-headericon">
|
||||
|
||||
<a href="#" class="um-profile-edit-a um-profile-save"><i class="um-faicon-check"></i></a>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="um-profile-edit um-profile-headericon">
|
||||
|
||||
<a href="#" class="um-profile-edit-a"><i class="um-faicon-cog"></i></a>
|
||||
|
||||
<?php
|
||||
|
||||
$items = array(
|
||||
'editprofile' => '<a href="' . um_edit_profile_url() . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>',
|
||||
'myaccount' => '<a href="' . um_get_core_page( 'account' ) . '" class="real_url">' . __( 'My Account', 'ultimate-member' ) . '</a>',
|
||||
'logout' => '<a href="' . um_get_core_page( 'logout' ) . '" class="real_url">' . __( 'Logout', 'ultimate-member' ) . '</a>',
|
||||
'cancel' => '<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
$cancel = $items['cancel'];
|
||||
|
||||
if (!um_is_myprofile()) {
|
||||
|
||||
$actions = UM()->user()->get_admin_actions();
|
||||
|
||||
unset( $items['myaccount'] );
|
||||
unset( $items['logout'] );
|
||||
unset( $items['cancel'] );
|
||||
|
||||
if (is_array( $actions )) {
|
||||
$items = array_merge( $items, $actions );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_edit_menu_items
|
||||
* @description Edit menu items on profile page
|
||||
* @input_vars
|
||||
* [{"var":"$items","type":"array","desc":"User Menu"},
|
||||
* {"var":"$user_id","type":"int","desc":"Profile ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_edit_menu_items', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_edit_menu_items', 'my_profile_edit_menu_items', 10, 2 );
|
||||
* function my_profile_edit_menu_items( $items, $user_id ) {
|
||||
* // your code here
|
||||
* return $items;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$items = apply_filters( 'um_profile_edit_menu_items', $items, um_profile_id() );
|
||||
|
||||
$items['cancel'] = $cancel;
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_myprofile_edit_menu_items
|
||||
* @description Edit menu items on my profile page
|
||||
* @input_vars
|
||||
* [{"var":"$items","type":"array","desc":"User Menu"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_myprofile_edit_menu_items', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_myprofile_edit_menu_items', 'my_myprofile_edit_menu_items', 10, 1 );
|
||||
* function my_myprofile_edit_menu_items( $items ) {
|
||||
* // your code here
|
||||
* return $items;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$items = apply_filters( 'um_myprofile_edit_menu_items', $items );
|
||||
|
||||
}
|
||||
|
||||
UM()->profile()->new_ui( $args['header_menu'], 'div.um-profile-edit', 'click', $items );
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ( ! is_user_logged_in() ) {
|
||||
// not allowed for guests
|
||||
return;
|
||||
}
|
||||
|
||||
// do not proceed if user cannot edit
|
||||
|
||||
if ( UM()->fields()->editing == true ) { ?>
|
||||
|
||||
<div class="um-profile-edit um-profile-headericon">
|
||||
<a href="#" class="um-profile-edit-a um-profile-save"><i class="um-faicon-check"></i></a>
|
||||
</div>
|
||||
|
||||
<?php return;
|
||||
}
|
||||
|
||||
if ( ! um_is_myprofile() ) {
|
||||
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) && ! UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$items = UM()->user()->get_admin_actions();
|
||||
if ( UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
|
||||
$items['editprofile'] = '<a href="' . um_edit_profile_url() . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_profile_edit_menu_items
|
||||
* @description Edit menu items on profile page
|
||||
* @input_vars
|
||||
* [{"var":"$items","type":"array","desc":"User Menu"},
|
||||
* {"var":"$user_id","type":"int","desc":"Profile ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_profile_edit_menu_items', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_profile_edit_menu_items', 'my_profile_edit_menu_items', 10, 2 );
|
||||
* function my_profile_edit_menu_items( $items, $user_id ) {
|
||||
* // your code here
|
||||
* return $items;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$items = apply_filters( 'um_profile_edit_menu_items', $items, um_profile_id() );
|
||||
|
||||
$items['cancel'] = '<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>';
|
||||
|
||||
} else {
|
||||
$items = array(
|
||||
'editprofile' => '<a href="' . um_edit_profile_url() . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>',
|
||||
'myaccount' => '<a href="' . um_get_core_page( 'account' ) . '" class="real_url">' . __( 'My Account', 'ultimate-member' ) . '</a>',
|
||||
'logout' => '<a href="' . um_get_core_page( 'logout' ) . '" class="real_url">' . __( 'Logout', 'ultimate-member' ) . '</a>',
|
||||
'cancel' => '<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
if ( ! empty( UM()->user()->cannot_edit ) ) {
|
||||
unset( $items['editprofile'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_myprofile_edit_menu_items
|
||||
* @description Edit menu items on my profile page
|
||||
* @input_vars
|
||||
* [{"var":"$items","type":"array","desc":"User Menu"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_myprofile_edit_menu_items', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_myprofile_edit_menu_items', 'my_myprofile_edit_menu_items', 10, 1 );
|
||||
* function my_myprofile_edit_menu_items( $items ) {
|
||||
* // your code here
|
||||
* return $items;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$items = apply_filters( 'um_myprofile_edit_menu_items', $items );
|
||||
} ?>
|
||||
|
||||
<div class="um-profile-edit um-profile-headericon">
|
||||
|
||||
<a href="#" class="um-profile-edit-a"><i class="um-faicon-cog"></i></a>
|
||||
|
||||
<?php UM()->profile()->new_ui( $args['header_menu'], 'div.um-profile-edit', 'click', $items ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
add_action( 'um_pre_header_editprofile', 'um_add_edit_icon' );
|
||||
|
||||
@@ -1277,8 +1268,9 @@ add_action( 'um_after_profile_fields', 'um_add_submit_button_to_profile', 1000 )
|
||||
* @param array $args
|
||||
*/
|
||||
function um_profile_menu( $args ) {
|
||||
if ( ! UM()->options()->get( 'profile_menu' ) )
|
||||
if ( ! UM()->options()->get( 'profile_menu' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get active tabs
|
||||
$tabs = UM()->profile()->tabs_active();
|
||||
|
||||
@@ -146,8 +146,9 @@ add_filter( 'um_profile_field_filter_hook___um_last_login', 'um_profile_field_fi
|
||||
* @return mixed|string|void
|
||||
*/
|
||||
function um_profile_field_filter_hook__textarea( $value, $data ) {
|
||||
if ( isset( $data ) && isset( $data['html'] ) && $data['html'] == 1 )
|
||||
if ( isset( $data['html'] ) && $data['html'] == 1 ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$value = esc_textarea( $value );
|
||||
$value = preg_replace('$(https?://[a-z0-9_./?=&#-]+)(?![^<>]*>)$i', ' <a href="$1" target="_blank">$1</a> ', $value." ");
|
||||
@@ -612,10 +613,12 @@ function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) {
|
||||
|
||||
if( 'text' == $type && ! in_array( $data['validate'], array( 'unique_email' ) ) || 'password' == $type ) {
|
||||
$value = esc_attr( $value );
|
||||
}elseif( $type == 'url' ) {
|
||||
} elseif( $type == 'url' ) {
|
||||
$value = esc_url( $value );
|
||||
} elseif ( 'textarea' == $type ){
|
||||
$value = wp_kses_post( $value );
|
||||
} elseif ( 'textarea' == $type ) {
|
||||
if ( empty( $data['html'] ) ) {
|
||||
$value = wp_kses_post( $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,49 +9,47 @@
|
||||
* @return null
|
||||
*/
|
||||
function um_admin_user_actions_hook( $actions ) {
|
||||
|
||||
$actions = null;
|
||||
|
||||
um_fetch_user( um_profile_id() );
|
||||
|
||||
if ( current_user_can('manage_options') ) {
|
||||
//if ( UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
|
||||
if ( um_user('account_status') == 'awaiting_admin_review' ){
|
||||
$actions['um_approve_membership'] = array( 'label' => __('Approve Membership','ultimate-member') );
|
||||
$actions['um_reject_membership'] = array( 'label' => __('Reject Membership','ultimate-member') );
|
||||
if ( um_user( 'account_status' ) == 'awaiting_admin_review' ) {
|
||||
$actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
|
||||
$actions['um_reject_membership'] = array( 'label' => __( 'Reject Membership', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user('account_status') == 'rejected' ) {
|
||||
$actions['um_approve_membership'] = array( 'label' => __('Approve Membership','ultimate-member') );
|
||||
if ( um_user( 'account_status' ) == 'rejected' ) {
|
||||
$actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user('account_status') == 'approved' ) {
|
||||
$actions['um_put_as_pending'] = array( 'label' => __('Put as Pending Review','ultimate-member') );
|
||||
if ( um_user( 'account_status' ) == 'approved' ) {
|
||||
$actions['um_put_as_pending'] = array( 'label' => __( 'Put as Pending Review', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user('account_status') == 'awaiting_email_confirmation' ) {
|
||||
$actions['um_resend_activation'] = array( 'label' => __('Resend Activation E-mail','ultimate-member') );
|
||||
if ( um_user( 'account_status' ) == 'awaiting_email_confirmation' ) {
|
||||
$actions['um_resend_activation'] = array( 'label' => __( 'Resend Activation E-mail', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user('account_status') != 'inactive' ) {
|
||||
$actions['um_deactivate'] = array( 'label' => __('Deactivate this account','ultimate-member') );
|
||||
if ( um_user( 'account_status' ) != 'inactive' ) {
|
||||
$actions['um_deactivate'] = array( 'label' => __( 'Deactivate this account', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user('account_status') == 'inactive' ) {
|
||||
$actions['um_reenable'] = array( 'label' => __('Reactivate this account','ultimate-member') );
|
||||
}
|
||||
|
||||
if ( UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) {
|
||||
$actions['um_delete'] = array( 'label' => __('Delete this user','ultimate-member') );
|
||||
if ( um_user( 'account_status' ) == 'inactive' ) {
|
||||
$actions['um_reenable'] = array( 'label' => __( 'Reactivate this account', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( current_user_can('delete_users') ) {
|
||||
$actions['um_switch_user'] = array( 'label' => __('Login as this user','ultimate-member') );
|
||||
if ( UM()->roles()->um_current_user_can( 'delete', um_profile_id() ) ) {
|
||||
$actions['um_delete'] = array( 'label' => __( 'Delete this user', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
|
||||
if ( current_user_can( 'delete_users' ) ) {
|
||||
$actions['um_switch_user'] = array( 'label' => __( 'Login as this user', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
@@ -705,10 +705,11 @@ function um_filtered_value( $key, $data = false ) {
|
||||
* @return bool|int|null
|
||||
*/
|
||||
function um_profile_id() {
|
||||
$requested_user = um_get_requested_user();
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
if ( $requested_user ) {
|
||||
return um_get_requested_user();
|
||||
} else if (is_user_logged_in() && get_current_user_id()) {
|
||||
} elseif ( is_user_logged_in() && get_current_user_id() ) {
|
||||
return get_current_user_id();
|
||||
}
|
||||
|
||||
@@ -1063,10 +1064,11 @@ function um_requesting_password_reset() {
|
||||
* @return bool
|
||||
*/
|
||||
function um_requesting_password_change() {
|
||||
if (um_is_core_page( 'account' ) && isset( $_POST['_um_account'] ) == 1)
|
||||
if ( um_is_core_page( 'account' ) && isset( $_POST['_um_account'] ) == 1 & isset( $_POST['_um_account_tab'] ) == 'password' ) {
|
||||
return true;
|
||||
else if (isset( $_POST['_um_password_change'] ) && $_POST['_um_password_change'] == 1)
|
||||
} elseif ( isset( $_POST['_um_password_change'] ) && $_POST['_um_password_change'] == 1 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1766,102 +1768,108 @@ function um_get_default_avatar_uri() {
|
||||
* @return bool|string
|
||||
*/
|
||||
function um_get_user_avatar_data( $user_id = '', $size = '96' ) {
|
||||
if( empty( $user_id ) ) {
|
||||
$user_id = um_user( 'ID' );
|
||||
} else {
|
||||
um_fetch_user( $user_id );
|
||||
}
|
||||
if( empty( $user_id ) ) {
|
||||
$user_id = um_user( 'ID' );
|
||||
} else {
|
||||
um_fetch_user( $user_id );
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'user_id' => $user_id,
|
||||
'default' => um_get_default_avatar_uri(),
|
||||
'class' => 'gravatar avatar avatar-' . $size . ' um-avatar',
|
||||
'size' => $size
|
||||
);
|
||||
$data = array(
|
||||
'user_id' => $user_id,
|
||||
'default' => um_get_default_avatar_uri(),
|
||||
'class' => 'gravatar avatar avatar-' . $size . ' um-avatar',
|
||||
'size' => $size
|
||||
);
|
||||
|
||||
if ( $profile_photo = um_profile( 'profile_photo' ) ) {
|
||||
$data['url'] = um_get_avatar_uri( $profile_photo, $size );
|
||||
$data['type'] = 'upload';
|
||||
$data['class'] .= ' um-avatar-uploaded';
|
||||
} else if( $synced_profile_photo = um_user( 'synced_profile_photo' ) ) {
|
||||
$data['url'] = $synced_profile_photo;
|
||||
$data['type'] = 'sync';
|
||||
$data['class'] .= ' um-avatar-default';
|
||||
} else if( UM()->options()->get( 'use_gravatars' ) ) {
|
||||
$avatar_hash_id = get_user_meta( $user_id, 'synced_gravatar_hashed_id', true );
|
||||
$data['url'] = set_url_scheme( '//gravatar.com/avatar/' . $avatar_hash_id );
|
||||
$data['url'] = add_query_arg( 's', 400, $data['url'] );
|
||||
$rating = get_option('avatar_rating');
|
||||
if ( !empty( $rating ) ) {
|
||||
$data['type'] = 'upload';
|
||||
$data['class'] .= ' um-avatar-uploaded';
|
||||
} elseif ( $synced_profile_photo = um_user( 'synced_profile_photo' ) ) {
|
||||
$data['url'] = $synced_profile_photo;
|
||||
$data['type'] = 'sync';
|
||||
$data['class'] .= ' um-avatar-default';
|
||||
} elseif ( UM()->options()->get( 'use_gravatars' ) ) {
|
||||
$avatar_hash_id = md5( um_user( 'user_email' ) );
|
||||
$data['url'] = set_url_scheme( '//gravatar.com/avatar/' . $avatar_hash_id );
|
||||
$data['url'] = add_query_arg( 's', 400, $data['url'] );
|
||||
$rating = get_option( 'avatar_rating' );
|
||||
if ( ! empty( $rating ) ) {
|
||||
$data['url'] = add_query_arg( 'r', $rating, $data['url'] );
|
||||
}
|
||||
$gravatar_type = UM()->options()->get( 'use_um_gravatar_default_builtin_image' );
|
||||
if ( $gravatar_type == 'default' ) {
|
||||
if ( UM()->options()->get( 'use_um_gravatar_default_image' ) ) {
|
||||
$data['url'] = add_query_arg( 'd', $data['default'], $data['url'] );
|
||||
}
|
||||
} else {
|
||||
$default = get_option( 'avatar_default', 'mystery' );
|
||||
if ( $default == 'gravatar_default' ) {
|
||||
$default = '';
|
||||
}
|
||||
$data['url'] = add_query_arg( 'd', $default, $data['url'] );
|
||||
}
|
||||
$data['type'] = 'gravatar';
|
||||
$data['class'] .= ' um-avatar-gravatar';
|
||||
} else {
|
||||
$data['url'] = $data['default'];
|
||||
$data['type'] = 'default';
|
||||
$data['class'] .= ' um-avatar-default';
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_avatar_url_filter
|
||||
* @description Change user avatar URL
|
||||
* @input_vars
|
||||
* [{"var":"$avatar_uri","type":"string","desc":"Avatar URL"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_user_avatar_url_filter', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_avatar_url_filter', 'my_user_avatar_url', 10, 2 );
|
||||
* function my_user_avatar_url( $avatar_uri ) {
|
||||
* // your code here
|
||||
* return $avatar_uri;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data['url'] = apply_filters( 'um_user_avatar_url_filter', $data['url'], $user_id, $data );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_avatar_image_alternate_text
|
||||
* @description Change user display name on um_user function profile photo
|
||||
* @input_vars
|
||||
* [{"var":"$display_name","type":"string","desc":"User Display Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_avatar_image_alternate_text', 'my_avatar_image_alternate_text', 10, 1 );
|
||||
* function my_avatar_image_alternate_text( $display_name ) {
|
||||
* // your code here
|
||||
* return $display_name;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data['alt'] = apply_filters( "um_avatar_image_alternate_text", um_user( "display_name" ), $data );
|
||||
$gravatar_type = UM()->options()->get( 'use_um_gravatar_default_builtin_image' );
|
||||
if ( $gravatar_type == 'default' ) {
|
||||
if ( UM()->options()->get( 'use_um_gravatar_default_image' ) ) {
|
||||
$data['url'] = add_query_arg( 'd', $data['default'], $data['url'] );
|
||||
} else {
|
||||
$default = get_option( 'avatar_default', 'mystery' );
|
||||
if ( $default == 'gravatar_default' ) {
|
||||
$default = '';
|
||||
}
|
||||
$data['url'] = add_query_arg( 'd', $default, $data['url'] );
|
||||
}
|
||||
} else {
|
||||
$data['url'] = add_query_arg( 'd', $gravatar_type, $data['url'] );
|
||||
}
|
||||
|
||||
$data['type'] = 'gravatar';
|
||||
$data['class'] .= ' um-avatar-gravatar';
|
||||
} else {
|
||||
$data['url'] = $data['default'];
|
||||
$data['type'] = 'default';
|
||||
$data['class'] .= ' um-avatar-default';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_user_avatar_url_filter
|
||||
* @description Change user avatar URL
|
||||
* @input_vars
|
||||
* [{"var":"$avatar_uri","type":"string","desc":"Avatar URL"},
|
||||
* {"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_user_avatar_url_filter', 'function_name', 10, 2 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_user_avatar_url_filter', 'my_user_avatar_url', 10, 2 );
|
||||
* function my_user_avatar_url( $avatar_uri ) {
|
||||
* // your code here
|
||||
* return $avatar_uri;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data['url'] = apply_filters( 'um_user_avatar_url_filter', $data['url'], $user_id, $data );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_avatar_image_alternate_text
|
||||
* @description Change user display name on um_user function profile photo
|
||||
* @input_vars
|
||||
* [{"var":"$display_name","type":"string","desc":"User Display Name"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_avatar_image_alternate_text', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_avatar_image_alternate_text', 'my_avatar_image_alternate_text', 10, 1 );
|
||||
* function my_avatar_image_alternate_text( $display_name ) {
|
||||
* // your code here
|
||||
* return $display_name;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data['alt'] = apply_filters( "um_avatar_image_alternate_text", um_user( "display_name" ), $data );
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get user avatar url
|
||||
*
|
||||
|
||||
+26
@@ -131,6 +131,32 @@ 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.18: June 25, 2018 =
|
||||
|
||||
* Enhancements:
|
||||
- Added an ability to create different email templates for each site on multisites installs
|
||||
- Added major version notice
|
||||
- Added an ability to make Profile Form visible for 2 or more roles
|
||||
- Redesign some parts of field's conditional logic settings
|
||||
|
||||
* Bugfixes:
|
||||
- Fixed PHP memory limit issue on some installs. Created pseudo-constructor
|
||||
- Disabled email notification to user, which wasn't approved about delete their account
|
||||
- Fixed profile tabs privacy
|
||||
- Fixed default avatars and Gravatar displaying
|
||||
- Fixed get current URL function
|
||||
- Fixed admin bar displaying
|
||||
- Fixed members directory search
|
||||
- Fixed nav-menu items restriction handlers
|
||||
- Fixed user displaying on multisite (added 404 error in some cases)
|
||||
- Fixed XSS at wp-admin settings screen
|
||||
- Fixed user's "user_login" permalinks
|
||||
- Fixed user's capabilities ("Edit", "Delete" user) and profile actions displaying
|
||||
- Fixed field's conditional logic
|
||||
|
||||
* Deprecated:
|
||||
- REST API user's key option;
|
||||
|
||||
= 2.0.17: May 30, 2018 =
|
||||
|
||||
* Enhancements:
|
||||
|
||||
+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.18-alpha1
|
||||
Version: 2.0.18
|
||||
Author: Ultimate Member
|
||||
Author URI: http://ultimatemember.com/
|
||||
Text Domain: ultimate-member
|
||||
|
||||
Reference in New Issue
Block a user