mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- small review;
This commit is contained in:
@@ -1,20 +1,15 @@
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
/* Remove deleted condition fields */
|
||||
jQuery(document).on('click', '', function(){
|
||||
|
||||
});
|
||||
|
||||
/* Remove field permanently */
|
||||
jQuery(document).on('click', '.um-admin-btns a span.remove', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
if (confirm('This will permanently delete this custom field from database')) {
|
||||
|
||||
|
||||
if ( confirm( 'This will permanently delete this custom field from database' ) ) {
|
||||
|
||||
jQuery(this).parents('a').remove();
|
||||
|
||||
|
||||
arg1 = jQuery(this).parents('a').data('arg1');
|
||||
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_admin_field_data.do_ajax_url,
|
||||
type: 'POST',
|
||||
@@ -26,13 +21,12 @@ jQuery(document).ready(function() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* Add a Field */
|
||||
jQuery(document).on('submit', 'form.um_add_field', function(e){
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
function delete_field_from_form( $id, $form_id ) {
|
||||
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
||||
|
||||
if (isset( $fields[$id] )) {
|
||||
if ( isset( $fields[ $id ] ) ) {
|
||||
$condition_fields = get_option( 'um_fields' );
|
||||
|
||||
foreach ( $condition_fields as $key => $value ) {
|
||||
@@ -193,27 +193,27 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$deleted_field_id = str_replace( 'conditional_field', '', $deleted_field );
|
||||
|
||||
if ( $deleted_field_id == '' ) {
|
||||
$arr_id = 0;
|
||||
$arr_id = 0;
|
||||
} else {
|
||||
$arr_id = $deleted_field_id;
|
||||
$arr_id = $deleted_field_id;
|
||||
}
|
||||
|
||||
unset( $condition_fields[$key]['conditional_action' . $deleted_field_id] );
|
||||
unset( $condition_fields[$key][$deleted_field] );
|
||||
unset( $condition_fields[$key]['conditional_operator' . $deleted_field_id] );
|
||||
unset( $condition_fields[$key]['conditional_value' . $deleted_field_id] );
|
||||
unset( $condition_fields[$key]['conditions'][$arr_id] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_action' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ][ $deleted_field ] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ]['conditions'][ $arr_id ] );
|
||||
|
||||
unset( $fields[$key]['conditional_action' . $deleted_field_id] );
|
||||
unset( $fields[$key][$deleted_field] );
|
||||
unset( $fields[$key]['conditional_operator' . $deleted_field_id] );
|
||||
unset( $fields[$key]['conditional_value' . $deleted_field_id] );
|
||||
unset( $fields[$key]['conditions'][$arr_id] );
|
||||
unset( $fields[ $key ][ 'conditional_action' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ][ $deleted_field ] );
|
||||
unset( $fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ]['conditions'][ $arr_id ] );
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'um_fields' , $condition_fields );
|
||||
unset( $fields[$id] );
|
||||
update_option( 'um_fields' , $condition_fields );
|
||||
unset( $fields[ $id ] );
|
||||
UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
|
||||
}
|
||||
}
|
||||
@@ -4040,23 +4040,23 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
switch ($act_id) {
|
||||
|
||||
case 'um_admin_duplicate_field':
|
||||
UM()->fields()->duplicate_field( $arg1, $arg2 );
|
||||
$this->duplicate_field( $arg1, $arg2 );
|
||||
break;
|
||||
|
||||
case 'um_admin_remove_field_global':
|
||||
UM()->fields()->delete_field_from_db( $arg1 );
|
||||
$this->delete_field_from_db( $arg1 );
|
||||
break;
|
||||
|
||||
case 'um_admin_remove_field':
|
||||
UM()->fields()->delete_field_from_form( $arg1, $arg2 );
|
||||
$this->delete_field_from_form( $arg1, $arg2 );
|
||||
break;
|
||||
|
||||
case 'um_admin_add_field_from_predefined':
|
||||
UM()->fields()->add_field_from_predefined( $arg1, $arg2, $position );
|
||||
$this->add_field_from_predefined( $arg1, $arg2, $position );
|
||||
break;
|
||||
|
||||
case 'um_admin_add_field_from_list':
|
||||
UM()->fields()->add_field_from_list( $arg1, $arg2, $position );
|
||||
$this->add_field_from_list( $arg1, $arg2, $position );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user