mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-17 21:53:43 +09:00
Merge branch 'master' of https://github.com/ultimatemember/ultimatemember
# Conflicts: # includes/core/um-actions-profile.php
This commit is contained in:
@@ -5,28 +5,28 @@ jQuery(document).ready(function() {
|
||||
if ( current_tab ) {
|
||||
jQuery('.um-account-tab[data-tab="'+current_tab+'"]').show();
|
||||
|
||||
jQuery('.um-account-tab:not(:visible)').find( 'input:not(:disabled)' ).addClass('um_account_inactive').prop( 'disabled', true ).attr( 'disabled', true );
|
||||
jQuery('.um-account-tab:not(:visible)').find( 'input, select, textarea' ).not( ':disabled' ).addClass('um_account_inactive').prop( 'disabled', true ).attr( 'disabled', true );
|
||||
}
|
||||
|
||||
jQuery( document.body ).on( 'click', '.um-account-side li a', function(e) {
|
||||
e.preventDefault();
|
||||
var link = jQuery(this);
|
||||
|
||||
|
||||
link.parents('ul').find('li a').removeClass('current');
|
||||
link.addClass('current');
|
||||
|
||||
|
||||
var url_ = jQuery(this).attr('href');
|
||||
var tab_ = jQuery(this).attr('data-tab');
|
||||
|
||||
|
||||
jQuery('input[id="_um_account_tab"]:hidden').val( tab_ );
|
||||
|
||||
|
||||
window.history.pushState("", "", url_);
|
||||
|
||||
jQuery('.um-account-tab').hide();
|
||||
jQuery('.um-account-tab[data-tab="'+tab_+'"]').fadeIn();
|
||||
|
||||
jQuery('.um-account-tab:visible').find( 'input.um_account_inactive:disabled' ).removeClass('um_account_inactive').prop( 'disabled', false ).attr( 'disabled', false );
|
||||
jQuery('.um-account-tab:not(:visible)').find( 'input:not(:disabled)' ).addClass('um_account_inactive').prop( 'disabled', true ).attr( 'disabled', true );
|
||||
jQuery('.um-account-tab:visible').find( 'input, select, textarea' ).filter( '.um_account_inactive:disabled' ).removeClass('um_account_inactive').prop( 'disabled', false ).attr( 'disabled', false );
|
||||
jQuery('.um-account-tab:not(:visible)').find( 'input, select, textarea' ).not( ':disabled' ).addClass('um_account_inactive').prop( 'disabled', true ).attr( 'disabled', true );
|
||||
|
||||
jQuery('.um-account-nav a').removeClass('current');
|
||||
jQuery('.um-account-nav a[data-tab="'+tab_+'"]').addClass('current');
|
||||
@@ -56,8 +56,8 @@ jQuery(document).ready(function() {
|
||||
link.addClass('current');
|
||||
}
|
||||
|
||||
jQuery('.um-account-tab:visible').find( 'input.um_account_inactive:disabled' ).removeClass('um_account_inactive').prop( 'disabled', false ).attr( 'disabled', false );
|
||||
jQuery('.um-account-tab:not(:visible)').find( 'input:not(:disabled)' ).addClass('um_account_inactive').prop( 'disabled', true ).attr( 'disabled', true );
|
||||
jQuery('.um-account-tab:visible').find( 'input, select, textarea' ).filter( '.um_account_inactive:disabled' ).removeClass('um_account_inactive').prop( 'disabled', false ).attr( 'disabled', false );
|
||||
jQuery('.um-account-tab:not(:visible)').find( 'input, select, textarea' ).not( ':disabled' ).addClass('um_account_inactive').prop( 'disabled', true ).attr( 'disabled', true );
|
||||
|
||||
jQuery('.um-account-side li a').removeClass('current');
|
||||
jQuery('.um-account-side li a[data-tab="'+tab_+'"]').addClass('current');
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
jQuery(document).ready(function(){var a=jQuery(".um-account-main").attr("data-current_tab");a&&(jQuery('.um-account-tab[data-tab="'+a+'"]').show(),jQuery(".um-account-tab:not(:visible)").find("input:not(:disabled)").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0)),jQuery(document.body).on("click",".um-account-side li a",function(a){a.preventDefault();var t=jQuery(this);t.parents("ul").find("li a").removeClass("current"),t.addClass("current");var e=jQuery(this).attr("href"),u=jQuery(this).attr("data-tab");return jQuery('input[id="_um_account_tab"]:hidden').val(u),window.history.pushState("","",e),jQuery(".um-account-tab").hide(),jQuery('.um-account-tab[data-tab="'+u+'"]').fadeIn(),jQuery(".um-account-tab:visible").find("input.um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input:not(:disabled)").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-nav a").removeClass("current"),jQuery('.um-account-nav a[data-tab="'+u+'"]').addClass("current"),!1}),jQuery(document.body).on("click",".um-account-nav a",function(a){a.preventDefault();var t=jQuery(this).attr("data-tab"),e=jQuery(this).parents("div"),u=jQuery(this);return jQuery('input[id="_um_account_tab"]:hidden').val(t),jQuery(".um-account-tab").hide(),u.hasClass("current")?(e.next(".um-account-tab").slideUp(),u.removeClass("current")):(e.next(".um-account-tab").slideDown(),u.parents("div").find("a").removeClass("current"),u.addClass("current")),jQuery(".um-account-tab:visible").find("input.um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input:not(:disabled)").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-side li a").removeClass("current"),jQuery('.um-account-side li a[data-tab="'+t+'"]').addClass("current"),!1}),jQuery(document.body).on("click",".um-request-button",function(a){a.preventDefault();var t=jQuery(this).data("action"),e=jQuery("#"+t).val();if(jQuery(".um-field-area-response."+t).hide(),""===e)jQuery(".um-field-error."+t).show();else{jQuery(".um-field-error."+t).hide();var u={request_action:t,password:e,nonce:um_scripts.nonce};wp.ajax.send("um_request_user_data",{data:u,success:function(a){jQuery(".um-field-area-response."+t).text(a.answer).show()},error:function(a){console.log(a)}})}})});
|
||||
jQuery(document).ready(function(){var a=jQuery(".um-account-main").attr("data-current_tab");a&&(jQuery('.um-account-tab[data-tab="'+a+'"]').show(),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0)),jQuery(document.body).on("click",".um-account-side li a",function(a){a.preventDefault();var e=jQuery(this);e.parents("ul").find("li a").removeClass("current"),e.addClass("current");var t=jQuery(this).attr("href"),u=jQuery(this).attr("data-tab");return jQuery('input[id="_um_account_tab"]:hidden').val(u),window.history.pushState("","",t),jQuery(".um-account-tab").hide(),jQuery('.um-account-tab[data-tab="'+u+'"]').fadeIn(),jQuery(".um-account-tab:visible").find("input, select, textarea").filter(".um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-nav a").removeClass("current"),jQuery('.um-account-nav a[data-tab="'+u+'"]').addClass("current"),!1}),jQuery(document.body).on("click",".um-account-nav a",function(a){a.preventDefault();var e=jQuery(this).attr("data-tab"),t=jQuery(this).parents("div"),u=jQuery(this);return jQuery('input[id="_um_account_tab"]:hidden').val(e),jQuery(".um-account-tab").hide(),u.hasClass("current")?(t.next(".um-account-tab").slideUp(),u.removeClass("current")):(t.next(".um-account-tab").slideDown(),u.parents("div").find("a").removeClass("current"),u.addClass("current")),jQuery(".um-account-tab:visible").find("input, select, textarea").filter(".um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-side li a").removeClass("current"),jQuery('.um-account-side li a[data-tab="'+e+'"]').addClass("current"),!1}),jQuery(document.body).on("click",".um-request-button",function(a){a.preventDefault();var e,t=jQuery(this).data("action"),u=jQuery("#"+t).val();jQuery(".um-field-area-response."+t).hide(),""===u?jQuery(".um-field-error."+t).show():(jQuery(".um-field-error."+t).hide(),e={request_action:t,password:u,nonce:um_scripts.nonce},wp.ajax.send("um_request_user_data",{data:e,success:function(a){jQuery(".um-field-area-response."+t).text(a.answer).show()},error:function(a){console.log(a)}}))})});
|
||||
+114
-91
@@ -4,8 +4,9 @@ var um_field_default_values = {};
|
||||
|
||||
/**
|
||||
* Get field default value
|
||||
* @param object $dom
|
||||
* @return string
|
||||
*
|
||||
* @param {object} $dom
|
||||
* @return {string}
|
||||
*/
|
||||
function um_get_field_default_value( $dom ) {
|
||||
var default_value = '';
|
||||
@@ -21,6 +22,7 @@ function um_get_field_default_value( $dom ) {
|
||||
break;
|
||||
|
||||
case 'multiselect':
|
||||
case 'user_tags':
|
||||
default_value = $dom.find('select').val();
|
||||
break;
|
||||
|
||||
@@ -28,15 +30,14 @@ function um_get_field_default_value( $dom ) {
|
||||
if ($dom.find('input[type=radio]:checked').length >= 1) {
|
||||
default_value = $dom.find('input[type=radio]:checked').val();
|
||||
}
|
||||
|
||||
break;
|
||||
case 'checkbox':
|
||||
|
||||
case 'checkbox':
|
||||
if ($dom.find('input[type=checkbox]:checked').length >= 1) {
|
||||
|
||||
if ($dom.find('input[type=checkbox]:checked').length > 1) {
|
||||
var arr_values = [];
|
||||
arr_values.push( default_value );
|
||||
arr_values.push( default_value );
|
||||
$dom.find('input[type=checkbox]:checked').each(function () {
|
||||
arr_values.push( jQuery(this).val() );
|
||||
});
|
||||
@@ -44,7 +45,6 @@ function um_get_field_default_value( $dom ) {
|
||||
} else {
|
||||
default_value = $dom.find('input[type=checkbox]:checked').val();
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -54,11 +54,12 @@ function um_get_field_default_value( $dom ) {
|
||||
|
||||
/**
|
||||
* Get field element by field wrapper
|
||||
* @param object $dom
|
||||
* @return object
|
||||
*
|
||||
* @param {object} $dom
|
||||
* @return {object}
|
||||
*/
|
||||
function um_get_field_element( $dom ) {
|
||||
var default_value = '';
|
||||
|
||||
var type = um_get_field_type($dom);
|
||||
|
||||
switch ( type ) {
|
||||
@@ -69,12 +70,11 @@ function um_get_field_element( $dom ) {
|
||||
case 'textarea':
|
||||
case 'select':
|
||||
case 'multiselect':
|
||||
case 'user_tags':
|
||||
case 'radio':
|
||||
case 'checkbox':
|
||||
return $dom.find('input,textarea,select');
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -82,44 +82,45 @@ function um_get_field_element( $dom ) {
|
||||
|
||||
/**
|
||||
* Get field type
|
||||
* @param object $dom
|
||||
* @return string
|
||||
*
|
||||
* @param {object} $dom
|
||||
* @return {string}
|
||||
*/
|
||||
function um_get_field_type($dom) {
|
||||
var type = '';
|
||||
var classes = $dom.attr( 'class' );
|
||||
jQuery.each( classes.split(' '), function (i, d) {
|
||||
if (d.indexOf('um-field-type') != -1) {
|
||||
type = d.split('_')[1];
|
||||
var classes = $dom.attr( 'class' ).split(' ');
|
||||
jQuery.each( classes, function (i, d) {
|
||||
if (/um-field-type_/.test(d)) {
|
||||
type = d.replace('um-field-type_', '').trim();
|
||||
}
|
||||
});
|
||||
|
||||
return type;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field siblings/chidren conditions
|
||||
* @param string field_key
|
||||
* @return array
|
||||
*
|
||||
* @param {string} field_key
|
||||
* @return {array}
|
||||
*/
|
||||
function um_get_field_children(field_key) {
|
||||
var arr_conditions = [];
|
||||
jQuery.each(arr_all_conditions, function (ii, condition) {
|
||||
if (condition.field.parent == field_key) {
|
||||
if (condition.field.parent === field_key) {
|
||||
arr_conditions.push(condition.field.condition);
|
||||
}
|
||||
});
|
||||
|
||||
return arr_conditions;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Split single array to multi-dimensional array
|
||||
* @param array arr
|
||||
* @param integer n
|
||||
* @return array
|
||||
*
|
||||
* @param {array} arr
|
||||
* @param {nteger} n
|
||||
* @return {array}
|
||||
*/
|
||||
function um_splitup_array(arr, n) {
|
||||
var rest = arr.length % n,
|
||||
@@ -151,7 +152,7 @@ function um_splitup_array(arr, n) {
|
||||
if_field: dd[1],
|
||||
operator: dd[2],
|
||||
value: dd[3]
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
return obj_result;
|
||||
@@ -159,8 +160,9 @@ function um_splitup_array(arr, n) {
|
||||
|
||||
/**
|
||||
* Get field live value
|
||||
* @param object $dom
|
||||
* @return mixed
|
||||
*
|
||||
* @param {object} $dom
|
||||
* @return {mixed}
|
||||
*/
|
||||
function um_get_field_data($dom) {
|
||||
um_live_field = $dom.parents('.um-field').data('key');
|
||||
@@ -187,11 +189,19 @@ function um_get_field_data($dom) {
|
||||
}
|
||||
|
||||
return um_live_value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a value exists in an array
|
||||
*
|
||||
* @param {String} needle
|
||||
* @param {Array} haystack
|
||||
* @param {Boolean} strict
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function um_in_array(needle, haystack, strict){
|
||||
var found = false, key, strict = !!strict;
|
||||
var found = false, key;
|
||||
strict = !!strict;
|
||||
for (key in haystack) {
|
||||
if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
|
||||
found = true;
|
||||
@@ -204,11 +214,11 @@ function um_in_array(needle, haystack, strict){
|
||||
|
||||
/**
|
||||
* Apply field conditions
|
||||
* @param object $dom
|
||||
* @param boolean is_single_update
|
||||
*
|
||||
* @param {object} $dom
|
||||
* @param {boolean} is_single_update
|
||||
*/
|
||||
function um_apply_conditions( $dom, is_single_update ) {
|
||||
var operators = ['empty', 'not empty', 'equals to', 'not equals', 'greater than', 'less than', 'contains'];
|
||||
if ( ! $dom.parents('.um-field[data-key]').length ) {
|
||||
return;
|
||||
}
|
||||
@@ -218,6 +228,7 @@ function um_apply_conditions( $dom, is_single_update ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var field_type = um_get_field_type( $dom.parents('.um-field[data-key]') );
|
||||
var live_field_value = um_get_field_data( $dom );
|
||||
|
||||
var $owners = {};
|
||||
@@ -237,75 +248,88 @@ function um_apply_conditions( $dom, is_single_update ) {
|
||||
if (typeof $owners[condition.owner] == 'undefined') {
|
||||
$owners[condition.owner] = {};
|
||||
}
|
||||
if (condition.operator == 'empty') {
|
||||
if (!live_field_value || live_field_value == '' && um_in_array(live_field_value, $owners_values[condition.owner])) {
|
||||
|
||||
if (condition.operator === 'empty') {
|
||||
var field_value = jQuery.isArray(live_field_value) ? live_field_value.join('') : live_field_value;
|
||||
if (!field_value || field_value === '') {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (condition.operator == 'not empty') {
|
||||
if (live_field_value && live_field_value != '' && !um_in_array(live_field_value, $owners_values[condition.owner])) {
|
||||
if (condition.operator === 'not empty') {
|
||||
var field_value = jQuery.isArray(live_field_value) ? live_field_value.join('') : live_field_value;
|
||||
if (field_value && field_value !== '') {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (condition.operator == 'equals to') {
|
||||
if (condition.value == live_field_value && um_in_array(live_field_value, $owners_values[condition.owner])) {
|
||||
if (condition.operator === 'equals to') {
|
||||
var field_value = (jQuery.isArray(live_field_value) && live_field_value.length === 1) ? live_field_value[0] : live_field_value;
|
||||
if (condition.value === field_value && um_in_array(field_value, $owners_values[condition.owner])) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (condition.operator == 'not equals') {
|
||||
if (jQuery.isNumeric(condition.value) && parseInt(live_field_value) != parseInt(condition.value) && live_field_value && !um_in_array(live_field_value, $owners_values[condition.owner])) {
|
||||
if (condition.operator === 'not equals') {
|
||||
var field_value = (jQuery.isArray(live_field_value) && live_field_value.length === 1) ? live_field_value[0] : live_field_value;
|
||||
if (jQuery.isNumeric(condition.value) && parseInt(field_value) !== parseInt(condition.value) && field_value && !um_in_array(field_value, $owners_values[condition.owner])) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else if (condition.value != live_field_value && !um_in_array(live_field_value, $owners_values[condition.owner])) {
|
||||
} else if (condition.value != field_value && !um_in_array(field_value, $owners_values[condition.owner])) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (condition.operator == 'greater than') {
|
||||
if (jQuery.isNumeric(condition.value) && parseInt(live_field_value) > parseInt(condition.value)) {
|
||||
if (condition.operator === 'greater than') {
|
||||
var field_value = (jQuery.isArray(live_field_value) && live_field_value.length === 1) ? live_field_value[0] : live_field_value;
|
||||
if (jQuery.isNumeric(condition.value) && parseInt(field_value) > parseInt(condition.value)) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (condition.operator == 'less than') {
|
||||
if (jQuery.isNumeric(condition.value) && parseInt(live_field_value) < parseInt(condition.value)) {
|
||||
if (condition.operator === 'less than') {
|
||||
var field_value = (jQuery.isArray(live_field_value) && live_field_value.length === 1) ? live_field_value[0] : live_field_value;
|
||||
if (jQuery.isNumeric(condition.value) && parseInt(field_value) < parseInt(condition.value)) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( condition.operator == 'contains' ) {
|
||||
if ( 'multiselect' == um_get_field_type( $dom.parents('.um-field[data-key]') ) ) {
|
||||
if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 && um_in_array( condition.value, live_field_value ) ) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
} else if ( 'checkbox' == um_get_field_type( $dom.parents('.um-field[data-key]') ) ) {
|
||||
if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 ) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
} else {
|
||||
if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 && um_in_array( live_field_value, $owners_values[ condition.owner ] ) ) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
if ( condition.operator === 'contains' ) {
|
||||
switch (field_type) {
|
||||
case 'multiselect':
|
||||
case 'user_tags':
|
||||
if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 && um_in_array( condition.value, live_field_value ) ) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'checkbox':
|
||||
if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 ) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( live_field_value && live_field_value.indexOf( condition.value ) >= 0 && um_in_array( live_field_value, $owners_values[ condition.owner ] ) ) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else {
|
||||
$owners[condition.owner][index] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,44 +347,46 @@ function um_apply_conditions( $dom, is_single_update ) {
|
||||
|
||||
/**
|
||||
* Apply condition's action
|
||||
* @param object $dom
|
||||
* @param string condition
|
||||
* @param boolean is_true
|
||||
*
|
||||
* @param {object} $dom
|
||||
* @param {string} condition
|
||||
* @param {boolean} is_true
|
||||
* @returns {jQuery}
|
||||
*/
|
||||
function um_field_apply_action($dom, condition, is_true) {
|
||||
var child_dom = jQuery('div.um-field[data-key="' + condition.owner + '"]');
|
||||
|
||||
if (condition.action == 'show' && is_true /*&& child_dom.is(':hidden')*/) {
|
||||
if (condition.action === 'show' && is_true /*&& child_dom.is(':hidden')*/) {
|
||||
child_dom.show();
|
||||
_show_in_ie( child_dom );
|
||||
um_field_restore_default_value(child_dom);
|
||||
}
|
||||
|
||||
if (condition.action == 'show' && !is_true /*&& child_dom.is(':visible') */) {
|
||||
if (condition.action === 'show' && !is_true /*&& child_dom.is(':visible') */) {
|
||||
child_dom.hide();
|
||||
_hide_in_ie( child_dom );
|
||||
}
|
||||
|
||||
if (condition.action == 'hide' && is_true /*&& child_dom.is(':visible')*/) {
|
||||
if (condition.action === 'hide' && is_true /*&& child_dom.is(':visible')*/) {
|
||||
child_dom.hide();
|
||||
_hide_in_ie( child_dom );
|
||||
}
|
||||
|
||||
if (condition.action == 'hide' && !is_true /*&& child_dom.is(':hidden')*/) {
|
||||
if (condition.action === 'hide' && !is_true /*&& child_dom.is(':hidden')*/) {
|
||||
child_dom.show();
|
||||
_show_in_ie( child_dom );
|
||||
um_field_restore_default_value( child_dom );
|
||||
|
||||
}
|
||||
$dom.removeClass('um-field-has-changed');
|
||||
return $dom.removeClass('um-field-has-changed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores default field value
|
||||
* @param object $dom
|
||||
*
|
||||
* @param {object} $dom
|
||||
*/
|
||||
function um_field_restore_default_value( $dom ) {
|
||||
//um_field_default_values
|
||||
|
||||
var type = um_get_field_type( $dom );
|
||||
var key = $dom.data('key');
|
||||
@@ -381,6 +407,7 @@ function um_field_restore_default_value( $dom ) {
|
||||
break;
|
||||
|
||||
case 'multiselect':
|
||||
case 'user_tags':
|
||||
$dom.find('select').find('option').prop('selected', false);
|
||||
jQuery.each(field.value, function (i, value) {
|
||||
$dom.find('select').find('option[value="' + value + '"]').attr('selected', true);
|
||||
@@ -389,8 +416,6 @@ function um_field_restore_default_value( $dom ) {
|
||||
break;
|
||||
|
||||
case 'checkbox':
|
||||
|
||||
|
||||
if ( $dom.find('input[type=checkbox]:checked').length >= 1 ) {
|
||||
|
||||
$dom.find('input[type=checkbox]:checked').removeAttr('checked');
|
||||
@@ -412,13 +437,11 @@ function um_field_restore_default_value( $dom ) {
|
||||
cbox_elem.closest('.um-field-checkbox').find('i').removeClass('um-icon-android-checkbox-outline-blank');
|
||||
cbox_elem.closest('.um-field-checkbox').find('i').addClass('um-icon-android-checkbox-outline');
|
||||
cbox_elem.closest('.um-field-checkbox').addClass('active');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'radio':
|
||||
|
||||
case 'radio':
|
||||
if ( $dom.find('input[type=radio]:checked').length >= 1 ) {
|
||||
|
||||
setTimeout(function () {
|
||||
@@ -437,17 +460,15 @@ function um_field_restore_default_value( $dom ) {
|
||||
|
||||
}, 100);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
} // end switch type
|
||||
|
||||
|
||||
if ( ! $dom.hasClass( 'um-field-has-changed' ) ) {
|
||||
var me = um_get_field_element( $dom );
|
||||
|
||||
if ( type == 'radio' || type == 'checkbox' ) {
|
||||
if ( type === 'radio' || type === 'checkbox' ) {
|
||||
me = me.find( ':checked' );
|
||||
}
|
||||
|
||||
@@ -480,7 +501,7 @@ function um_field_restore_default_value( $dom ) {
|
||||
function um_field_hide_siblings() {
|
||||
|
||||
jQuery.each(um_field_conditions, function (index, conditions) {
|
||||
if (jQuery('.um-field[data-key="' + index + '"]:hidden').length >= 1 || jQuery('.um-field[data-key="' + index + '"]').css('display') == 'none') {
|
||||
if (jQuery('.um-field[data-key="' + index + '"]:hidden').length >= 1 || jQuery('.um-field[data-key="' + index + '"]').css('display') === 'none') {
|
||||
jQuery.each(conditions, function (key, condition) {
|
||||
jQuery('.um-field[data-key="' + condition.owner + '"]').hide();
|
||||
});
|
||||
@@ -492,20 +513,22 @@ function um_field_hide_siblings() {
|
||||
|
||||
/**
|
||||
* Hides div for IE browser
|
||||
* @param object $dom
|
||||
*
|
||||
* @param {object} $dom
|
||||
*/
|
||||
function _hide_in_ie( $dom ){
|
||||
if ( typeof( jQuery.browser ) != 'undefined' && jQuery.browser.msie ) {
|
||||
if ( typeof( jQuery.browser ) !== 'undefined' && jQuery.browser.msie ) {
|
||||
$dom.css({"visibility":"hidden"});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows div for IE browser
|
||||
* @param object $dom
|
||||
*
|
||||
* @param {object} $dom
|
||||
*/
|
||||
function _show_in_ie( $dom ){
|
||||
if ( typeof( jQuery.browser ) != 'undefined' && jQuery.browser.msie ) {
|
||||
if ( typeof( jQuery.browser ) !== 'undefined' && jQuery.browser.msie ) {
|
||||
$dom.css({"visibility":"visible"});
|
||||
}
|
||||
}
|
||||
@@ -524,7 +547,7 @@ function um_init_field_conditions() {
|
||||
|
||||
var parse_attrs = {};
|
||||
jQuery.each( jQuery(this)[0].attributes, function ( index, attribute ) {
|
||||
if ( attribute.name.indexOf( 'data-cond' ) != -1 ) {
|
||||
if ( attribute.name.indexOf( 'data-cond' ) !== -1 ) {
|
||||
// replace "data-cond-"
|
||||
var cond_field_id_and_attr = attribute.name.slice( 10 );
|
||||
// return "n"
|
||||
@@ -532,7 +555,7 @@ function um_init_field_conditions() {
|
||||
//replace "n-"
|
||||
var cond_field_attr = cond_field_id_and_attr.slice( 2 );
|
||||
|
||||
if ( typeof parse_attrs[cond_field_id] == 'undefined' )
|
||||
if ( typeof parse_attrs[cond_field_id] === 'undefined' )
|
||||
parse_attrs[cond_field_id] = {};
|
||||
|
||||
parse_attrs[cond_field_id][cond_field_attr] = attribute.value;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -9,7 +9,7 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
|
||||
if ( jQuery('.um-profile.um-viewing .um-profile-body').length && jQuery('.um-profile.um-viewing .um-profile-body').find('.um-field').length == 0 ) {
|
||||
jQuery('.um-row-heading,.um-row').remove();
|
||||
jQuery('.um-profile.um-viewing .um-profile-body').find('.um-row-heading,.um-row').remove();
|
||||
jQuery('.um-profile-note').show();
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ jQuery(document).ready(function() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Fix profile nav links for iPhone
|
||||
* @see https://www.html5rocks.com/en/mobile/touchandmouse/
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
jQuery(document).ready(function(){jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document.body).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document.body).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document.body).on("click",".um-cover a.um-cover-add, .um-photo a",function(e){e.preventDefault()}),jQuery(document.body).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document.body).on("click",".um-reset-profile-photo",function(e){return jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",UM_hide_menus(),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_profile_photo",metakey:metakey,user_id:user_id,nonce:um_scripts.nonce}}),jQuery(this).parents("li").hide(),!1}),jQuery(document.body).on("click",".um-reset-cover-photo",function(e){var t=jQuery(this);return jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="javascript:void(0);" class="um-cover-add" style="height: 370px;"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" original-title="Upload a cover photo"></i></span></a>'),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_cover_photo",metakey:metakey,user_id:user_id,nonce:um_scripts.nonce},success:function(e){t.hide()}}),UM_hide_menus(),!1}),jQuery(document.body).on("change, keyup",'textarea[id="um-meta-bio"]',function(){if(void 0!==jQuery(this).val()){var e=jQuery(this).attr("data-character-limit")-jQuery(this).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('textarea[id="um-meta-bio"]').trigger("change"),jQuery(".um-profile-edit a.um_delete-item").click(function(e){if(e.preventDefault(),!confirm(wp.i18n.__("Are you sure that you want to delete this user?","ultimate-member")))return!1}),jQuery(".um-profile-nav a").on("touchend",function(e){e.currentTarget.click()})});
|
||||
jQuery(document).ready(function(){jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-profile.um-viewing .um-profile-body").find(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document.body).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document.body).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document.body).on("click",".um-cover a.um-cover-add, .um-photo a",function(e){e.preventDefault()}),jQuery(document.body).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document.body).on("click",".um-reset-profile-photo",function(e){return jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",UM_hide_menus(),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_profile_photo",metakey:metakey,user_id:user_id,nonce:um_scripts.nonce}}),jQuery(this).parents("li").hide(),!1}),jQuery(document.body).on("click",".um-reset-cover-photo",function(e){var t=jQuery(this);return jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="javascript:void(0);" class="um-cover-add" style="height: 370px;"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" original-title="Upload a cover photo"></i></span></a>'),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_delete_cover_photo",metakey:metakey,user_id:user_id,nonce:um_scripts.nonce},success:function(e){t.hide()}}),UM_hide_menus(),!1}),jQuery(document.body).on("change, keyup",'textarea[id="um-meta-bio"]',function(){if(void 0!==jQuery(this).val()){var e=jQuery(this).attr("data-character-limit")-jQuery(this).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('textarea[id="um-meta-bio"]').trigger("change"),jQuery(".um-profile-edit a.um_delete-item").click(function(e){if(e.preventDefault(),!confirm(wp.i18n.__("Are you sure that you want to delete this user?","ultimate-member")))return!1}),jQuery(".um-profile-nav a").on("touchend",function(e){e.currentTarget.click()})});
|
||||
@@ -1092,7 +1092,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
$columns = ( ! empty( $field_data['columns'] ) && is_numeric( $field_data['columns'] ) ) ? $field_data['columns'] : 1;
|
||||
while ( $i < $columns ) {
|
||||
$per_page = ceil( count( $field_data['options'] ) / $columns );
|
||||
$section_fields_per_page = array_slice( $field_data['options'], $i*$per_page, $per_page );
|
||||
$section_fields_per_page = array_slice( $field_data['options'], $i*$per_page, $per_page, true );
|
||||
$html .= '<span class="um-form-fields-section" style="width:' . floor( 100 / $columns ) . '% !important;">';
|
||||
|
||||
foreach ( $section_fields_per_page as $k => $title ) {
|
||||
@@ -1568,8 +1568,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
* @return string|array
|
||||
*/
|
||||
function get_field_value( $field_data, $i = '' ) {
|
||||
$default = ( $field_data['type'] == 'multi_checkbox' ) ? array() : '';
|
||||
$default = isset( $field_data[ 'default' . $i ] ) ? $field_data[ 'default' . $i ] : $default;
|
||||
|
||||
$default = '';
|
||||
if ( $field_data['type'] === 'multi_checkbox' ) {
|
||||
$default = array();
|
||||
if ( isset( $field_data['default'] ) ) {
|
||||
$default = is_array( $field_data['default'] ) ? $field_data['default'] : array( $field_data['default'] );
|
||||
}
|
||||
}
|
||||
if ( isset( $field_data['default' . $i] ) ) {
|
||||
$default = $field_data['default' . $i];
|
||||
}
|
||||
|
||||
if ( $field_data['type'] == 'checkbox' || $field_data['type'] == 'multi_checkbox' ) {
|
||||
$value = ( isset( $field_data[ 'value' . $i ] ) && '' !== $field_data[ 'value' . $i ] ) ? $field_data[ 'value' . $i ] : $default;
|
||||
|
||||
@@ -589,32 +589,76 @@ add_action( 'um_after_form_fields', 'um_editing_user_id_input' );
|
||||
|
||||
/**
|
||||
* Meta description
|
||||
*
|
||||
* @see https://ogp.me/ - The Open Graph protocol
|
||||
* @see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary - The Twitter Summary card
|
||||
* @see https://schema.org/Person - The schema.org Person schema
|
||||
*/
|
||||
function um_profile_dynamic_meta_desc() {
|
||||
if ( um_is_core_page( 'user' ) && um_get_requested_user() ) {
|
||||
|
||||
um_fetch_user( um_get_requested_user() );
|
||||
$user_id = um_get_requested_user();
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
$content = um_convert_tags( UM()->options()->get( 'profile_desc' ) );
|
||||
$user_id = um_user( 'ID' );
|
||||
$locale = get_user_locale( $user_id );
|
||||
$site_name = get_bloginfo( 'name' );
|
||||
$twitter_site = '@' . sanitize_title( $site_name );
|
||||
|
||||
$url = um_user_profile_url();
|
||||
$avatar = um_get_user_avatar_url( $user_id, 'original' );
|
||||
$title = trim( um_user( 'display_name' ) );
|
||||
$description = um_convert_tags( UM()->options()->get( 'profile_desc' ) );
|
||||
$url = um_user_profile_url( $user_id );
|
||||
|
||||
um_reset_user(); ?>
|
||||
$size = 190;
|
||||
$sizes = UM()->options()->get( 'photo_thumb_sizes' );
|
||||
if ( is_array( $sizes ) ) {
|
||||
$size = um_closest_num( $sizes, $size );
|
||||
}
|
||||
$image = um_get_user_avatar_url( $user_id, $size );
|
||||
|
||||
<meta name="description" content="<?php echo esc_attr( $content ); ?>">
|
||||
$person = array(
|
||||
"@context" => "http://schema.org",
|
||||
"@type" => "Person",
|
||||
"name" => esc_attr( $title ),
|
||||
"description" => esc_attr( $description ),
|
||||
"image" => esc_url( $image ),
|
||||
"url" => esc_url( $url )
|
||||
);
|
||||
|
||||
um_reset_user();
|
||||
?>
|
||||
<!-- START - Ultimate Member profile SEO meta tags -->
|
||||
|
||||
<link rel="canonical" href="<?php echo esc_url( $url ); ?>"/>
|
||||
<link rel="image_src" href="<?php echo esc_url( $image ); ?>"/>
|
||||
|
||||
<meta name="description" content="<?php echo esc_attr( $description ); ?>"/>
|
||||
|
||||
<meta property="og:title" content="<?php echo esc_attr( um_get_display_name( $user_id ) ); ?>"/>
|
||||
<meta property="og:type" content="profile"/>
|
||||
<meta property="og:image" content="<?php echo esc_url( $avatar ); ?>"/>
|
||||
<meta property="og:locale" content="<?php echo esc_attr( $locale ); ?>"/>
|
||||
<meta property="og:site_name" content="<?php echo esc_attr( $site_name ); ?>"/>
|
||||
<meta property="og:title" content="<?php echo esc_attr( $title ); ?>"/>
|
||||
<meta property="og:description" content="<?php echo esc_attr( $description ); ?>"/>
|
||||
<meta property="og:image" content="<?php echo esc_url( $image ); ?>"/>
|
||||
<meta property="og:image:alt" content="<?php echo esc_attr_e( 'Profile photo', 'ultimate-member' ); ?>"/>
|
||||
<meta property="og:image:height" content="<?php echo intval( $size ); ?>"/>
|
||||
<meta property="og:image:width" content="<?php echo intval( $size ); ?>"/>
|
||||
<meta property="og:url" content="<?php echo esc_url( $url ); ?>"/>
|
||||
<meta property="og:description" content="<?php echo esc_attr( $content ); ?>"/>
|
||||
|
||||
<meta name="twitter:card" content="summary"/>
|
||||
<meta name="twitter:site" content="<?php echo esc_attr( $twitter_site ); ?>"/>
|
||||
<meta name="twitter:title" content="<?php echo esc_attr( $title ); ?>"/>
|
||||
<meta name="twitter:description" content="<?php echo esc_attr( $description ); ?>"/>
|
||||
<meta name="twitter:image" content="<?php echo esc_url( $image ); ?>"/>
|
||||
<meta name="twitter:image:alt" content="<?php echo esc_attr_e( 'Profile photo', 'ultimate-member' ); ?>"/>
|
||||
<meta name="twitter:url" content="<?php echo esc_url( $url ); ?>"/>
|
||||
|
||||
<script type="application/ld+json"><?php echo json_encode( $person ); ?></script>
|
||||
|
||||
<!-- END - Ultimate Member profile SEO meta tags -->
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action( 'wp_head', 'um_profile_dynamic_meta_desc', 9999999 );
|
||||
add_action( 'wp_head', 'um_profile_dynamic_meta_desc', 9999 );
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,12 +34,8 @@ add_action( 'init', 'um_block_wpadmin_by_user_role', 99 );
|
||||
* @return bool
|
||||
*/
|
||||
function um_control_admin_bar( $show ) {
|
||||
if ( is_user_logged_in() && um_user( 'can_not_see_adminbar' ) ) {
|
||||
if ( is_user_logged_in() && UM()->roles()->um_user_can( 'can_not_see_adminbar' ) ) {
|
||||
$show = false;
|
||||
|
||||
/*if ( is_admin() && um_user( 'can_access_wpadmin' ) ) {
|
||||
$show = true;
|
||||
}*/
|
||||
}
|
||||
|
||||
return apply_filters( 'um_show_admin_bar_callback', $show );
|
||||
|
||||
Reference in New Issue
Block a user