mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Merge branch 'fix/some_fixes'
This commit is contained in:
@@ -13,6 +13,7 @@ tmp/
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.ideanpg
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
@@ -217,3 +218,5 @@ pip-log.txt
|
||||
|
||||
node_modules/
|
||||
assets/vendor/
|
||||
package-lock.json
|
||||
.idea
|
||||
+381
-591
@@ -1,597 +1,387 @@
|
||||
function condition_fields() {
|
||||
var first_group = 0,
|
||||
state_array = [],
|
||||
count = state_array.length,
|
||||
state = 'show';
|
||||
|
||||
jQuery('.um-profile-body .um-field, .um-profile-body .um-field').each(function () {
|
||||
var conds = jQuery(this).attr('data-conds');
|
||||
|
||||
if ( conds ){
|
||||
var array = JSON.parse(conds);
|
||||
|
||||
jQuery.each(array, function() {
|
||||
var action = this[0],
|
||||
field = this[1],
|
||||
op = this[2],
|
||||
val = this[3],
|
||||
group = this[5],
|
||||
depend_field;
|
||||
|
||||
var input = jQuery('.um-profile-body .um-field[data-key="'+field+'"] .um-field-area input'),
|
||||
select = jQuery('.um-profile-body .um-field[data-key="'+field+'"] .um-field-area>select'),
|
||||
textarea = jQuery('.um-profile-body .um-field[data-key="'+field+'"] .um-field-area>textarea'),
|
||||
content_block = jQuery('.um-profile-body .um-field[data-key="'+field+'"] .um-field-block');
|
||||
|
||||
if( input.length > 0 && select.length === 0 ){
|
||||
|
||||
if( input.is(':checkbox') ){
|
||||
var checked = jQuery('.um-profile-body .um-field[data-key="'+field+'"] input:checked');
|
||||
checked.each(function () {
|
||||
var checked_vals = jQuery(this).val();
|
||||
|
||||
if( checked_vals === val ){
|
||||
depend_field = val;
|
||||
}
|
||||
|
||||
});
|
||||
} else if( input.is(':radio')) {
|
||||
depend_field = jQuery('.um-profile-body .um-field[data-key="'+field+'"] input:checked').val();
|
||||
} else {
|
||||
depend_field = input.val();
|
||||
}
|
||||
|
||||
} else if( select.length > 0 ){
|
||||
|
||||
if( jQuery.inArray( val, select.val() ) > 0 ){
|
||||
depend_field = val;
|
||||
} else {
|
||||
depend_field = select.val()
|
||||
}
|
||||
|
||||
} else if( textarea.length > 0 ){
|
||||
|
||||
depend_field = textarea.val();
|
||||
|
||||
} else if( content_block.length > 0 ){
|
||||
|
||||
depend_field = content_block.text();
|
||||
|
||||
}
|
||||
|
||||
if( parseInt(group) !== first_group ){
|
||||
|
||||
if ( action === 'show') {
|
||||
|
||||
switch (op) {
|
||||
case 'equals to':
|
||||
if( depend_field == val ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'not equals':
|
||||
if( depend_field != val ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'empty':
|
||||
if( !depend_field || depend_field === '' ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'not empty':
|
||||
if( depend_field && depend_field !== '' ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'greater than':
|
||||
if( jQuery.isNumeric(val) && jQuery.isNumeric(depend_field) ){
|
||||
if( val > depend_field ){
|
||||
state = 'show'
|
||||
} else {
|
||||
state = 'hide'
|
||||
}
|
||||
} else {
|
||||
state = 'hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'less than':
|
||||
if( jQuery.isNumeric(val) && jQuery.isNumeric(depend_field) ){
|
||||
if( val < depend_field ){
|
||||
state = 'show'
|
||||
} else {
|
||||
state = 'hide'
|
||||
}
|
||||
} else {
|
||||
state = 'hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'contains':
|
||||
if( depend_field.search(val) >= 0 ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'hide';
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
} else { // if hide
|
||||
|
||||
switch (op) {
|
||||
case 'equals to':
|
||||
if (depend_field == val) {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'not equals':
|
||||
if (depend_field != val) {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'empty':
|
||||
if (!depend_field || depend_field === '') {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'not empty':
|
||||
if (depend_field && depend_field !== '') {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'greater than':
|
||||
if (jQuery.isNumeric(val) && jQuery.isNumeric(depend_field)) {
|
||||
if (val > depend_field) {
|
||||
state = 'hide'
|
||||
} else {
|
||||
state = 'show'
|
||||
}
|
||||
} else {
|
||||
state = 'show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'less than':
|
||||
if (jQuery.isNumeric(val) && jQuery.isNumeric(depend_field)) {
|
||||
if (val < depend_field) {
|
||||
state = 'hide'
|
||||
} else {
|
||||
state = 'show'
|
||||
}
|
||||
} else {
|
||||
state = 'show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'contains':
|
||||
if (depend_field.search(val) >= 0) {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'show';
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
first_group++;
|
||||
state_array.push(state);
|
||||
} else {
|
||||
|
||||
if ( action === 'show') {
|
||||
|
||||
switch (op) {
|
||||
case 'equals to':
|
||||
if( depend_field == val ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'not_show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'not equals':
|
||||
if( depend_field != val ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'not_show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'empty':
|
||||
if( !depend_field || depend_field === '' ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'not_show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'not empty':
|
||||
if( depend_field && depend_field !== '' ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'not_show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'greater than':
|
||||
if( jQuery.isNumeric(val) && jQuery.isNumeric(depend_field) ){
|
||||
if( val > depend_field ){
|
||||
state = 'show'
|
||||
} else {
|
||||
state = 'not_show'
|
||||
}
|
||||
} else {
|
||||
state = 'not_show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'less than':
|
||||
if( jQuery.isNumeric(val) && jQuery.isNumeric(depend_field) ){
|
||||
if( val < depend_field ){
|
||||
state = 'show'
|
||||
} else {
|
||||
state = 'not_show'
|
||||
}
|
||||
} else {
|
||||
state = 'not_show';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'contains':
|
||||
if( depend_field.search(val) >= 0 ){
|
||||
state = 'show';
|
||||
} else {
|
||||
state = 'not_show';
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
} else { // if hide
|
||||
|
||||
switch (op) {
|
||||
case 'equals to':
|
||||
if (depend_field == val) {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'not equals':
|
||||
if (depend_field != val) {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'empty':
|
||||
if (!depend_field || depend_field === '') {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'not empty':
|
||||
if (depend_field && depend_field !== '') {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'greater than':
|
||||
if (jQuery.isNumeric(val) && jQuery.isNumeric(depend_field)) {
|
||||
if (val > depend_field) {
|
||||
state = 'hide'
|
||||
} else {
|
||||
state = 'not_hide'
|
||||
}
|
||||
} else {
|
||||
state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'less than':
|
||||
if (jQuery.isNumeric(val) && jQuery.isNumeric(depend_field)) {
|
||||
if (val < depend_field) {
|
||||
state = 'hide'
|
||||
} else {
|
||||
state = 'not_hide'
|
||||
}
|
||||
} else {
|
||||
state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'contains':
|
||||
if (depend_field.search(val) >= 0) {
|
||||
state = 'hide';
|
||||
} else {
|
||||
state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if( state_array[count] ){
|
||||
if( state_array[count] === 'show' || state_array[count] === 'not_hide' ){
|
||||
if ( state === 'show' || state === 'not_hide' ){
|
||||
state_array[count] = 'show';
|
||||
} else {
|
||||
state_array[count] = 'hide';
|
||||
}
|
||||
} else {
|
||||
state_array[count] = 'hide';
|
||||
}
|
||||
} else {
|
||||
if ( state === 'show' || state === 'not_hide' ){
|
||||
state_array[count] = 'show';
|
||||
} else {
|
||||
state_array[count] = 'hide';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if( jQuery.inArray( 'show', state_array ) < 0 ){
|
||||
jQuery(this).hide();
|
||||
} else {
|
||||
jQuery(this).show();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
jQuery(document).ready( function (){
|
||||
|
||||
var arr_all_conditions = []; //raw
|
||||
var um_field_conditions = {}; // filtered
|
||||
var um_field_default_values = {};
|
||||
condition_fields();
|
||||
|
||||
/**
|
||||
* Get field default value
|
||||
* @param object $dom
|
||||
* @return string
|
||||
*/
|
||||
function um_get_field_default_value( $dom ) {
|
||||
var default_value = '';
|
||||
var type = um_get_field_type($dom);
|
||||
switch ( type ) {
|
||||
|
||||
case 'text':
|
||||
case 'number':
|
||||
case 'date':
|
||||
case 'textarea':
|
||||
case 'select':
|
||||
default_value = $dom.find('input:text,input[type=number],textarea,select').val();
|
||||
break;
|
||||
|
||||
case 'multiselect':
|
||||
default_value = $dom.find('select').val();
|
||||
break;
|
||||
|
||||
case 'radio':
|
||||
if ($dom.find('input[type=radio]:checked').length >= 1) {
|
||||
default_value = $dom.find('input[type=radio]:checked').val();
|
||||
}
|
||||
|
||||
break;
|
||||
case 'checkbox':
|
||||
|
||||
if ($dom.find('input[type=checkbox]:checked').length >= 1) {
|
||||
|
||||
if ($dom.find('input[type=checkbox]:checked').length > 1) {
|
||||
$dom.find('input[type=checkbox]:checked').each(function () {
|
||||
default_value = default_value + jQuery(this).val() + ' ';
|
||||
});
|
||||
} else {
|
||||
default_value = $dom.find('input[type=checkbox]:checked').val();
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return {type: type, value: default_value};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field element by field wrapper
|
||||
* @param object $dom
|
||||
* @return object
|
||||
*/
|
||||
function um_get_field_element( $dom ) {
|
||||
var default_value = '';
|
||||
var type = um_get_field_type($dom);
|
||||
|
||||
switch ( type ) {
|
||||
|
||||
case 'text':
|
||||
case 'number':
|
||||
case 'date':
|
||||
case 'textarea':
|
||||
case 'select':
|
||||
case 'multiselect':
|
||||
case 'radio':
|
||||
case 'checkbox':
|
||||
return $dom.find('input,textarea,select');
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field type
|
||||
* @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];
|
||||
}
|
||||
});
|
||||
|
||||
return type;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field siblings/chidren conditions
|
||||
* @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) {
|
||||
arr_conditions.push(condition.field.condition);
|
||||
}
|
||||
});
|
||||
|
||||
return arr_conditions;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Split single array to multi-dimensional array
|
||||
* @param array arr
|
||||
* @param integer n
|
||||
* @return array
|
||||
*/
|
||||
function um_splitup_array(arr, n) {
|
||||
var rest = arr.length % n,
|
||||
restUsed = rest,
|
||||
partLength = Math.floor(arr.length / n),
|
||||
result = [];
|
||||
|
||||
for (var i = 0; i < arr.length; i += partLength) {
|
||||
var end = partLength + i,
|
||||
add = false;
|
||||
|
||||
if (rest !== 0 && restUsed) {
|
||||
end++;
|
||||
restUsed--;
|
||||
add = true;
|
||||
}
|
||||
|
||||
result.push(arr.slice(i, end));
|
||||
|
||||
if (add) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
var obj_result = [];
|
||||
jQuery.each(result, function (ii, dd) {
|
||||
obj_result.push({
|
||||
action: dd[0],
|
||||
if_field: dd[1],
|
||||
operator: dd[2],
|
||||
value: dd[3]
|
||||
})
|
||||
});
|
||||
|
||||
return obj_result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field live value
|
||||
* @param object $dom
|
||||
* @return mixed
|
||||
*/
|
||||
function um_get_field_data($dom) {
|
||||
um_live_field = $dom.parents('.um-field').data('key');
|
||||
um_live_value = $dom.val();
|
||||
|
||||
if ($dom.is(':checkbox')) {
|
||||
|
||||
um_live_value = '';
|
||||
|
||||
if ($dom.parents('.um-field').find('input:checked').length > 1) {
|
||||
$dom.parents('.um-field').find('input:checked').each(function () {
|
||||
um_live_value = um_live_value + jQuery(this).val() + ' ';
|
||||
});
|
||||
} else {
|
||||
if ($dom.parents('.um-field').find('input:checked').length >= 1) {
|
||||
um_live_value = $dom.parents('.um-field').find('input:checked').val();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($dom.is(':radio')) {
|
||||
um_live_value = $dom.parents('.um-field').find('input[type=radio]:checked').val();
|
||||
}
|
||||
|
||||
return um_live_value;
|
||||
|
||||
}
|
||||
|
||||
function um_in_array(needle, haystack, strict){
|
||||
var found = false, key, strict = !!strict;
|
||||
for (key in haystack) {
|
||||
if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply field conditions
|
||||
* @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'];
|
||||
var key = $dom.parents('.um-field[data-key]').data('key');
|
||||
var conditions = um_field_conditions[key];
|
||||
|
||||
var live_field_value = um_get_field_data($dom);
|
||||
|
||||
var $owners = {};
|
||||
var $owners_values = {};
|
||||
var $owner_conditions = {};
|
||||
|
||||
jQuery.each(conditions, function (index, condition) {
|
||||
if (typeof $owners_values[condition.owner] == 'undefined') {
|
||||
$owners_values[condition.owner] = [];
|
||||
$owner_conditions[condition.owner] = {}
|
||||
}
|
||||
$owners_values[condition.owner].push(condition.value);
|
||||
$owner_conditions[condition.owner] = condition;
|
||||
});
|
||||
|
||||
jQuery.each(conditions, function (index, condition) {
|
||||
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])) {
|
||||
$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])) {
|
||||
$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])) {
|
||||
$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])) {
|
||||
$owners[condition.owner][index] = true;
|
||||
} else if (condition.value != live_field_value && !um_in_array(live_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)) {
|
||||
$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)) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}); // end foreach `conditions`
|
||||
jQuery.each($owners, function (index, field) {
|
||||
if (um_in_array(true, field)) {
|
||||
um_field_apply_action($dom, $owner_conditions[index], true);
|
||||
} else {
|
||||
um_field_apply_action($dom, $owner_conditions[index], false);
|
||||
}
|
||||
});
|
||||
$dom.trigger('um_fields_change');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply condition's action
|
||||
* @param object $dom
|
||||
* @param string condition
|
||||
* @param boolean is_true
|
||||
*/
|
||||
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')*/) {
|
||||
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') */) {
|
||||
child_dom.hide();
|
||||
_hide_in_ie( child_dom );
|
||||
}
|
||||
|
||||
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')*/) {
|
||||
child_dom.show();
|
||||
_show_in_ie( child_dom );
|
||||
um_field_restore_default_value( child_dom );
|
||||
|
||||
}
|
||||
$dom.removeClass('um-field-has-changed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores default field value
|
||||
* @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');
|
||||
var field = um_field_default_values[key];
|
||||
switch ( type ) {
|
||||
|
||||
case 'text':
|
||||
case 'number':
|
||||
case 'date':
|
||||
case 'textarea':
|
||||
$dom.find('input:text,input[type=number],textareas').val(field.value);
|
||||
break;
|
||||
|
||||
case 'select':
|
||||
$dom.find('select').find('option').prop('selected', false);
|
||||
$dom.find('select').val(field.value);
|
||||
$dom.find('select').trigger('change');
|
||||
break;
|
||||
|
||||
case 'multiselect':
|
||||
$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);
|
||||
});
|
||||
$dom.find('select').trigger('change');
|
||||
break;
|
||||
|
||||
case 'checkbox':
|
||||
|
||||
if ( $dom.find('input[type=checkbox]:checked').length >= 1 ) {
|
||||
|
||||
$dom.find('input[type=checkbox]:checked').removeAttr('checked');
|
||||
$dom.find('span.um-field-checkbox-state i').removeClass('um-icon-android-checkbox-outline');
|
||||
$dom.find('span.um-field-checkbox-state i').addClass('um-icon-android-checkbox-outline-blank');
|
||||
$dom.find('.um-field-checkbox.active').removeClass('active');
|
||||
|
||||
if (jQuery.isArray(field.value)) {
|
||||
jQuery.each(field.value, function (i, value) {
|
||||
var cbox_elem = $dom.find('input[type=checkbox][value="' + value + '"]');
|
||||
cbox_elem.attr('checked', true);
|
||||
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');
|
||||
});
|
||||
} else {
|
||||
var cbox_elem = $dom.find('input[type=checkbox][value="' + field.value + '"]');
|
||||
cbox_elem.attr('checked', true);
|
||||
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':
|
||||
|
||||
if ( $dom.find('input[type=radio]:checked').length >= 1 ) {
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
$dom.find('input[type=radio]:checked').removeAttr('checked');
|
||||
|
||||
$dom.find('span.um-field-radio-state i').removeClass('um-icon-android-radio-button-on');
|
||||
$dom.find('span.um-field-radio-state i').addClass('um-icon-android-radio-button-off');
|
||||
$dom.find('.um-field-radio.active').removeClass('active');
|
||||
|
||||
var radio_elem = $dom.find("input[type=radio][value='" + field.value + "']");
|
||||
radio_elem.attr('checked', true);
|
||||
radio_elem.closest('.um-field-radio').find('i').removeClass('um-icon-android-radio-button-off');
|
||||
radio_elem.closest('.um-field-radio').find('i').addClass('um-icon-android-radio-button-on');
|
||||
radio_elem.closest('.um-field-radio').addClass('active');
|
||||
|
||||
}, 100);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
} // end switch type
|
||||
|
||||
|
||||
if ( ! $dom.hasClass( 'um-field-has-changed' ) ) {
|
||||
var me = um_get_field_element( $dom );
|
||||
|
||||
if ( type == 'radio' || type == 'checkbox' ) {
|
||||
me = me.find( ':checked' );
|
||||
}
|
||||
|
||||
if ( me ) {
|
||||
me.trigger( 'change' );
|
||||
$dom.addClass( 'um-field-has-changed' );
|
||||
}
|
||||
|
||||
/*
|
||||
maybe future fix
|
||||
if ( me ) {
|
||||
if ( type == 'radio' || type == 'checkbox' ) {
|
||||
me.each( function() {
|
||||
if ( jQuery(this).is(':checked') ) {
|
||||
jQuery(this).trigger('change');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
me.trigger( 'change' );
|
||||
}
|
||||
|
||||
$dom.addClass( 'um-field-has-changed' );
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides sibling/child field when parent field is hidden
|
||||
*/
|
||||
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') {
|
||||
jQuery.each(conditions, function (key, condition) {
|
||||
jQuery('.um-field[data-key="' + condition.owner + '"]').hide();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides div for IE browser
|
||||
* @param object $dom
|
||||
*/
|
||||
function _hide_in_ie( $dom ){
|
||||
if ( typeof( jQuery.browser ) != 'undefined' && jQuery.browser.msie ) {
|
||||
$dom.css({"visibility":"hidden"});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows div for IE browser
|
||||
* @param object $dom
|
||||
*/
|
||||
function _show_in_ie( $dom ){
|
||||
if ( typeof( jQuery.browser ) != 'undefined' && jQuery.browser.msie ) {
|
||||
$dom.css({"visibility":"visible"});
|
||||
}
|
||||
}
|
||||
|
||||
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('.um-profile-body .um-field input, .um-profile-body .um-field textarea').on('change keyup', function () {
|
||||
condition_fields();
|
||||
});
|
||||
jQuery('.um-profile-body .um-field select').on('change', function () {
|
||||
condition_fields();
|
||||
});
|
||||
|
||||
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="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);
|
||||
});
|
||||
|
||||
jQuery(document).on('um_fields_change', function () {
|
||||
um_field_hide_siblings();
|
||||
um_field_hide_siblings(); // dupes, issue with false field wrapper's visiblity validations. requires optimization.
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* UM Conditional fields Init
|
||||
*/
|
||||
function um_init_field_conditions() {
|
||||
var arr_field_keys = [];
|
||||
|
||||
jQuery( '.um-field[data-key]' ).each( function() {
|
||||
|
||||
var key = jQuery(this).data( 'key' );
|
||||
|
||||
arr_field_keys.push( key );
|
||||
|
||||
var parse_attrs = {};
|
||||
jQuery.each( jQuery(this)[0].attributes, function ( index, attribute ) {
|
||||
if ( attribute.name.indexOf( 'data-cond' ) != -1 ) {
|
||||
// replace "data-cond-"
|
||||
var cond_field_id_and_attr = attribute.name.slice( 10 );
|
||||
// return "n"
|
||||
var cond_field_id = cond_field_id_and_attr.substring( 1, 0 );
|
||||
//replace "n-"
|
||||
var cond_field_attr = cond_field_id_and_attr.slice( 2 );
|
||||
|
||||
if ( typeof parse_attrs[cond_field_id] == 'undefined' )
|
||||
parse_attrs[cond_field_id] = {};
|
||||
|
||||
parse_attrs[cond_field_id][cond_field_attr] = attribute.value;
|
||||
}
|
||||
});
|
||||
|
||||
jQuery.each( parse_attrs, function ( ii, dd ) {
|
||||
var obj = {'field' :{
|
||||
owner: key,
|
||||
action: dd.action,
|
||||
parent: dd.field,
|
||||
operator: dd.operator,
|
||||
value: dd.value,
|
||||
condition: {
|
||||
owner: key,
|
||||
action: dd.action,
|
||||
operator: dd.operator,
|
||||
value: dd.value
|
||||
}
|
||||
}};
|
||||
|
||||
arr_all_conditions.push(obj);
|
||||
});
|
||||
|
||||
um_field_default_values[jQuery(this).data('key')] = um_get_field_default_value( jQuery(this) );
|
||||
});
|
||||
|
||||
jQuery.each( arr_field_keys, function ( i, field_key ) {
|
||||
um_field_conditions[field_key] = um_get_field_children( field_key );
|
||||
});
|
||||
|
||||
jQuery( '.um-field[data-key]:visible' ).each( function() {
|
||||
var $wrap_dom = jQuery(this);
|
||||
var me = um_get_field_element( $wrap_dom );
|
||||
if ( typeof me.trigger !== 'undefined' ) {
|
||||
me.trigger( 'change' );
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
um_init_field_conditions();
|
||||
});
|
||||
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
@@ -184,6 +184,15 @@ jQuery(document).ready(function() {
|
||||
|
||||
jQuery('.um-s1,.um-s2').css({'display':'block'});
|
||||
|
||||
if( jQuery(".um-s1").length > 0 ){
|
||||
jQuery(".um-s1").each(function () {
|
||||
var select = jQuery(this);
|
||||
if( select.val() === '' && select.attr('data-default') ) {
|
||||
select.val(select.attr('data-default'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(".um-s1").select2({
|
||||
|
||||
allowClear: true,
|
||||
|
||||
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
@@ -295,4 +295,52 @@ span.um-admin-icon-clear{
|
||||
}
|
||||
span.um-admin-icon-clear.show {display: inline-block}
|
||||
span.um-admin-icon-clear:hover {color: #777}
|
||||
span.um-admin-icon-clear i {font-size: 20px;vertical-align: middle;}
|
||||
span.um-admin-icon-clear i {font-size: 20px;vertical-align: middle;}
|
||||
|
||||
.um-admin-new-condition-compare-and {
|
||||
margin-top: 10px !important;
|
||||
margin-bottom: 10px !important;
|
||||
text-align: center;
|
||||
}
|
||||
.um-admin-new-condition-compare-or {
|
||||
display: block !important;
|
||||
width: 150px;
|
||||
margin-top: 20px !important;
|
||||
text-align: center;
|
||||
}
|
||||
hr.or-devider {
|
||||
border-width: 3px;
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
margin: 10px 0;
|
||||
}
|
||||
hr.or-devider:after {
|
||||
content: 'OR';
|
||||
display: block;
|
||||
position: absolute;
|
||||
background: #fff;
|
||||
left: 50%;
|
||||
margin: -11px 0 0 -13px;
|
||||
top: 50%;
|
||||
text-align: center;
|
||||
color: #000;
|
||||
width: 26px;
|
||||
}
|
||||
.um-admin-cur-condition {
|
||||
position: relative;
|
||||
}
|
||||
.um-admin-cur-condition:after {
|
||||
clear: both;
|
||||
content: '';
|
||||
display: block;
|
||||
}
|
||||
.um-admin-cur-condition + .um-admin-cur-condition:before {
|
||||
content: 'AND';
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -25px;
|
||||
right: -7px;
|
||||
}
|
||||
.um-admin-cur-condition p:last-of-type('p') {
|
||||
float: right;
|
||||
}
|
||||
@@ -1,30 +1,35 @@
|
||||
function um_admin_live_update_scripts() {
|
||||
function um_admin_live_update_scripts(count) {
|
||||
|
||||
/*jQuery('.um-admin-modal-body:visible select').select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10
|
||||
});*/
|
||||
var metakey = jQuery('.um-admin-modal #UM_edit_field #_metakey').val();
|
||||
|
||||
if( count === 0 ){
|
||||
jQuery('.um_add_field .um-admin-btn-toggle').hide();
|
||||
} else if( metakey && count === 1 ){
|
||||
jQuery('.um_add_field .um-admin-btn-toggle').hide();
|
||||
} else {
|
||||
jQuery('.um_add_field .um-admin-btn-toggle').show();
|
||||
}
|
||||
|
||||
jQuery('.um-adm-conditional').each(function(){jQuery(this).trigger('change');});
|
||||
if ( jQuery('.um-admin-colorpicker').length ) {
|
||||
jQuery('.um-admin-colorpicker').wpColorPicker();
|
||||
}
|
||||
|
||||
jQuery('.um-adm-conditional').each(function(){jQuery(this).trigger('change');});
|
||||
if ( jQuery('.um-admin-colorpicker').length ) {
|
||||
jQuery('.um-admin-colorpicker').wpColorPicker();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function um_admin_new_modal( id, ajax, size ){
|
||||
|
||||
|
||||
var modal = jQuery('body').find('.um-admin-overlay');
|
||||
|
||||
|
||||
jQuery('.tipsy').hide();
|
||||
|
||||
|
||||
um_admin_remove_modal();
|
||||
|
||||
|
||||
jQuery('body').addClass('um-admin-modal-open').append('<div class="um-admin-overlay" /><div class="um-admin-modal" />');
|
||||
jQuery('#' + id).prependTo('.um-admin-modal');
|
||||
jQuery('#' + id).show();
|
||||
jQuery('.um-admin-modal').show();
|
||||
|
||||
|
||||
jQuery('.um-admin-modal-head').append('<a href="#" data-action="UM_remove_modal" class="um-admin-modal-close"><i class="um-faicon-times"></i></a>');
|
||||
|
||||
if ( ajax == true ) {
|
||||
@@ -34,23 +39,23 @@ function um_admin_new_modal( id, ajax, size ){
|
||||
} else {
|
||||
um_admin_modal_responsive();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
|
||||
|
||||
var count = jQuery('.um-admin-builder .um-admin-drag-fld').length;
|
||||
in_row = '';
|
||||
in_sub_row = '';
|
||||
in_column = '';
|
||||
in_group = '';
|
||||
|
||||
|
||||
if ( jQuery('.um-col-demon-settings').data('in_column') ) {
|
||||
in_row = jQuery('.um-col-demon-settings').data('in_row');
|
||||
in_sub_row = jQuery('.um-col-demon-settings').data('in_sub_row');
|
||||
in_column = jQuery('.um-col-demon-settings').data('in_column');
|
||||
in_group = jQuery('.um-col-demon-settings').data('in_group');
|
||||
}
|
||||
|
||||
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'POST',
|
||||
@@ -62,10 +67,10 @@ function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
|
||||
success: function(data){
|
||||
|
||||
jQuery('.um-admin-modal').find('.um-admin-modal-body').html( data );
|
||||
|
||||
|
||||
um_responsive();
|
||||
|
||||
um_admin_live_update_scripts();
|
||||
|
||||
um_admin_live_update_scripts(count);
|
||||
|
||||
jQuery( "#_custom_dropdown_options_source" ).trigger('blur');
|
||||
|
||||
@@ -76,11 +81,11 @@ function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
|
||||
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_edit');
|
||||
jQuery('.um-admin-editor:visible').html( jQuery('.um-hidden-editor-edit').contents() );
|
||||
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_edit');
|
||||
|
||||
|
||||
jQuery('.switch-html').trigger('click');
|
||||
jQuery('.switch-html').trigger('click');
|
||||
jQuery('.switch-tmce').trigger('click');
|
||||
|
||||
|
||||
jQuery('#um_editor_edit_ifr').height(200);
|
||||
|
||||
var editor = tinyMCE.get('um_editor_edit');
|
||||
@@ -92,19 +97,19 @@ function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
|
||||
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_new');
|
||||
jQuery('.um-admin-editor:visible').html( jQuery('.um-hidden-editor-new').contents() );
|
||||
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_new');
|
||||
|
||||
|
||||
jQuery('.switch-html').trigger('click');
|
||||
jQuery('.switch-html').trigger('click');
|
||||
jQuery('.switch-tmce').trigger('click');
|
||||
|
||||
|
||||
jQuery('#um_editor_new_ifr').height(200);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
um_init_tooltips();
|
||||
|
||||
|
||||
},
|
||||
error: function(data){
|
||||
|
||||
@@ -121,23 +126,23 @@ function um_admin_modal_responsive() {
|
||||
function um_admin_remove_modal(){
|
||||
|
||||
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
|
||||
|
||||
|
||||
if ( jQuery('.um-admin-modal:visible').find('form').parent().attr('id') == 'UM_edit_field' ) {
|
||||
|
||||
|
||||
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_edit');
|
||||
jQuery('.um-hidden-editor-edit').html( jQuery('.um-admin-editor:visible').contents() );
|
||||
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_edit');
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_new');
|
||||
jQuery('.um-hidden-editor-new').html( jQuery('.um-admin-editor:visible').contents() );
|
||||
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_new');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
jQuery('body').removeClass('um-admin-modal-open');
|
||||
jQuery('.um-admin-modal div[id^="UM_"]').hide().appendTo('body');
|
||||
jQuery('.um-admin-modal,.um-admin-overlay').remove();
|
||||
@@ -165,7 +170,7 @@ function um_admin_modal_add_attr( id, value ) {
|
||||
**/
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
|
||||
/**
|
||||
disable link
|
||||
**/
|
||||
@@ -173,11 +178,22 @@ jQuery(document).ready(function() {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
toggle area
|
||||
**/
|
||||
jQuery(document).on('click', '.um-admin-btn-toggle a', function(e){
|
||||
|
||||
jQuery('.condition-wrap .um-admin-cur-condition').each(function () {
|
||||
var cond_operator = jQuery(this).find('[id^="_conditional_operator"]').val();
|
||||
var cond_value = jQuery(this).find('[id^="_conditional_value"]');
|
||||
if( cond_operator === 'empty' || cond_operator === 'not empty' ){
|
||||
cond_value.attr('disabled','disabled');
|
||||
} else {
|
||||
cond_value.removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
var content = jQuery(this).parent().find('.um-admin-btn-content');
|
||||
var link = jQuery(this);
|
||||
if ( content.is(':hidden') ) {
|
||||
@@ -192,73 +208,128 @@ jQuery(document).ready(function() {
|
||||
um_admin_modal_responsive();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
check if empty/not empty
|
||||
**/
|
||||
jQuery(document).on('change', 'select[id^="_conditional_operator"]', function(){
|
||||
var cond_operator = jQuery(this).val();
|
||||
var cond_value = jQuery(this).closest('.um-admin-cur-condition').find('[id^="_conditional_value"]');
|
||||
if( cond_operator === 'empty' || cond_operator === 'not empty' ){
|
||||
cond_value.attr('disabled','disabled');
|
||||
} else {
|
||||
cond_value.removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
clone a condition
|
||||
**/
|
||||
jQuery(document).on('click', '.um-admin-new-condition', function() {
|
||||
|
||||
if ( jQuery(this).hasClass('disabled') )
|
||||
return false;
|
||||
if ( jQuery(this).hasClass('disabled') )
|
||||
return false;
|
||||
|
||||
var content = jQuery(this).parents('.um-admin-btn-content'),
|
||||
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');
|
||||
if ( length < 5 ) {
|
||||
|
||||
var template = jQuery('.um-admin-btn-content').find('.um-admin-cur-condition-template').clone();
|
||||
template.find('input[type=text]').val('');
|
||||
template.find('select').val('');
|
||||
if( jQuery('#UM_add_field .um-admin-btn-content .um-admin-cur-condition-template').length>0 ){
|
||||
var template = jQuery('#UM_add_field .um-admin-btn-content').find('.um-admin-cur-condition-template').clone();
|
||||
} else {
|
||||
var template = jQuery('#UM_edit_field .um-admin-btn-content').find('.um-admin-cur-condition-template').clone();
|
||||
}
|
||||
|
||||
template.appendTo( content );
|
||||
jQuery(template).removeClass("um-admin-cur-condition-template");
|
||||
jQuery(template).addClass("um-admin-cur-condition");
|
||||
template.find('input[type=text]').val('');
|
||||
template.find('select').val('');
|
||||
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
} else {
|
||||
jQuery(this).addClass('disabled');
|
||||
alert( 'You already have 5 rules' );
|
||||
}
|
||||
//need fields refactor
|
||||
if ( jQuery(this).hasClass('um-admin-new-condition-compare-and') ){
|
||||
|
||||
template.find('#_conditional_compare').val('and');
|
||||
var group = jQuery(this).prev('.um-admin-cur-condition').find('[id^="_conditional_group"]').val();
|
||||
|
||||
template.find('#_conditional_group').val(group);
|
||||
var templatehtml = template.html();
|
||||
template.insertBefore( jQuery(this) );
|
||||
|
||||
} else {
|
||||
|
||||
template.find('#_conditional_compare').val('or');
|
||||
var group = jQuery('.condition-wrap .um-admin-cur-condition').last().find('[id^="_conditional_group"]').val();
|
||||
template.find('#_conditional_group').val(parseInt(group)+1);
|
||||
var button = jQuery('.um-admin-new-condition-compare-and:first').clone();
|
||||
jQuery('<hr class="or-devider" />').insertBefore( jQuery(this) );
|
||||
template.insertBefore( jQuery(this) );
|
||||
button.addClass('for-remove-on-reset').insertBefore( jQuery(this) );
|
||||
|
||||
}
|
||||
|
||||
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 {
|
||||
jQuery(this).addClass('disabled');
|
||||
alert( 'You already have 5 rules' );
|
||||
}
|
||||
//need fields refactor
|
||||
var conditions = jQuery('.um-admin-cur-condition');
|
||||
jQuery(conditions).each( function ( i ) {
|
||||
id = i === 0 ? '' : i;
|
||||
jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id);
|
||||
jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id);
|
||||
jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id);
|
||||
jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id);
|
||||
jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id);
|
||||
jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
|
||||
|
||||
jQuery(conditions).each( function ( i ) {
|
||||
// var value = jQuery( this )
|
||||
|
||||
id = i === 0 ? '' : i;
|
||||
jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id);
|
||||
jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id);
|
||||
jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id);
|
||||
jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id);
|
||||
jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id);
|
||||
jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
|
||||
jQuery( this ).find('[id^="_conditional_compare"]').attr('name', '_conditional_compare' + id);
|
||||
jQuery( this ).find('[id^="_conditional_compare"]').attr('id', '_conditional_compare' + id);
|
||||
jQuery( this ).find('[id^="_conditional_group"]').attr('name', '_conditional_group' + id);
|
||||
jQuery( this ).find('[id^="_conditional_group"]').attr('id', '_conditional_group' + id);
|
||||
} );
|
||||
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
reset conditions
|
||||
**/
|
||||
jQuery(document).on('click', '.um-admin-reset-conditions a', function(){
|
||||
var content = jQuery(this).parents('.um-admin-btn-content');
|
||||
content.find('.um-admin-cur-condition').slice(1).remove();
|
||||
content.find('input[type=text]').val('');
|
||||
content.find('select').val('');
|
||||
jQuery('.um-admin-new-condition').removeClass('disabled');
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
var content = jQuery(this).parents('.um-admin-btn-content');
|
||||
content.find('.um-admin-cur-condition').slice(1).remove();
|
||||
content.find('input[type=text]').val('');
|
||||
content.find('select').val('');
|
||||
jQuery('.um-admin-new-condition').removeClass('disabled');
|
||||
jQuery('.condition-wrap hr').remove();
|
||||
jQuery('.condition-wrap .for-remove-on-reset').remove();
|
||||
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
remove a condition
|
||||
**/
|
||||
jQuery(document).on('click', '.um-admin-remove-condition', function(){
|
||||
var condition = jQuery(this).parents('.um-admin-cur-condition');
|
||||
jQuery('.um-admin-new-condition').removeClass('disabled');
|
||||
jQuery('.tipsy').remove();
|
||||
condition.remove();
|
||||
var condition = jQuery(this).parents('.um-admin-cur-condition');
|
||||
jQuery('.um-admin-new-condition').removeClass('disabled');
|
||||
jQuery('.tipsy').remove();
|
||||
var compare = condition.find('input[type=hidden]').val();
|
||||
if( compare == 'or' ){
|
||||
condition.next().find('input[type=hidden]').val(compare);
|
||||
}
|
||||
|
||||
if( condition.prev().is('hr') && condition.next().is('.um-admin-new-condition-compare-and') ){
|
||||
condition.next().remove();
|
||||
condition.prev().remove();
|
||||
}
|
||||
condition.remove();
|
||||
|
||||
//need fields refactor
|
||||
var conditions = jQuery('.um-admin-cur-condition');
|
||||
jQuery(conditions).each( function ( i ) {
|
||||
@@ -271,48 +342,52 @@ jQuery(document).ready(function() {
|
||||
jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id);
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
|
||||
jQuery( this ).find('[id^="_conditional_compare"]').attr('name', '_conditional_compare' + id);
|
||||
jQuery( this ).find('[id^="_conditional_compare"]').attr('id', '_conditional_compare' + id);
|
||||
jQuery( this ).find('[id^="_conditional_group"]').attr('name', '_conditional_group' + id);
|
||||
jQuery( this ).find('[id^="_conditional_group"]').attr('id', '_conditional_group' + id);
|
||||
} );
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
remove modal via action
|
||||
**/
|
||||
jQuery(document).on('click', '.um-admin-overlay, a[data-action="UM_remove_modal"]', function(){
|
||||
um_admin_remove_modal();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
fire new modal
|
||||
**/
|
||||
jQuery(document).on('click', 'a[data-modal^="UM_"], span[data-modal^="UM_"]', function(e){
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var modal_id = jQuery(this).attr('data-modal');
|
||||
|
||||
if ( jQuery(this).attr('data-back') ) {
|
||||
|
||||
|
||||
jQuery('#UM_fonticons').find('a.um-admin-modal-back').attr("data-modal", jQuery(this).attr('data-back') );
|
||||
var current_icon = jQuery( '#' + jQuery(this).attr('data-back') ).find('input#_icon').val();
|
||||
if ( current_icon == '' ) {
|
||||
jQuery('#UM_fonticons').find('.um-admin-icons span').removeClass('highlighted');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( jQuery(this).data('dynamic-content') ) {
|
||||
um_admin_new_modal( modal_id, true, jQuery(this).data('modal-size') );
|
||||
um_admin_modal_ajaxcall( jQuery(this).data('dynamic-content'), jQuery(this).data('arg1'), jQuery(this).data('arg2'), jQuery(this).data('arg3') );
|
||||
} else {
|
||||
um_admin_new_modal( modal_id );
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
choose font icon
|
||||
**/
|
||||
@@ -322,7 +397,7 @@ jQuery(document).ready(function() {
|
||||
jQuery(this).addClass('highlighted');
|
||||
jQuery('#UM_fonticons').find('a.um-admin-modal-back').attr("data-code", icon);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
submit font icon
|
||||
**/
|
||||
@@ -344,7 +419,7 @@ jQuery(document).ready(function() {
|
||||
um_admin_remove_modal();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
restore font icon
|
||||
**/
|
||||
@@ -359,7 +434,7 @@ jQuery(document).ready(function() {
|
||||
element.find('.um-admin-icon-value').html('No Icon');
|
||||
jQuery(this).hide();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
search font icons
|
||||
**/
|
||||
@@ -373,14 +448,14 @@ jQuery(document).ready(function() {
|
||||
um_admin_modal_responsive();
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve options from a callback function
|
||||
*/
|
||||
jQuery(document).on('blur',"#_custom_dropdown_options_source", function(){
|
||||
var me = jQuery(this);
|
||||
var _options = jQuery('textarea[id=_options]');
|
||||
|
||||
|
||||
if( me.val() != '' ){
|
||||
var um_option_callback = me.val();
|
||||
jQuery.ajax({
|
||||
@@ -388,17 +463,17 @@ jQuery(document).ready(function() {
|
||||
type: 'POST',
|
||||
data: { action:'populate_dropdown_options',um_option_callback: um_option_callback },
|
||||
complete: function(){
|
||||
|
||||
|
||||
},
|
||||
success: function( response ){
|
||||
var arr_opts = [];
|
||||
|
||||
|
||||
for (var key in response.data ){
|
||||
arr_opts.push( response.data[ key ] );
|
||||
}
|
||||
|
||||
_options.val( arr_opts.join('\n') );
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -168,27 +168,27 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
|
||||
unset( $array['conditions'] );
|
||||
if ( isset($array['conditional_field']) && !empty( $array['conditional_action'] ) && !empty( $array['conditional_operator'] ) ) {
|
||||
$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'] );
|
||||
$array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'], $array['conditional_compare'], $array['conditional_group'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field1']) && !empty( $array['conditional_action1'] ) && !empty( $array['conditional_operator1'] ) ) {
|
||||
$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'] );
|
||||
$array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'], $array['conditional_compare1'], $array['conditional_group1'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field2']) && !empty( $array['conditional_action2'] ) && !empty( $array['conditional_operator2'] ) ) {
|
||||
$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'] );
|
||||
$array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'], $array['conditional_compare2'], $array['conditional_group2'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field3']) && !empty( $array['conditional_action3'] ) && !empty( $array['conditional_operator3'] ) ) {
|
||||
$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'] );
|
||||
$array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'], $array['conditional_compare3'], $array['conditional_group3'] );
|
||||
}
|
||||
|
||||
if ( isset($array['conditional_field4']) && !empty( $array['conditional_action4'] ) && !empty( $array['conditional_operator4'] ) ) {
|
||||
$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'] );
|
||||
$array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'], $array['conditional_compare4'], $array['conditional_group4'] );
|
||||
}
|
||||
|
||||
return $array;
|
||||
@@ -236,52 +236,65 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
|
||||
<?php $metabox->field_input( '_conditional_field', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_compare', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_group', $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>
|
||||
<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>
|
||||
<?php /*<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>
|
||||
<div class="condition-wrap">
|
||||
<?php if ( isset( $edit_array['conditions'] ) && count( $edit_array['conditions'] ) != 0 ) {
|
||||
|
||||
<?php if ( isset( $edit_array['conditions'] ) && count( $edit_array['conditions'] ) != 0 ) {
|
||||
foreach ( $edit_array['conditions'] as $k => $arr ) {
|
||||
|
||||
foreach ( $edit_array['conditions'] as $k => $arr ) {
|
||||
if ( $k == 0 ) $k = ''; ?>
|
||||
<?php if( $arr[4] == 'or' ){ ?>
|
||||
<a href="#" class="for-remove-on-reset um-admin-new-condition um-admin-new-condition-compare-and button button-primary um-admin-tipsy-n" title="Add new condition"><?php _e( 'Add new rule', 'ultimate-member' ); ?></a>
|
||||
|
||||
if ( $k == 0 ) $k = ''; ?>
|
||||
<hr class="or-devider" />
|
||||
<?php } ?>
|
||||
<div class="um-admin-cur-condition">
|
||||
|
||||
<div class="um-admin-cur-condition">
|
||||
<?php $metabox->field_input( '_conditional_action' . $k, $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_field' . $k , $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_value' . $k, $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_compare' . $k, $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_group' . $k, $form_id ); ?>
|
||||
|
||||
<?php $metabox->field_input( '_conditional_action' . $k, $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_field' . $k , $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_value' . $k, $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>
|
||||
<?php
|
||||
}
|
||||
|
||||
} else { ?>
|
||||
|
||||
<div class="um-admin-cur-condition">
|
||||
|
||||
<?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 ); ?>
|
||||
<?php $metabox->field_input( '_conditional_compare', $form_id ); ?>
|
||||
<?php $metabox->field_input( '_conditional_group', $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 class="um-admin-clear"></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
<?php } ?>
|
||||
<a href="#" class="um-admin-new-condition um-admin-new-condition-compare-and button button-primary um-admin-tipsy-n" title="Add new condition"><?php _e( 'Add new rule', 'ultimate-member' ); ?></a>
|
||||
<a href="#" class="um-admin-new-condition um-admin-new-condition-compare-or button button-primary um-admin-tipsy-n" title="Add new condition"><?php _e( 'Add new rule group', 'ultimate-member' ); ?></a>
|
||||
|
||||
} else { ?>
|
||||
|
||||
<div class="um-admin-cur-condition">
|
||||
|
||||
<?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>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -31,6 +31,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
}
|
||||
|
||||
|
||||
function set_data( $data ) {
|
||||
$this->form_data = $data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render form
|
||||
*
|
||||
@@ -247,7 +253,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
$html .= call_user_func( array( &$this, 'render_' . $data['type'] ), $data );
|
||||
|
||||
} else {
|
||||
|
||||
$html .= $this->render_field_by_hook( $data );
|
||||
|
||||
}
|
||||
@@ -304,6 +309,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
$for_attr = ' for="' . $id . '" ';
|
||||
|
||||
$label = $data['label'];
|
||||
if ( isset( $data['required'] ) && $data['required'] )
|
||||
$label = $label . '<span class="um-req" title="'.__('Required','ultimate-member').'">*</span>';
|
||||
|
||||
$tooltip = ! empty( $data['tooltip'] ) ? UM()->tooltip( $data['tooltip'], false, false ) : '';
|
||||
|
||||
return "<label $for_attr>$label $tooltip</label>";
|
||||
|
||||
@@ -1346,7 +1346,30 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
<p>
|
||||
<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
|
||||
break;
|
||||
|
||||
case '_conditional_compare':
|
||||
case '_conditional_compare1':
|
||||
case '_conditional_compare2':
|
||||
case '_conditional_compare3':
|
||||
case '_conditional_compare4':
|
||||
?>
|
||||
<p>
|
||||
<input type="hidden" name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" value="<?php echo isset( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>">
|
||||
</p>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case '_conditional_group':
|
||||
case '_conditional_group1':
|
||||
case '_conditional_group2':
|
||||
case '_conditional_group3':
|
||||
case '_conditional_group4':
|
||||
?>
|
||||
<p>
|
||||
<input type="hidden" name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" value="<?php echo isset( $this->edit_mode_value ) ? $this->edit_mode_value : '0'; ?>">
|
||||
</p>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
@@ -855,7 +855,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
* @param $data array
|
||||
* @return um\admin\core\Admin_Forms()
|
||||
*/
|
||||
function admin_forms( $data ) {
|
||||
function admin_forms( $data = false ) {
|
||||
if ( empty( $this->classes['admin_forms_' . $data['class']] ) ) {
|
||||
$this->classes['admin_forms_' . $data['class']] = new um\admin\core\Admin_Forms( $data );
|
||||
}
|
||||
@@ -869,7 +869,7 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
* @param $data array
|
||||
* @return um\admin\core\Admin_Forms_Settings()
|
||||
*/
|
||||
function admin_forms_settings( $data ) {
|
||||
function admin_forms_settings( $data = false ) {
|
||||
if ( empty( $this->classes['admin_forms_settings_' . $data['class']] ) ) {
|
||||
$this->classes['admin_forms_settings_' . $data['class']] = new um\admin\core\Admin_Forms_Settings( $data );
|
||||
}
|
||||
|
||||
@@ -1292,8 +1292,6 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
|
||||
$all = UM()->fields()->array_sort_by_column( $all, 'title');
|
||||
|
||||
$all = array( 0 => '') + $all;
|
||||
|
||||
return $all;
|
||||
}
|
||||
|
||||
|
||||
@@ -430,10 +430,10 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
/**
|
||||
* Load responsive styles
|
||||
*/
|
||||
function load_responsive(){
|
||||
function load_responsive() {
|
||||
|
||||
wp_register_script('um_responsive', um_url . 'assets/js/um-responsive' . $this->suffix . '.js' );
|
||||
wp_enqueue_script('um_responsive');
|
||||
wp_register_script( 'um_responsive', um_url . 'assets/js/um-responsive' . $this->suffix . '.js', array( 'um_crop' ), ultimatemember_version, true );
|
||||
wp_enqueue_script( 'um_responsive' );
|
||||
|
||||
wp_register_style('um_responsive', um_url . 'assets/css/um-responsive.css', array( 'um_profile' ) );
|
||||
wp_enqueue_style('um_responsive');
|
||||
|
||||
@@ -202,12 +202,16 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
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 ][ 'conditional_compare' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_group' . $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 ][ 'conditional_compare' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ][ 'conditional_group' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ]['conditions'][ $arr_id ] );
|
||||
}
|
||||
}
|
||||
@@ -259,6 +263,40 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
$keys = array_keys($fields);
|
||||
$last_key = end($keys);
|
||||
unset($fields[$last_key]['conditions']);
|
||||
unset($fields[$last_key]['conditional_action']);
|
||||
unset($fields[$last_key]['conditional_action1']);
|
||||
unset($fields[$last_key]['conditional_action2']);
|
||||
unset($fields[$last_key]['conditional_action3']);
|
||||
unset($fields[$last_key]['conditional_action4']);
|
||||
unset($fields[$last_key]['conditional_field']);
|
||||
unset($fields[$last_key]['conditional_field1']);
|
||||
unset($fields[$last_key]['conditional_field2']);
|
||||
unset($fields[$last_key]['conditional_field3']);
|
||||
unset($fields[$last_key]['conditional_field4']);
|
||||
unset($fields[$last_key]['conditional_operator']);
|
||||
unset($fields[$last_key]['conditional_operator1']);
|
||||
unset($fields[$last_key]['conditional_operator2']);
|
||||
unset($fields[$last_key]['conditional_operator3']);
|
||||
unset($fields[$last_key]['conditional_operator4']);
|
||||
unset($fields[$last_key]['conditional_value']);
|
||||
unset($fields[$last_key]['conditional_value1']);
|
||||
unset($fields[$last_key]['conditional_value2']);
|
||||
unset($fields[$last_key]['conditional_value3']);
|
||||
unset($fields[$last_key]['conditional_value4']);
|
||||
unset($fields[$last_key]['conditional_group']);
|
||||
unset($fields[$last_key]['conditional_group1']);
|
||||
unset($fields[$last_key]['conditional_group2']);
|
||||
unset($fields[$last_key]['conditional_group3']);
|
||||
unset($fields[$last_key]['conditional_group4']);
|
||||
unset($fields[$last_key]['conditional_compare']);
|
||||
unset($fields[$last_key]['conditional_compare1']);
|
||||
unset($fields[$last_key]['conditional_compare2']);
|
||||
unset($fields[$last_key]['conditional_compare3']);
|
||||
unset($fields[$last_key]['conditional_compare4']);
|
||||
|
||||
// add field to form
|
||||
UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
|
||||
|
||||
@@ -1245,9 +1283,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
if (isset( $array['conditions'] ) && is_array( $array['conditions'] ) && !$this->viewing) {
|
||||
$array['conditional'] = '';
|
||||
|
||||
foreach ($array['conditions'] as $cond_id => $cond) {
|
||||
$array['conditional'] .= ' data-cond-' . $cond_id . '-action="' . $cond[0] . '" data-cond-' . $cond_id . '-field="' . $cond[1] . '" data-cond-' . $cond_id . '-operator="' . $cond[2] . '" data-cond-' . $cond_id . '-value="' . $cond[3] . '"';
|
||||
}
|
||||
$cond_data = json_encode($array['conditions']);
|
||||
$array['conditional'] .= " data-conds='".$cond_data."'";
|
||||
|
||||
$array['classes'] .= ' um-is-conditional';
|
||||
|
||||
@@ -2533,7 +2570,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$placeholder = strip_tags( $placeholder );
|
||||
}
|
||||
|
||||
$output .= '<select ' . $disabled . ' ' . $select_original_option_value . ' ' . $disabled_by_parent_option . ' name="' . $form_key . '" id="' . $field_id . '" data-validate="' . $validate . '" data-key="' . $key . '" class="' . $this->get_class( $key, $data, $class ) . '" style="width: 100%" data-placeholder="' . $placeholder . '" ' . $atts_ajax . '>';
|
||||
$output .= '<select data-default="' . $data['default'] . '" ' . $disabled . ' ' . $select_original_option_value . ' ' . $disabled_by_parent_option . ' name="' . $form_key . '" id="' . $field_id . '" data-validate="' . $validate . '" data-key="' . $key . '" class="' . $this->get_class( $key, $data, $class ) . '" style="width: 100%" data-placeholder="' . $placeholder . '" ' . $atts_ajax . '>';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
|
||||
@@ -327,63 +327,63 @@ function um_submit_form_errors_hook_( $args ) {
|
||||
}
|
||||
} elseif ( $op == 'not empty' ) {
|
||||
if ( ! empty( $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'equals to' ) {
|
||||
if ( $cond_value == $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'not equals' ) {
|
||||
if ( $cond_value != $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'greater than' ) {
|
||||
if ( $cond_value > $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'less than' ) {
|
||||
if ( $cond_value < $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'contains' ) {
|
||||
if ( is_string( $cond_value ) && strstr( $cond_value, $parent_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
if( is_array( $cond_value ) && in_array( $parent_value, $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} elseif ( $visibility == 'show' ) {
|
||||
if ( $op == 'empty' ) {
|
||||
if ( ! empty( $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'not empty' ) {
|
||||
if ( empty( $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'equals to' ) {
|
||||
if ( $cond_value != $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'not equals' ) {
|
||||
if ( $cond_value == $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'greater than' ) {
|
||||
if ( $cond_value <= $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'less than' ) {
|
||||
if ( $cond_value >= $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'contains' ) {
|
||||
if ( is_string( $cond_value ) && ! strstr( $cond_value, $parent_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
if( is_array( $cond_value ) && !in_array( $parent_value, $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
* @return string
|
||||
*/
|
||||
function um_edit_label_all_fields( $label, $data ) {
|
||||
|
||||
$asterisk = UM()->options()->get( 'form_asterisk' );
|
||||
if ( $asterisk && isset( $data['required'] ) && $data['required'] == 1 )
|
||||
$label = $label . '<span class="um-req" title="'.__('Required','ultimate-member').'">*</span>';
|
||||
|
||||
+250
-104
@@ -288,142 +288,288 @@ function um_user_ip() {
|
||||
* @return bool
|
||||
*/
|
||||
function um_field_conditions_are_met( $data ) {
|
||||
|
||||
|
||||
|
||||
if (!isset( $data['conditions'] )) return true;
|
||||
|
||||
$state = 1;
|
||||
$state = ( $data['conditional_action'] == 'show' ) ? 1 : 0;
|
||||
|
||||
foreach ($data['conditions'] as $k => $arr) {
|
||||
if ($arr[0] == 'show') {
|
||||
|
||||
$val = $arr[3];
|
||||
$op = $arr[2];
|
||||
$first_group = 0;
|
||||
$state_array = array();
|
||||
$count = count($state_array);
|
||||
foreach ($data['conditions'] as $k => $arr){
|
||||
|
||||
if (strstr( $arr[1], 'role_' ))
|
||||
$arr[1] = 'role';
|
||||
$val = $arr[3];
|
||||
$op = $arr[2];
|
||||
|
||||
$field = um_profile( $arr[1] );
|
||||
if (strstr($arr[1], 'role_'))
|
||||
$arr[1] = 'role';
|
||||
|
||||
switch ($op) {
|
||||
case 'equals to':
|
||||
$field = um_profile($arr[1]);
|
||||
|
||||
$field = maybe_unserialize( $field );
|
||||
|
||||
if (is_array( $field ))
|
||||
$state = in_array( $val, $field ) ? 1 : 0;
|
||||
else
|
||||
$state = ( $field == $val ) ? 1 : 0;
|
||||
if( $arr[5] != $first_group ){
|
||||
|
||||
break;
|
||||
case 'not equals':
|
||||
|
||||
$field = maybe_unserialize( $field );
|
||||
if ($arr[0] == 'show') {
|
||||
|
||||
if (is_array( $field ))
|
||||
$state = !in_array( $val, $field ) ? 1 : 0;
|
||||
else
|
||||
$state = ( $field != $val ) ? 1 : 0;
|
||||
switch ($op) {
|
||||
case 'equals to':
|
||||
|
||||
break;
|
||||
case 'empty':
|
||||
$field = maybe_unserialize( $field );
|
||||
|
||||
$state = ( !$field ) ? 1 : 0;
|
||||
if (is_array( $field ))
|
||||
$state = in_array( $val, $field ) ? 'show' : 'hide';
|
||||
else
|
||||
$state = ( $field == $val ) ? 'show' : 'hide';
|
||||
|
||||
break;
|
||||
case 'not empty':
|
||||
break;
|
||||
case 'not equals':
|
||||
|
||||
$state = ( $field ) ? 1 : 0;
|
||||
$field = maybe_unserialize( $field );
|
||||
|
||||
break;
|
||||
case 'greater than':
|
||||
if ($field > $val) {
|
||||
$state = 1;
|
||||
} else {
|
||||
$state = 0;
|
||||
}
|
||||
break;
|
||||
case 'less than':
|
||||
if ($field < $val) {
|
||||
$state = 1;
|
||||
} else {
|
||||
$state = 0;
|
||||
}
|
||||
break;
|
||||
case 'contains':
|
||||
if (strstr( $field, $val )) {
|
||||
$state = 1;
|
||||
} else {
|
||||
$state = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if ($arr[0] == 'hide') {
|
||||
if (is_array( $field ))
|
||||
$state = !in_array( $val, $field ) ? 'show' : 'hide';
|
||||
else
|
||||
$state = ( $field != $val ) ? 'show' : 'hide';
|
||||
|
||||
$state = 1;
|
||||
$val = $arr[3];
|
||||
$op = $arr[2];
|
||||
break;
|
||||
case 'empty':
|
||||
|
||||
if (strstr( $arr[1], 'role_' ))
|
||||
$arr[1] = 'role';
|
||||
$state = ( !$field ) ? 'show' : 'hide';
|
||||
|
||||
$field = um_profile( $arr[1] );
|
||||
break;
|
||||
case 'not empty':
|
||||
|
||||
switch ($op) {
|
||||
case 'equals to':
|
||||
$state = ( $field ) ? 'show' : 'hide';
|
||||
|
||||
$field = maybe_unserialize( $field );
|
||||
break;
|
||||
case 'greater than':
|
||||
if ($field > $val) {
|
||||
$state = 'show';
|
||||
} else {
|
||||
$state = 'hide';
|
||||
}
|
||||
break;
|
||||
case 'less than':
|
||||
if ($field < $val) {
|
||||
$state = 'show';
|
||||
} else {
|
||||
$state = 'hide';
|
||||
}
|
||||
break;
|
||||
case 'contains':
|
||||
if (strstr( $field, $val )) {
|
||||
$state = 'show';
|
||||
} else {
|
||||
$state = 'hide';
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if ($arr[0] == 'hide') {
|
||||
|
||||
if (is_array( $field ))
|
||||
$state = in_array( $val, $field ) ? 0 : 1;
|
||||
else
|
||||
$state = ( $field == $val ) ? 0 : 1;
|
||||
switch ($op) {
|
||||
case 'equals to':
|
||||
|
||||
break;
|
||||
case 'not equals':
|
||||
$field = maybe_unserialize( $field );
|
||||
|
||||
$field = maybe_unserialize( $field );
|
||||
if (is_array( $field ))
|
||||
$state = in_array( $val, $field ) ? 'hide' : 'show';
|
||||
else
|
||||
$state = ( $field == $val ) ? 'hide' : 'show';
|
||||
|
||||
if (is_array( $field ))
|
||||
$state = !in_array( $val, $field ) ? 0 : 1;
|
||||
else
|
||||
$state = ( $field != $val ) ? 0 : 1;
|
||||
break;
|
||||
case 'not equals':
|
||||
|
||||
break;
|
||||
case 'empty':
|
||||
$field = maybe_unserialize( $field );
|
||||
|
||||
$state = ( !$field ) ? 0 : 1;
|
||||
if (is_array( $field ))
|
||||
$state = !in_array( $val, $field ) ? 'hide' : 'show';
|
||||
else
|
||||
$state = ( $field != $val ) ? 'hide' : 'show';
|
||||
|
||||
break;
|
||||
case 'not empty':
|
||||
break;
|
||||
case 'empty':
|
||||
|
||||
$state = ( $field ) ? 0 : 1;
|
||||
$state = ( !$field ) ? 'hide' : 'show';
|
||||
|
||||
break;
|
||||
case 'greater than':
|
||||
if ($field <= $val) {
|
||||
$state = 0;
|
||||
} else {
|
||||
$state = 1;
|
||||
}
|
||||
break;
|
||||
case 'less than':
|
||||
if ($field >= $val) {
|
||||
$state = 0;
|
||||
} else {
|
||||
$state = 1;
|
||||
}
|
||||
break;
|
||||
case 'contains':
|
||||
if (strstr( $field, $val )) {
|
||||
$state = 0;
|
||||
} else {
|
||||
$state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'not empty':
|
||||
|
||||
return ( $state ) ? true : false;
|
||||
$state = ( $field ) ? 'hide' : 'show';
|
||||
|
||||
break;
|
||||
case 'greater than':
|
||||
if ($field <= $val) {
|
||||
$state = 'hide';
|
||||
} else {
|
||||
$state = 'show';
|
||||
}
|
||||
break;
|
||||
case 'less than':
|
||||
if ($field >= $val) {
|
||||
$state = 'hide';
|
||||
} else {
|
||||
$state = 'show';
|
||||
}
|
||||
break;
|
||||
case 'contains':
|
||||
if (strstr( $field, $val )) {
|
||||
$state = 'hide';
|
||||
} else {
|
||||
$state = 'show';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$first_group++;
|
||||
array_push($state_array, $state);
|
||||
} else {
|
||||
|
||||
if ($arr[0] == 'show') {
|
||||
|
||||
switch ($op) {
|
||||
case 'equals to':
|
||||
|
||||
$field = maybe_unserialize( $field );
|
||||
|
||||
if (is_array( $field ))
|
||||
$state = in_array( $val, $field ) ? 'show' : 'not_show';
|
||||
else
|
||||
$state = ( $field == $val ) ? 'show' : 'not_show';
|
||||
|
||||
break;
|
||||
case 'not equals':
|
||||
|
||||
$field = maybe_unserialize( $field );
|
||||
|
||||
if (is_array( $field ))
|
||||
$state = !in_array( $val, $field ) ? 'show' : 'not_show';
|
||||
else
|
||||
$state = ( $field != $val ) ? 'show' : 'not_show';
|
||||
|
||||
break;
|
||||
case 'empty':
|
||||
|
||||
$state = ( !$field ) ? 'show' : 'not_show';
|
||||
|
||||
break;
|
||||
case 'not empty':
|
||||
|
||||
$state = ( $field ) ? 'show': 'not_show';
|
||||
|
||||
break;
|
||||
case 'greater than':
|
||||
if ($field > $val) {
|
||||
$state = 'show';
|
||||
} else {
|
||||
$state = 'not_show';
|
||||
}
|
||||
break;
|
||||
case 'less than':
|
||||
if ($field < $val) {
|
||||
$state = 'show';
|
||||
} else {
|
||||
$state = 'not_show';
|
||||
}
|
||||
break;
|
||||
case 'contains':
|
||||
if (strstr( $field, $val )) {
|
||||
$state = 'show';
|
||||
} else {
|
||||
$state = 'not_show';
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if ($arr[0] == 'hide') {
|
||||
|
||||
switch ($op) {
|
||||
case 'equals to':
|
||||
|
||||
$field = maybe_unserialize( $field );
|
||||
|
||||
if (is_array( $field ))
|
||||
$state = in_array( $val, $field ) ? 'hide' : 'not_hide';
|
||||
else
|
||||
$state = ( $field == $val ) ? 'hide' : 'not_hide';
|
||||
|
||||
break;
|
||||
case 'not equals':
|
||||
|
||||
$field = maybe_unserialize( $field );
|
||||
|
||||
if (is_array( $field ))
|
||||
$state = !in_array( $val, $field ) ? 'hide' : 'not_hide';
|
||||
else
|
||||
$state = ( $field != $val ) ? 'hide' : 'not_hide';
|
||||
|
||||
break;
|
||||
case 'empty':
|
||||
|
||||
$state = ( !$field ) ? 'hide' : 'not_hide';
|
||||
|
||||
break;
|
||||
case 'not empty':
|
||||
|
||||
$state = ( $field ) ? 'hide' : 'not_hide';
|
||||
|
||||
break;
|
||||
case 'greater than':
|
||||
if ($field <= $val) {
|
||||
$state = 'hide';
|
||||
} else {
|
||||
$state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
case 'less than':
|
||||
if ($field >= $val) {
|
||||
$state = 'hide';
|
||||
} else {
|
||||
$state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
case 'contains':
|
||||
if (strstr( $field, $val )) {
|
||||
$state = 'hide';
|
||||
} else {
|
||||
$state = 'not_hide';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( isset($state_array[$count]) ){
|
||||
if( $state_array[$count] == 'show' || $state_array[$count] == 'not_hide' ){
|
||||
if ( $state == 'show' || $state == 'not_hide' ){
|
||||
$state_array[$count] = 'show';
|
||||
} else {
|
||||
$state_array[$count] = 'hide';
|
||||
}
|
||||
} else {
|
||||
if ( $state == 'hide' || $state == 'not_show' ){
|
||||
$state_array[$count] = 'hide';
|
||||
} else {
|
||||
$state_array[$count] = 'hide';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( $state == 'show' || $state == 'not_hide' ){
|
||||
$state_array[$count] = 'show';
|
||||
} else {
|
||||
$state_array[$count] = 'hide';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$result = array_unique($state_array);
|
||||
if( !in_array("show", $result) ){
|
||||
return $state = false;
|
||||
} else {
|
||||
return $state = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,8 +33,13 @@
|
||||
"grunt-contrib-watch": "~0.6.1",
|
||||
"grunt-modernizr": "~0.6.0",
|
||||
"grunt-wp-assets": "~0.2.6",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-uglify": "^3.0.1",
|
||||
"load-grunt-tasks": "~1.0.0",
|
||||
"time-grunt": "~1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"gulp-install": "^1.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,28 @@
|
||||
<?php foreach( UM()->shortcodes()->loop as $comment ) { ?>
|
||||
|
||||
<?php $post_type = get_post_type( $comment->comment_post_ID );
|
||||
if( $post_type == 'um_groups_discussion' ){
|
||||
$comment_id = $comment->comment_post_ID;
|
||||
$group_id = get_post_meta( $comment_id, '_group_id', true);
|
||||
$comment_title = get_the_title($group_id);
|
||||
$link = site_url().'/groups/'.$comment_title.'/?tab=discussion'.'#commentid-'.$comment_id;
|
||||
} else {
|
||||
$comment_title = get_the_title($comment->comment_post_ID);
|
||||
$link = get_permalink($comment->comment_post_ID);
|
||||
}
|
||||
?>
|
||||
<div class="um-item">
|
||||
<div class="um-item-link"><i class="um-icon-chatboxes"></i><a href="<?php echo get_comment_link( $comment->comment_ID ); ?>"><?php echo get_comment_excerpt( $comment->comment_ID ); ?></a></div>
|
||||
<div class="um-item-meta">
|
||||
<span><?php printf(__('On <a href="%1$s">%2$s</a>','ultimate-member'), get_permalink($comment->comment_post_ID), get_the_title($comment->comment_post_ID) ); ?></span>
|
||||
<span><?php printf(__('On <a href="%1$s">%2$s</a>','ultimate-member'), $link, $comment_title ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if ( isset( UM()->shortcodes()->modified_args) && count(UM()->shortcodes()->loop) >= 10 ) { ?>
|
||||
|
||||
|
||||
<div class="um-load-items">
|
||||
<a href="#" class="um-ajax-paginate um-button" data-hook="um_load_comments" data-args="<?php echo UM()->shortcodes()->modified_args; ?>"><?php _e('load more comments','ultimate-member'); ?></a>
|
||||
</div>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
Reference in New Issue
Block a user