mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-13 19:56:27 +09:00
- added default values for date/time picker;
- fixed theme upgrader;
This commit is contained in:
+361
-336
@@ -2,254 +2,279 @@
|
||||
if( jQuery(this).data('load-error') != undefined ) return;
|
||||
jQuery(this).data('load-error', '1').attr('src', jQuery(this).data('default'));
|
||||
});*/
|
||||
|
||||
function um_init_datetimepicker() {
|
||||
jQuery('.um-datepicker').each(function(){
|
||||
elem = jQuery(this);
|
||||
|
||||
if ( typeof elem.attr('data-disabled_weekdays') != 'undefined' && elem.attr('data-disabled_weekdays') != '' ) {
|
||||
var disable = JSON.parse( elem.attr('data-disabled_weekdays') );
|
||||
} else {
|
||||
var disable = false;
|
||||
}
|
||||
|
||||
var years_n = null;
|
||||
if ( typeof elem.attr('data-years') != 'undefined' ) {
|
||||
years_n = elem.attr('data-years');
|
||||
}
|
||||
|
||||
var minRange = elem.attr('data-date_min');
|
||||
var maxRange = elem.attr('data-date_max');
|
||||
|
||||
var minSplit = [], maxSplit = [];
|
||||
if ( typeof minRange != 'undefined' ) {
|
||||
minSplit = minRange.split(",");
|
||||
}
|
||||
if ( typeof maxRange != 'undefined' ) {
|
||||
maxSplit = maxRange.split(",");
|
||||
}
|
||||
|
||||
var min = minSplit.length ? new Date(minSplit) : null;
|
||||
var max = minSplit.length ? new Date(maxSplit) : null;
|
||||
|
||||
// fix min date for safari
|
||||
if ( min && min.toString() == 'Invalid Date' && minSplit.length == 3 ) {
|
||||
var minDateString = minSplit[1] + '/' + minSplit[2] + '/' + minSplit[0];
|
||||
min = new Date(Date.parse(minDateString));
|
||||
}
|
||||
|
||||
// fix max date for safari
|
||||
if ( max && max.toString() == 'Invalid Date' && maxSplit.length == 3 ) {
|
||||
var maxDateString = maxSplit[1] + '/' + maxSplit[2] + '/' + maxSplit[0];
|
||||
max = new Date(Date.parse(maxDateString));
|
||||
}
|
||||
|
||||
var data = {
|
||||
disable: disable,
|
||||
format: elem.attr( 'data-format' ),
|
||||
formatSubmit: 'yyyy/mm/dd',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
};
|
||||
|
||||
if ( years_n !== null ) {
|
||||
data.selectYears = years_n;
|
||||
}
|
||||
|
||||
if ( min !== null ) {
|
||||
data.min = min;
|
||||
}
|
||||
|
||||
if ( max !== null ) {
|
||||
data.max = max;
|
||||
}
|
||||
|
||||
elem.pickadate( data );
|
||||
});
|
||||
|
||||
jQuery('.um-timepicker').each(function(){
|
||||
elem = jQuery(this);
|
||||
|
||||
elem.pickatime({
|
||||
format: elem.attr('data-format'),
|
||||
interval: parseInt( elem.attr('data-intervals') ),
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
jQuery(document).on('click', '.um-dropdown a', function(e){
|
||||
jQuery(document).on('click', '.um-dropdown a', function(e){
|
||||
|
||||
return false;
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-dropdown a.real_url', function(e){
|
||||
jQuery(document).on('click', '.um-dropdown a.real_url', function(e){
|
||||
|
||||
window.location = jQuery(this).attr('href');
|
||||
});
|
||||
window.location = jQuery(this).attr('href');
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-trigger-menu-on-click', function(e){
|
||||
jQuery('.um-dropdown').hide();
|
||||
menu = jQuery(this).find('.um-dropdown');
|
||||
menu.show();
|
||||
return false;
|
||||
});
|
||||
jQuery(document).on('click', '.um-trigger-menu-on-click', function(e){
|
||||
jQuery('.um-dropdown').hide();
|
||||
menu = jQuery(this).find('.um-dropdown');
|
||||
menu.show();
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-dropdown-hide', function(e){
|
||||
UM_hide_menus();
|
||||
});
|
||||
jQuery(document).on('click', '.um-dropdown-hide', function(e){
|
||||
UM_hide_menus();
|
||||
});
|
||||
|
||||
jQuery(document).on('click', 'a.um-manual-trigger', function(){
|
||||
var child = jQuery(this).attr('data-child');
|
||||
var parent = jQuery(this).attr('data-parent');
|
||||
jQuery(this).parents( parent ).find( child ).trigger('click');
|
||||
});
|
||||
jQuery(document).on('click', 'a.um-manual-trigger', function(){
|
||||
var child = jQuery(this).attr('data-child');
|
||||
var parent = jQuery(this).attr('data-parent');
|
||||
jQuery(this).parents( parent ).find( child ).trigger('click');
|
||||
});
|
||||
|
||||
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3 });
|
||||
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: 'a.live', offset: 3 });
|
||||
|
||||
jQuery(document).on('change', '.um-field-area input[type=radio]', function(){
|
||||
var field = jQuery(this).parents('.um-field-area');
|
||||
var this_field = jQuery(this).parents('label');
|
||||
field.find('.um-field-radio').removeClass('active');
|
||||
field.find('.um-field-radio').find('i').removeAttr('class').addClass('um-icon-android-radio-button-off');
|
||||
this_field.addClass('active');
|
||||
this_field.find('i').removeAttr('class').addClass('um-icon-android-radio-button-on');
|
||||
});
|
||||
jQuery(document).on('change', '.um-field-area input[type=radio]', function(){
|
||||
var field = jQuery(this).parents('.um-field-area');
|
||||
var this_field = jQuery(this).parents('label');
|
||||
field.find('.um-field-radio').removeClass('active');
|
||||
field.find('.um-field-radio').find('i').removeAttr('class').addClass('um-icon-android-radio-button-off');
|
||||
this_field.addClass('active');
|
||||
this_field.find('i').removeAttr('class').addClass('um-icon-android-radio-button-on');
|
||||
});
|
||||
|
||||
jQuery(document).on('change', '.um-field-area input[type=checkbox]', function(){
|
||||
jQuery(document).on('change', '.um-field-area input[type=checkbox]', function(){
|
||||
|
||||
var field = jQuery(this).parents('.um-field-area');
|
||||
var this_field = jQuery(this).parents('label');
|
||||
if ( this_field.hasClass('active') ) {
|
||||
this_field.removeClass('active');
|
||||
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline-blank');
|
||||
} else {
|
||||
this_field.addClass('active');
|
||||
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline');
|
||||
}
|
||||
});
|
||||
var field = jQuery(this).parents('.um-field-area');
|
||||
var this_field = jQuery(this).parents('label');
|
||||
if ( this_field.hasClass('active') ) {
|
||||
this_field.removeClass('active');
|
||||
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline-blank');
|
||||
} else {
|
||||
this_field.addClass('active');
|
||||
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline');
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('.um-datepicker').each(function(){
|
||||
elem = jQuery(this);
|
||||
|
||||
if ( elem.attr('data-disabled_weekdays') != '' ) {
|
||||
var disable = JSON.parse( elem.attr('data-disabled_weekdays') );
|
||||
} else {
|
||||
var disable = false;
|
||||
}
|
||||
um_init_datetimepicker();
|
||||
|
||||
var years_n = elem.attr('data-years');
|
||||
jQuery('.um-rating').um_raty({
|
||||
half: false,
|
||||
starType: 'i',
|
||||
number: function() {return jQuery(this).attr('data-number');},
|
||||
score: function() {return jQuery(this).attr('data-score');},
|
||||
scoreName: function(){return jQuery(this).attr('data-key');},
|
||||
hints: false,
|
||||
click: function( score, evt ) {
|
||||
live_field = this.id;
|
||||
live_value = score;
|
||||
um_apply_conditions( jQuery(this), false );
|
||||
}
|
||||
});
|
||||
|
||||
var minRange = elem.attr('data-date_min');
|
||||
var maxRange = elem.attr('data-date_max');
|
||||
jQuery('.um-rating-readonly').um_raty({
|
||||
half: false,
|
||||
starType: 'i',
|
||||
number: function() {return jQuery(this).attr('data-number');},
|
||||
score: function() {return jQuery(this).attr('data-score');},
|
||||
scoreName: function(){return jQuery(this).attr('data-key');},
|
||||
hints: false,
|
||||
readOnly: true
|
||||
});
|
||||
|
||||
var minSplit = minRange.split(",");
|
||||
var maxSplit = maxRange.split(",");
|
||||
jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
var src = jQuery(this).parents('.um-field').find('.um-single-image-preview img').attr('src');
|
||||
parent.find('.um-single-image-preview img').attr('src','');
|
||||
parent.find('.um-single-image-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
|
||||
var min = minSplit.length ? new Date(minSplit) : null;
|
||||
var max = minSplit.length ? new Date(maxSplit) : null;
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_remove_file',
|
||||
src: src,
|
||||
nonce: um_scripts.nonce
|
||||
}
|
||||
});
|
||||
|
||||
// fix min date for safari
|
||||
if(min && min.toString() == 'Invalid Date' && minSplit.length == 3) {
|
||||
var minDateString = minSplit[1] + '/' + minSplit[2] + '/' + minSplit[0];
|
||||
min = new Date(Date.parse(minDateString));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// fix max date for safari
|
||||
if(max && max.toString() == 'Invalid Date' && maxSplit.length == 3) {
|
||||
var maxDateString = maxSplit[1] + '/' + maxSplit[2] + '/' + maxSplit[0];
|
||||
max = new Date(Date.parse(maxDateString));
|
||||
}
|
||||
jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
var src = jQuery(this).parents('.um-field').find('.um-single-fileinfo a').attr('href');
|
||||
parent.find('.um-single-file-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
|
||||
elem.pickadate({
|
||||
selectYears: years_n,
|
||||
min: min,
|
||||
max: max,
|
||||
disable: disable,
|
||||
format: elem.attr('data-format'),
|
||||
formatSubmit: 'yyyy/mm/dd',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
});
|
||||
});
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_remove_file',
|
||||
src: src,
|
||||
nonce: um_scripts.nonce
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('.um-timepicker').each(function(){
|
||||
elem = jQuery(this);
|
||||
return false;
|
||||
});
|
||||
|
||||
elem.pickatime({
|
||||
format: elem.attr('data-format'),
|
||||
interval: parseInt( elem.attr('data-intervals') ),
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
});
|
||||
});
|
||||
jQuery('.um-s1,.um-s2').css({'display':'block'});
|
||||
|
||||
jQuery('.um-rating').um_raty({
|
||||
half: false,
|
||||
starType: 'i',
|
||||
number: function() {return jQuery(this).attr('data-number');},
|
||||
score: function() {return jQuery(this).attr('data-score');},
|
||||
scoreName: function(){return jQuery(this).attr('data-key');},
|
||||
hints: false,
|
||||
click: function( score, evt ) {
|
||||
live_field = this.id;
|
||||
live_value = score;
|
||||
um_apply_conditions( jQuery(this), false );
|
||||
}
|
||||
});
|
||||
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-rating-readonly').um_raty({
|
||||
half: false,
|
||||
starType: 'i',
|
||||
number: function() {return jQuery(this).attr('data-number');},
|
||||
score: function() {return jQuery(this).attr('data-score');},
|
||||
scoreName: function(){return jQuery(this).attr('data-key');},
|
||||
hints: false,
|
||||
readOnly: true
|
||||
});
|
||||
jQuery(".um-s1").select2({
|
||||
|
||||
jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
var src = jQuery(this).parents('.um-field').find('.um-single-image-preview img').attr('src');
|
||||
parent.find('.um-single-image-preview img').attr('src','');
|
||||
parent.find('.um-single-image-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
allowClear: true,
|
||||
});
|
||||
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_remove_file',
|
||||
src: src,
|
||||
nonce: um_scripts.nonce
|
||||
}
|
||||
});
|
||||
jQuery(".um-s2").select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
jQuery(document).on('click', '.um-field-group-head:not(.disabled)', function(){
|
||||
var field = jQuery(this).parents('.um-field-group');
|
||||
var limit = field.data('max_entries');
|
||||
|
||||
jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
var src = jQuery(this).parents('.um-field').find('.um-single-fileinfo a').attr('href');
|
||||
parent.find('.um-single-file-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
if ( field.find('.um-field-group-body').is(':hidden')){
|
||||
field.find('.um-field-group-body').show();
|
||||
} else {
|
||||
field.find('.um-field-group-body:first').clone().appendTo( field );
|
||||
}
|
||||
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_remove_file',
|
||||
src: src,
|
||||
nonce: um_scripts.nonce
|
||||
}
|
||||
});
|
||||
increase_id = 0;
|
||||
field.find('.um-field-group-body').each(function(){
|
||||
increase_id++;
|
||||
jQuery(this).find('input').each(function(){
|
||||
var input = jQuery(this);
|
||||
input.attr('id', input.data('key') + '-' + increase_id );
|
||||
input.attr('name', input.data('key') + '-' + increase_id );
|
||||
input.parent().parent().find('label').attr('for', input.data('key') + '-' + increase_id );
|
||||
});
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
if ( limit > 0 && field.find('.um-field-group-body').length == limit ) {
|
||||
|
||||
jQuery('.um-s1,.um-s2').css({'display':'block'});
|
||||
jQuery(this).addClass('disabled');
|
||||
|
||||
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({
|
||||
jQuery(document).on('click', '.um-field-group-cancel', function(e){
|
||||
e.preventDefault();
|
||||
var field = jQuery(this).parents('.um-field-group');
|
||||
|
||||
allowClear: true,
|
||||
});
|
||||
var limit = field.data('max_entries');
|
||||
|
||||
jQuery(".um-s2").select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
if ( field.find('.um-field-group-body').length > 1 ) {
|
||||
jQuery(this).parents('.um-field-group-body').remove();
|
||||
} else {
|
||||
jQuery(this).parents('.um-field-group-body').hide();
|
||||
}
|
||||
|
||||
jQuery(document).on('click', '.um-field-group-head:not(.disabled)', function(){
|
||||
var field = jQuery(this).parents('.um-field-group');
|
||||
var limit = field.data('max_entries');
|
||||
if ( limit > 0 && field.find('.um-field-group-body').length < limit ) {
|
||||
field.find('.um-field-group-head').removeClass('disabled');
|
||||
}
|
||||
|
||||
if ( field.find('.um-field-group-body').is(':hidden')){
|
||||
field.find('.um-field-group-body').show();
|
||||
} else {
|
||||
field.find('.um-field-group-body:first').clone().appendTo( field );
|
||||
}
|
||||
|
||||
increase_id = 0;
|
||||
field.find('.um-field-group-body').each(function(){
|
||||
increase_id++;
|
||||
jQuery(this).find('input').each(function(){
|
||||
var input = jQuery(this);
|
||||
input.attr('id', input.data('key') + '-' + increase_id );
|
||||
input.attr('name', input.data('key') + '-' + increase_id );
|
||||
input.parent().parent().find('label').attr('for', input.data('key') + '-' + increase_id );
|
||||
});
|
||||
});
|
||||
|
||||
if ( limit > 0 && field.find('.um-field-group-body').length == limit ) {
|
||||
|
||||
jQuery(this).addClass('disabled');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '.um-field-group-cancel', function(e){
|
||||
e.preventDefault();
|
||||
var field = jQuery(this).parents('.um-field-group');
|
||||
|
||||
var limit = field.data('max_entries');
|
||||
|
||||
if ( field.find('.um-field-group-body').length > 1 ) {
|
||||
jQuery(this).parents('.um-field-group-body').remove();
|
||||
} else {
|
||||
jQuery(this).parents('.um-field-group-body').hide();
|
||||
}
|
||||
|
||||
if ( limit > 0 && field.find('.um-field-group-body').length < limit ) {
|
||||
field.find('.um-field-group-head').removeClass('disabled');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
jQuery( document.body ).on( 'click', '.um-ajax-paginate', function(e) {
|
||||
@@ -310,166 +335,166 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
|
||||
|
||||
jQuery(document).on('click', '.um-ajax-action', function(e){
|
||||
e.preventDefault();
|
||||
var hook = jQuery(this).data('hook');
|
||||
var user_id = jQuery(this).data('user_id');
|
||||
var arguments = jQuery(this).data('arguments');
|
||||
jQuery(document).on('click', '.um-ajax-action', function(e){
|
||||
e.preventDefault();
|
||||
var hook = jQuery(this).data('hook');
|
||||
var user_id = jQuery(this).data('user_id');
|
||||
var arguments = jQuery(this).data('arguments');
|
||||
|
||||
if ( jQuery(this).data('js-remove') ){
|
||||
jQuery(this).parents('.'+jQuery(this).data('js-remove')).fadeOut('fast');
|
||||
}
|
||||
if ( jQuery(this).data('js-remove') ){
|
||||
jQuery(this).parents('.'+jQuery(this).data('js-remove')).fadeOut('fast');
|
||||
}
|
||||
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_muted_action',
|
||||
hook: hook,
|
||||
user_id: user_id,
|
||||
arguments: arguments,
|
||||
nonce: um_scripts.nonce
|
||||
},
|
||||
success: function(data){
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_muted_action',
|
||||
hook: hook,
|
||||
user_id: user_id,
|
||||
arguments: arguments,
|
||||
nonce: um_scripts.nonce
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '#um-search-button', function() {
|
||||
jQuery(document).on('click', '#um-search-button', function() {
|
||||
|
||||
jQuery(this).parents('form').submit();
|
||||
});
|
||||
jQuery(this).parents('form').submit();
|
||||
});
|
||||
|
||||
jQuery('.um-form input[class=um-button][type=submit]').removeAttr('disabled');
|
||||
jQuery('.um-form input[class=um-button][type=submit]').removeAttr('disabled');
|
||||
|
||||
jQuery(document).one('click', '.um:not(.um-account) .um-form input[class=um-button][type=submit]:not(.um-has-recaptcha)', function() {
|
||||
jQuery(this).attr('disabled','disabled');
|
||||
jQuery(this).parents('form').submit();
|
||||
jQuery(document).one('click', '.um:not(.um-account) .um-form input[class=um-button][type=submit]:not(.um-has-recaptcha)', function() {
|
||||
jQuery(this).attr('disabled','disabled');
|
||||
jQuery(this).parents('form').submit();
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var um_select_options_cache = {};
|
||||
var um_select_options_cache = {};
|
||||
|
||||
/**
|
||||
* Find all select fields with parent select fields
|
||||
*/
|
||||
jQuery('select[data-um-parent]').each(function(){
|
||||
/**
|
||||
* Find all select fields with parent select fields
|
||||
*/
|
||||
jQuery('select[data-um-parent]').each(function(){
|
||||
|
||||
var me = jQuery(this);
|
||||
var parent_option = me.data('um-parent');
|
||||
var um_ajax_url = me.data('um-ajax-url');
|
||||
var um_ajax_source = me.data('um-ajax-source');
|
||||
var original_value = me.val();
|
||||
var me = jQuery(this);
|
||||
var parent_option = me.data('um-parent');
|
||||
var um_ajax_url = me.data('um-ajax-url');
|
||||
var um_ajax_source = me.data('um-ajax-source');
|
||||
var original_value = me.val();
|
||||
|
||||
me.attr('data-um-init-field', true );
|
||||
me.attr('data-um-init-field', true );
|
||||
|
||||
jQuery(document).on('change','select[name="'+parent_option+'"]',function(){
|
||||
var parent = jQuery(this);
|
||||
var form_id = parent.closest('form').find('input[type=hidden][name=form_id]').val();
|
||||
var arr_key = parent.val();
|
||||
jQuery(document).on('change','select[name="'+parent_option+'"]',function(){
|
||||
var parent = jQuery(this);
|
||||
var form_id = parent.closest('form').find('input[type=hidden][name=form_id]').val();
|
||||
var arr_key = parent.val();
|
||||
|
||||
if( parent.val() != '' && typeof um_select_options_cache[ arr_key ] != 'object' ){
|
||||
if( parent.val() != '' && typeof um_select_options_cache[ arr_key ] != 'object' ){
|
||||
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_select_options',
|
||||
parent_option_name: parent_option,
|
||||
parent_option: parent.val(),
|
||||
child_callback: um_ajax_source,
|
||||
child_name: me.attr('name'),
|
||||
members_directory: me.attr('data-mebers-directory'),
|
||||
form_id: form_id,
|
||||
nonce: um_scripts.nonce
|
||||
},
|
||||
success: function( data ){
|
||||
if( data.status == 'success' && parent.val() != '' ){
|
||||
um_field_populate_child_options( me, data, arr_key);
|
||||
}
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_select_options',
|
||||
parent_option_name: parent_option,
|
||||
parent_option: parent.val(),
|
||||
child_callback: um_ajax_source,
|
||||
child_name: me.attr('name'),
|
||||
members_directory: me.attr('data-mebers-directory'),
|
||||
form_id: form_id,
|
||||
nonce: um_scripts.nonce
|
||||
},
|
||||
success: function( data ){
|
||||
if( data.status == 'success' && parent.val() != '' ){
|
||||
um_field_populate_child_options( me, data, arr_key);
|
||||
}
|
||||
|
||||
if( typeof data.debug !== 'undefined' ){
|
||||
console.log( data );
|
||||
}
|
||||
},
|
||||
error: function( e ){
|
||||
console.log( e );
|
||||
}
|
||||
});
|
||||
if( typeof data.debug !== 'undefined' ){
|
||||
console.log( data );
|
||||
}
|
||||
},
|
||||
error: function( e ){
|
||||
console.log( e );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if( parent.val() != '' && typeof um_select_options_cache[ arr_key ] == 'object' ) {
|
||||
var data = um_select_options_cache[ arr_key ];
|
||||
um_field_populate_child_options( me, data, arr_key );
|
||||
}
|
||||
if( parent.val() != '' && typeof um_select_options_cache[ arr_key ] == 'object' ) {
|
||||
var data = um_select_options_cache[ arr_key ];
|
||||
um_field_populate_child_options( me, data, arr_key );
|
||||
}
|
||||
|
||||
if( parent.val() == '' ){
|
||||
me.find('option[value!=""]').remove();
|
||||
me.val('').trigger('change');
|
||||
}
|
||||
if( parent.val() == '' ){
|
||||
me.find('option[value!=""]').remove();
|
||||
me.val('').trigger('change');
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
jQuery('select[name="'+parent_option+'"]').trigger('change');
|
||||
jQuery('select[name="'+parent_option+'"]').trigger('change');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Populates child options and cache ajax response
|
||||
* @param DOM me child option elem
|
||||
* @param array data
|
||||
* @param string key
|
||||
*/
|
||||
function um_field_populate_child_options( me, data, arr_key, arr_items ){
|
||||
/**
|
||||
* Populates child options and cache ajax response
|
||||
* @param DOM me child option elem
|
||||
* @param array data
|
||||
* @param string key
|
||||
*/
|
||||
function um_field_populate_child_options( me, data, arr_key, arr_items ){
|
||||
|
||||
|
||||
var parent_option = me.data('um-parent');
|
||||
var child_name = me.attr('name');
|
||||
var parent_dom = jQuery('select[name="'+parent_option+'"]');
|
||||
me.find('option[value!=""]').remove();
|
||||
var parent_option = me.data('um-parent');
|
||||
var child_name = me.attr('name');
|
||||
var parent_dom = jQuery('select[name="'+parent_option+'"]');
|
||||
me.find('option[value!=""]').remove();
|
||||
|
||||
if( ! me.hasClass('um-child-option-disabled') ){
|
||||
me.removeAttr('disabled');
|
||||
}
|
||||
if( ! me.hasClass('um-child-option-disabled') ){
|
||||
me.removeAttr('disabled');
|
||||
}
|
||||
|
||||
var arr_items = [],
|
||||
search_get = '';
|
||||
var arr_items = [],
|
||||
search_get = '';
|
||||
|
||||
if ( data.post.members_directory === 'yes' ) {
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
search_get = urlParams.get(data.post.child_name);
|
||||
}
|
||||
jQuery.each( data.items, function(k,v){
|
||||
arr_items.push({id: k, text: v, selected: (v === search_get) });
|
||||
});
|
||||
if ( data.post.members_directory === 'yes' ) {
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
search_get = urlParams.get(data.post.child_name);
|
||||
}
|
||||
jQuery.each( data.items, function(k,v){
|
||||
arr_items.push({id: k, text: v, selected: (v === search_get) });
|
||||
});
|
||||
|
||||
me.select2('destroy');
|
||||
me.select2({
|
||||
data: arr_items,
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
me.select2('destroy');
|
||||
me.select2({
|
||||
data: arr_items,
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
|
||||
if ( data.post.members_directory !== 'yes' ) {
|
||||
if( typeof data.field.default !== 'undefined' && ! me.data('um-original-value') ){
|
||||
me.val( data.field.default ).trigger('change');
|
||||
}else if( me.data('um-original-value') != '' ){
|
||||
me.val( me.data('um-original-value') ).trigger('change');
|
||||
}
|
||||
if ( data.post.members_directory !== 'yes' ) {
|
||||
if( typeof data.field.default !== 'undefined' && ! me.data('um-original-value') ){
|
||||
me.val( data.field.default ).trigger('change');
|
||||
}else if( me.data('um-original-value') != '' ){
|
||||
me.val( me.data('um-original-value') ).trigger('change');
|
||||
}
|
||||
|
||||
if( data.field.editable == 0 ){
|
||||
me.addClass('um-child-option-disabled');
|
||||
me.attr('disabled','disabled');
|
||||
}
|
||||
}
|
||||
um_select_options_cache[ arr_key ] = data;
|
||||
if( data.field.editable == 0 ){
|
||||
me.addClass('um-child-option-disabled');
|
||||
me.attr('disabled','disabled');
|
||||
}
|
||||
}
|
||||
um_select_options_cache[ arr_key ] = data;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -31,6 +31,7 @@ function um_admin_new_modal( id, ajax, size ) {
|
||||
um_admin_modal_responsive();
|
||||
} else {
|
||||
um_admin_modal_responsive();
|
||||
um_init_datetimepicker();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +139,8 @@ function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
|
||||
}
|
||||
|
||||
um_init_tooltips();
|
||||
|
||||
um_init_datetimepicker();
|
||||
},
|
||||
error: function(data) {
|
||||
|
||||
|
||||
@@ -122,12 +122,27 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
|
||||
wp_register_script( 'um_crop', $this->front_js_baseurl . 'um-crop' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_tipsy', $this->front_js_baseurl . 'um-tipsy' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_functions', $this->front_js_baseurl . 'um-functions' . $this->suffix . '.js', array( 'jquery', 'um_tipsy', 'um_scrollbar' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_scripts', $this->front_js_baseurl . 'um-scripts' . $this->suffix . '.js', array( 'um_functions', 'um_crop', 'um_raty', 'select2', 'um_jquery_form', 'um_fileupload' ), ultimatemember_version, true );
|
||||
|
||||
wp_register_script( 'um_datetime', $this->front_js_baseurl . 'pickadate/picker.js', array( 'jquery' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_datetime_date', $this->front_js_baseurl . 'pickadate/picker.date.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_datetime_time', $this->front_js_baseurl . 'pickadate/picker.time.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_datetime_legacy', $this->front_js_baseurl . 'pickadate/legacy.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true );
|
||||
// load a localized version for date/time
|
||||
$locale = get_locale();
|
||||
if ( $locale && file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) {
|
||||
wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true );
|
||||
}
|
||||
|
||||
wp_register_script( 'um_scripts', $this->front_js_baseurl . 'um-scripts' . $this->suffix . '.js', array( 'um_functions', 'um_crop', 'um_raty', 'select2', 'um_jquery_form', 'um_fileupload', 'um_datetime', 'um_datetime_date', 'um_datetime_time', 'um_datetime_legacy' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_responsive', $this->front_js_baseurl . 'um-responsive' . $this->suffix . '.js', array( 'um_scripts' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_modal', $this->front_js_baseurl . 'um-modal' . $this->suffix . '.js', array( 'um_responsive' ), ultimatemember_version, true );
|
||||
|
||||
|
||||
|
||||
wp_register_style( 'um_datetime', $this->front_css_baseurl . 'pickadate/default.css', array(), ultimatemember_version );
|
||||
wp_register_style( 'um_datetime_date', $this->front_css_baseurl . 'pickadate/default.date.css', array( 'um_datetime' ), ultimatemember_version );
|
||||
wp_register_style( 'um_datetime_time', $this->front_css_baseurl . 'pickadate/default.time.css', array( 'um_datetime' ), ultimatemember_version );
|
||||
|
||||
wp_register_style( 'um_crop', $this->front_css_baseurl . 'um-crop.css', array(), ultimatemember_version );
|
||||
wp_register_style( 'um_tipsy', $this->front_css_baseurl . 'um-tipsy.css', array(), ultimatemember_version );
|
||||
wp_register_style( 'um_responsive', $this->front_css_baseurl . 'um-responsive.css', array(), ultimatemember_version );
|
||||
@@ -137,7 +152,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
|
||||
wp_register_style( 'um_profile', $this->front_css_baseurl . 'um-profile.css', array(), ultimatemember_version );
|
||||
wp_register_style( 'um_account', $this->front_css_baseurl . 'um-account.css', array(), ultimatemember_version );
|
||||
wp_register_style( 'um_misc', $this->front_css_baseurl . 'um-misc.css', array(), ultimatemember_version );
|
||||
wp_register_style( 'um_default_css', $this->front_css_baseurl . 'um-old-default.css', array( 'um_crop', 'um_tipsy', 'um_raty', 'um_responsive', 'um_modal', 'um_styles', 'um_members', 'um_profile', 'um_account', 'um_misc' ), ultimatemember_version );
|
||||
wp_register_style( 'um_default_css', $this->front_css_baseurl . 'um-old-default.css', array( 'um_crop', 'um_tipsy', 'um_raty', 'um_responsive', 'um_modal', 'um_styles', 'um_members', 'um_profile', 'um_account', 'um_misc', 'um_datetime_date', 'um_datetime_time' ), ultimatemember_version );
|
||||
|
||||
wp_enqueue_script( 'um_modal' );
|
||||
wp_enqueue_style( 'um_default_css' );
|
||||
|
||||
@@ -2174,19 +2174,31 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
|
||||
<?php if ( $this->set_field_type == 'textarea' ) { ?>
|
||||
|
||||
<p><label for="_default">Default Text <?php UM()->tooltip( __( 'Text to display by default in this field', 'ultimate-member' ) ); ?></label>
|
||||
<p><label for="_default"><?php _e( 'Default Text', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Text to display by default in this field', 'ultimate-member' ) ); ?></label>
|
||||
<textarea name="_default" id="_default"><?php echo $this->edit_mode_value; ?></textarea>
|
||||
</p>
|
||||
|
||||
<?php } elseif ( $this->set_field_type == 'date' ) { ?>
|
||||
|
||||
<p class="um"><label for="_default"><?php _e( 'Default Date', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'You may use all PHP compatible date formats such as: 2020-02-02, 02/02/2020, yesterday, today, tomorrow, next monday, first day of next month, +3 day', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" class="um-datepicker" data-format="yyyy/mm/dd" />
|
||||
</p>
|
||||
|
||||
<?php } elseif ( $this->set_field_type == 'time' ) { ?>
|
||||
|
||||
<p class="um"><label for="_default"><?php _e( 'Default Time', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'You may use all PHP compatible date formats such as: 2020-02-02, 02/02/2020, yesterday, today, tomorrow, next monday, first day of next month, +3 day', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" class="um-timepicker" data-format="HH:i" />
|
||||
</p>
|
||||
|
||||
<?php } elseif ( $this->set_field_type == 'rating' ) { ?>
|
||||
|
||||
<p><label for="_default">Default Rating <?php UM()->tooltip( __( 'If you wish the rating field to be prefilled with a number of stars, enter it here.', 'ultimate-member' ) ); ?></label>
|
||||
<p><label for="_default"><?php _e( 'Default Rating', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'If you wish the rating field to be prefilled with a number of stars, enter it here.', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" />
|
||||
</p>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<p><label for="_default">Default Value <?php UM()->tooltip( __( 'This option allows you to pre-fill the field with a default value prior to the user entering a value in the field. Leave blank to have no default value', 'ultimate-member' ) ); ?></label>
|
||||
<p><label for="_default"><?php _e( 'Default Value', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'This option allows you to pre-fill the field with a default value prior to the user entering a value in the field. Leave blank to have no default value', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" />
|
||||
</p>
|
||||
|
||||
|
||||
@@ -86,15 +86,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
* @return void
|
||||
*/
|
||||
public function restore_templates( $name = '' ) {
|
||||
$theme = wp_get_theme();
|
||||
$theme = wp_get_theme( $name );
|
||||
|
||||
if ( $name && $name !== $theme->get( 'template' ) ) {
|
||||
if ( empty( $theme ) || ! $theme->exists() ) {
|
||||
return;
|
||||
}
|
||||
if ( isset( $this->restored[$theme->get( 'Name' )] ) ) {
|
||||
if ( isset( $this->restored[ $theme->get( 'Name' ) ] ) ) {
|
||||
return;
|
||||
}
|
||||
if ( empty( $this->saved[$theme->get( 'Name' )] ) ) {
|
||||
if ( empty( $this->saved[ $theme->get( 'Name' ) ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,8 +121,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
error_log( "UM Error. Can not restore theme templates." );
|
||||
}
|
||||
|
||||
update_option( 'theme_version ' . $theme->get( 'Name' ), $theme->get( 'Version' ) );
|
||||
$this->restored[$theme->get( 'Name' )] = $theme->get( 'Version' );
|
||||
delete_option( 'theme_version ' . $theme->get( 'Name' ) );
|
||||
$this->restored[ $theme->get( 'Name' ) ] = $theme->get( 'Version' );
|
||||
}
|
||||
|
||||
|
||||
@@ -133,10 +133,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
|
||||
* @return void
|
||||
*/
|
||||
public function save_templates( $name = '' ) {
|
||||
$theme = wp_get_theme( $name );
|
||||
|
||||
$theme = wp_get_theme();
|
||||
|
||||
if ( $name && $name !== $theme->get( 'template' ) ) {
|
||||
if ( empty( $theme ) || ! $theme->exists() ) {
|
||||
return;
|
||||
}
|
||||
if ( isset( $this->restored[ $theme->get( 'Name' ) ] ) ) {
|
||||
|
||||
@@ -392,27 +392,27 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
),
|
||||
'_max_size' => array(
|
||||
'mode' => 'numeric',
|
||||
'error' => __('Please enter a valid size','ultimate-member')
|
||||
'error' => __( 'Please enter a valid size', 'ultimate-member' )
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
'date' => array(
|
||||
'name' => 'Date Picker',
|
||||
'col1' => array('_title','_metakey','_help','_range','_years','_years_x','_range_start','_range_end','_visibility'),
|
||||
'col1' => array('_title','_metakey','_help','_default','_range','_years','_years_x','_range_start','_range_end','_visibility'),
|
||||
'col2' => array('_label','_placeholder','_public','_roles','_format','_pretty_format','_disabled_weekdays'),
|
||||
'col3' => array('_required','_editable','_icon'),
|
||||
'validate' => array(
|
||||
'_title' => array(
|
||||
'mode' => 'required',
|
||||
'error' => __('You must provide a title','ultimate-member')
|
||||
'error' => __( 'You must provide a title', 'ultimate-member' )
|
||||
),
|
||||
'_metakey' => array(
|
||||
'mode' => 'unique',
|
||||
),
|
||||
'_years' => array(
|
||||
'mode' => 'numeric',
|
||||
'error' => __('Number of years is not valid','ultimate-member')
|
||||
'error' => __( 'Number of years is not valid', 'ultimate-member' )
|
||||
),
|
||||
'_range_start' => array(
|
||||
'mode' => 'range-start',
|
||||
@@ -426,12 +426,12 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
'time' => array(
|
||||
'name' => 'Time Picker',
|
||||
'col1' => array('_title','_metakey','_help','_format','_visibility'),
|
||||
'col2' => array('_label','_placeholder','_public','_roles','_intervals'),
|
||||
'col2' => array('_label','_placeholder','_default','_public','_roles','_intervals'),
|
||||
'col3' => array('_required','_editable','_icon'),
|
||||
'validate' => array(
|
||||
'_title' => array(
|
||||
'mode' => 'required',
|
||||
'error' => __('You must provide a title','ultimate-member')
|
||||
'error' => __( 'You must provide a title', 'ultimate-member' )
|
||||
),
|
||||
'_metakey' => array(
|
||||
'mode' => 'unique',
|
||||
|
||||
@@ -584,7 +584,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
return $_SESSION['um_social_profile'][ $key ];
|
||||
}
|
||||
|
||||
$value = '';
|
||||
$type = ( isset( $data['type'] ) ) ? $data['type'] : '';
|
||||
|
||||
// preview in backend
|
||||
@@ -787,6 +786,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
*/
|
||||
$value = apply_filters( "um_edit_{$key}_field_value", $default, $key );
|
||||
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
|
||||
|
||||
@@ -2120,6 +2121,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
}
|
||||
|
||||
//var_dump( $this->field_value( $key, $default, $data ) );
|
||||
|
||||
$output .= '<input ' . $disabled . ' class="' . $this->get_class( $key, $data ) . '" type="' . $input . '" name="' . $key . UM()->form()->form_suffix . '" id="' . $key . UM()->form()->form_suffix . '" value="' . $this->field_value( $key, $default, $data ) . '" placeholder="' . $placeholder . '" data-validate="' . $validate . '" data-key="' . $key . '" data-range="' . $range . '" data-years="' . $years . '" data-years_x="' . $years_x . '" data-disabled_weekdays="' . $disabled_weekdays . '" data-date_min="' . $date_min . '" data-date_max="' . $date_max . '" data-format="' . $js_format . '" data-value="' . $this->field_value( $key, $default, $data ) . '" />
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -729,4 +729,27 @@ function um_edit_url_field_value( $value, $key ) {
|
||||
$value = esc_attr( $value );
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'um_edit_url_field_value', 'um_edit_url_field_value', 10, 2 );
|
||||
add_filter( 'um_edit_url_field_value', 'um_edit_url_field_value', 10, 2 );
|
||||
|
||||
|
||||
/**
|
||||
* Set current date if date value is empty
|
||||
*
|
||||
* @param string $value "Field Value"
|
||||
* @param string $default "Field Key"
|
||||
* @param string $key "Field Type"
|
||||
* @param string $type "Field Default Value"
|
||||
* @param array $data "Field Data"
|
||||
* @return string
|
||||
*/
|
||||
function um_field_value__default_datetime( $value, $default, $key, $type, $data ) {
|
||||
|
||||
if ( empty( $value ) && empty( $default ) && $type === 'date' ) {
|
||||
$value = date( 'Y/m/d' );
|
||||
} elseif ( empty( $value ) && empty( $default ) && $type === 'time' ) {
|
||||
$value = date( 'H:i' );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'um_field_value', 'um_field_value__default_datetime', 10, 5 );
|
||||
@@ -1,8 +1,8 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Ultimate Member\n"
|
||||
"POT-Creation-Date: 2019-04-14 21:21+0300\n"
|
||||
"PO-Revision-Date: 2019-04-14 21:21+0300\n"
|
||||
"POT-Creation-Date: 2019-04-16 00:56+0300\n"
|
||||
"PO-Revision-Date: 2019-04-16 00:56+0300\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: en_US\n"
|
||||
@@ -103,7 +103,7 @@ msgstr ""
|
||||
#: includes/admin/core/class-admin-builder.php:767
|
||||
#: includes/admin/core/class-admin-dragdrop.php:32
|
||||
#: includes/admin/core/class-admin-menu.php:104
|
||||
#: includes/core/class-fields.php:4117
|
||||
#: includes/core/class-fields.php:4120
|
||||
msgid "Please login as administrator"
|
||||
msgstr ""
|
||||
|
||||
@@ -253,16 +253,16 @@ msgstr ""
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:168
|
||||
#: includes/admin/core/class-admin-enqueue.php:183
|
||||
msgid "e.g. Member Directory"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:170
|
||||
#: includes/admin/core/class-admin-enqueue.php:185
|
||||
msgid "e.g. New Registration Form"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:215
|
||||
#: includes/admin/core/class-admin-enqueue.php:246
|
||||
#: includes/admin/core/class-admin-enqueue.php:230
|
||||
#: includes/admin/core/class-admin-enqueue.php:261
|
||||
#: includes/admin/core/class-admin-forms.php:832
|
||||
#: includes/admin/core/class-admin-forms.php:846
|
||||
#: includes/admin/core/class-admin-forms.php:951
|
||||
@@ -272,39 +272,39 @@ msgstr ""
|
||||
msgid "Remove"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:216
|
||||
#: includes/admin/core/class-admin-enqueue.php:247
|
||||
#: includes/admin/core/class-admin-enqueue.php:231
|
||||
#: includes/admin/core/class-admin-enqueue.php:262
|
||||
#: includes/admin/core/class-admin-forms.php:1028
|
||||
msgid "Select"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:244
|
||||
#: includes/admin/core/class-admin-enqueue.php:259
|
||||
msgid "Are sure, maybe some settings not saved"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:454
|
||||
#: includes/admin/core/class-admin-enqueue.php:469
|
||||
#: includes/core/class-builtin.php:698 includes/core/class-builtin.php:701
|
||||
#: includes/core/class-builtin.php:1155 includes/core/class-builtin.php:1158
|
||||
msgid "Password"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:458
|
||||
#: includes/admin/core/class-admin-enqueue.php:473
|
||||
#: includes/core/class-account.php:104
|
||||
msgid "Privacy"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:462
|
||||
#: includes/admin/core/class-admin-enqueue.php:477
|
||||
#: includes/core/class-account.php:110
|
||||
msgid "Notifications"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:466
|
||||
#: includes/admin/core/class-admin-enqueue.php:481
|
||||
#: includes/admin/core/list-tables/roles-list-table.php:338
|
||||
#: includes/admin/core/list-tables/roles-list-table.php:406
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-enqueue.php:516
|
||||
#: includes/admin/core/class-admin-enqueue.php:531
|
||||
msgid "Ultimate Member Blocks"
|
||||
msgstr ""
|
||||
|
||||
@@ -1040,73 +1040,100 @@ msgid ""
|
||||
"for field."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2177
|
||||
msgid "Default Text"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2177
|
||||
msgid "Text to display by default in this field"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2183
|
||||
msgid "Default Date"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2183
|
||||
#: includes/admin/core/class-admin-metabox.php:2189
|
||||
msgid ""
|
||||
"You may use all PHP compatible date formats such as: 2020-02-02, 02/02/2020, "
|
||||
"yesterday, today, tomorrow, next monday, first day of next month, +3 day"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2189
|
||||
msgid "Default Time"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2195
|
||||
msgid "Default Rating"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2195
|
||||
msgid ""
|
||||
"If you wish the rating field to be prefilled with a number of stars, enter "
|
||||
"it here."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2189
|
||||
#: includes/admin/core/class-admin-metabox.php:2201
|
||||
msgid "Default Value"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2201
|
||||
msgid ""
|
||||
"This option allows you to pre-fill the field with a default value prior to "
|
||||
"the user entering a value in the field. Leave blank to have no default value"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2201
|
||||
#: includes/admin/core/class-admin-metabox.php:2213
|
||||
msgid ""
|
||||
"The field label is the text that appears above the field on your front-end "
|
||||
"form. Leave blank to not show a label above field."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2211
|
||||
#: includes/admin/core/class-admin-metabox.php:2223
|
||||
msgid ""
|
||||
"This is the text that appears within the field e.g please enter your email "
|
||||
"address. Leave blank to not show any placeholder text."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2221
|
||||
#: includes/admin/core/class-admin-metabox.php:2233
|
||||
msgid ""
|
||||
"Field privacy allows you to select who can view this field on the front-end. "
|
||||
"The site admin can view all fields regardless of the option set here."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2244
|
||||
#: includes/admin/core/class-admin-metabox.php:2256
|
||||
msgid "Select the member roles that can view this field on the front-end."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2270
|
||||
#: includes/admin/core/class-admin-metabox.php:2282
|
||||
msgid ""
|
||||
"This option allows you to set whether the field must be filled in before the "
|
||||
"form can be processed."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2284
|
||||
#: includes/admin/core/class-admin-metabox.php:2296
|
||||
msgid ""
|
||||
"This option allows you to set whether or not the user can edit the "
|
||||
"information in this field."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2297
|
||||
#: includes/admin/core/class-admin-metabox.php:2309
|
||||
msgid "Choose whether you want a 5-stars or 10-stars ratings based here."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2310
|
||||
#: includes/admin/core/class-admin-metabox.php:2322
|
||||
msgid "Add a callback source to retrieve choices."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2321
|
||||
#: includes/admin/core/class-admin-metabox.php:2333
|
||||
msgid "Parent Option"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2321
|
||||
#: includes/admin/core/class-admin-metabox.php:2333
|
||||
msgid "Dynamically populates the option based from selected parent option."
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-metabox.php:2323
|
||||
#: includes/admin/core/class-admin-metabox.php:2335
|
||||
msgid "No Selected"
|
||||
msgstr ""
|
||||
|
||||
@@ -2603,7 +2630,7 @@ msgid "UM Action"
|
||||
msgstr ""
|
||||
|
||||
#: includes/admin/core/class-admin-users.php:116
|
||||
#: includes/core/class-fields.php:2331
|
||||
#: includes/core/class-fields.php:2334
|
||||
msgid "Apply"
|
||||
msgstr ""
|
||||
|
||||
@@ -3587,7 +3614,7 @@ msgstr ""
|
||||
#: includes/admin/templates/modal/dynamic_new_group.php:15
|
||||
#: includes/admin/templates/modal/fonticons.php:11
|
||||
#: includes/admin/templates/role/publish.php:24
|
||||
#: includes/core/class-fields.php:2332 includes/core/class-fields.php:2429
|
||||
#: includes/core/class-fields.php:2335 includes/core/class-fields.php:2432
|
||||
#: includes/core/um-actions-profile.php:557
|
||||
#: includes/core/um-actions-profile.php:696
|
||||
#: includes/core/um-actions-profile.php:729
|
||||
@@ -6291,89 +6318,89 @@ msgstr ""
|
||||
msgid "Add translation to %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:1195 templates/message.php:5
|
||||
#: includes/core/class-fields.php:1196 templates/message.php:5
|
||||
#, php-format
|
||||
msgid "%s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:1214
|
||||
#: includes/core/class-fields.php:1215
|
||||
msgid "Custom Field"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:1511
|
||||
#: includes/core/class-fields.php:1512
|
||||
msgid "Please upload a valid image!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:1518 includes/core/class-fields.php:1539
|
||||
#: includes/core/class-fields.php:1519 includes/core/class-fields.php:1540
|
||||
msgid "Upload"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:1519
|
||||
#: includes/core/class-fields.php:1520
|
||||
msgid "Sorry this is not a valid image."
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:1520
|
||||
#: includes/core/class-fields.php:1521
|
||||
msgid "This image is too large!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:1521
|
||||
#: includes/core/class-fields.php:1522
|
||||
msgid "This image is too small!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:1522
|
||||
#: includes/core/class-fields.php:1523
|
||||
msgid "You can only upload one image"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:1990
|
||||
#: includes/core/class-fields.php:1991
|
||||
msgid "Current Password"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:2019
|
||||
#: includes/core/class-fields.php:2020
|
||||
msgid "New Password"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:2051
|
||||
#: includes/core/class-fields.php:2052
|
||||
#, php-format
|
||||
msgid "Confirm %s"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:2286
|
||||
#: includes/core/class-fields.php:2289
|
||||
msgid "Upload Photo"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:2307 includes/core/class-fields.php:2331
|
||||
#: includes/core/class-fields.php:2310 includes/core/class-fields.php:2334
|
||||
#: includes/core/um-actions-profile.php:727
|
||||
msgid "Change photo"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:2331 includes/core/class-fields.php:2428
|
||||
#: includes/core/class-fields.php:2334 includes/core/class-fields.php:2431
|
||||
msgid "Processing..."
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:2353
|
||||
#: includes/core/class-fields.php:2356
|
||||
msgid "Upload File"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:2395 includes/core/um-filters-fields.php:243
|
||||
#: includes/core/class-fields.php:2398 includes/core/um-filters-fields.php:243
|
||||
msgid "This file has been removed."
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:2398 includes/core/class-fields.php:2428
|
||||
#: includes/core/class-fields.php:2401 includes/core/class-fields.php:2431
|
||||
msgid "Change file"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:2428
|
||||
#: includes/core/class-fields.php:2431
|
||||
msgid "Save"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:3851
|
||||
#: includes/core/class-fields.php:3854
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Your profile is looking a little empty. Why not <a href=\"%s\">add</a> some "
|
||||
"information!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/core/class-fields.php:3853
|
||||
#: includes/core/class-fields.php:3856
|
||||
msgid "This user has not added any information to their profile yet."
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
||||
|
||||
* Enhancements:
|
||||
- Added automatically template saver when you upgrade your theme
|
||||
- Added default value for Date and Time user profile fields
|
||||
|
||||
* Bugfixes:
|
||||
- Added nocache headers to reset password form
|
||||
|
||||
Reference in New Issue
Block a user