diff --git a/admin/core/um-admin-actions.php b/admin/core/um-admin-actions.php index 6f5f44ce..5ab15e7a 100644 --- a/admin/core/um-admin-actions.php +++ b/admin/core/um-admin-actions.php @@ -70,11 +70,11 @@ } } - + function um_category_access_fields_create( $term ){ global $ultimatemember; - - echo '
'; + + echo '
'; echo ''; echo ' @@ -88,11 +88,14 @@ echo ''; } echo '

' . __('This is applicable only if you restrict the content to logged-in users.','ultimatemember') . '

'; + echo ''; + echo ''; + echo '

' . __('Users who cannot see content will get redirected to that URL.','ultimatemember') . '

'; echo '
'; echo '
'; echo ''; - echo ''; + echo ''; echo '

' . __('Users who cannot see content will get redirected to that URL.','ultimatemember') . '

'; echo '
'; @@ -100,14 +103,15 @@ function um_category_access_fields_edit( $term ){ global $ultimatemember; - + $termID = $term->term_id; $termMeta = get_option( "category_$termID" ); $_um_accessible= (isset( $termMeta['_um_accessible'] ) )? $termMeta['_um_accessible'] : ''; $_um_redirect= (isset( $termMeta['_um_redirect'] ) )? $termMeta['_um_redirect'] : ''; + $_um_redirect2= (isset( $termMeta['_um_redirect2'] ) )? $termMeta['_um_redirect2'] : ''; $_um_roles= (isset( $termMeta['_um_roles'] ) )? $termMeta['_um_roles'] : ''; - echo ""; + echo ''; echo ""; echo '

@@ -126,13 +130,19 @@ } echo '  '; } + echo '

' . __('This is applicable only if you restrict the content to logged-in users.','ultimatemember') . '

'; + echo ""; + echo ""; + echo ""; + echo ''; + echo ''; echo '

' . __('Users who cannot see content will get redirected to that URL.','ultimatemember') . '

'; echo ""; echo ""; echo ""; echo ''; - echo ''; + echo ''; echo '

' . __('Users who cannot see content will get redirected to that URL.','ultimatemember') . '

'; echo ""; @@ -150,6 +160,7 @@ // get value and save it into the database - maybe you have to sanitize your values (urls, etc...) $termMeta['_um_accessible'] = isset( $_POST['_um_accessible'] ) ? $_POST['_um_accessible'] : ''; $termMeta['_um_redirect'] = isset( $_POST['_um_redirect'] ) ? $_POST['_um_redirect'] : ''; + $termMeta['_um_redirect2'] = isset( $_POST['_um_redirect2'] ) ? $_POST['_um_redirect2'] : ''; $termMeta['_um_roles'] = isset( $_POST['_um_roles'] ) ? $_POST['_um_roles'] : ''; update_option( "category_$termID", $termMeta ); diff --git a/admin/core/um-admin-dragdrop.php b/admin/core/um-admin-dragdrop.php index f38431ed..cb5f80d0 100644 --- a/admin/core/um-admin-dragdrop.php +++ b/admin/core/um-admin-dragdrop.php @@ -3,47 +3,50 @@ class UM_Admin_DragDrop { function __construct() { - + add_action('admin_footer', array(&$this, 'load_field_order'), 9); - + add_action('wp_ajax_nopriv_update_order', array(&$this, 'update_order') ); add_action('wp_ajax_update_order', array(&$this, 'update_order') ); - + } - + /*** *** @update order of fields ***/ function update_order(){ - + global $ultimatemember; - + if ( !is_user_logged_in() || !current_user_can('manage_options') ) die('Please login as administrator'); - + extract($_POST); - + $fields = $ultimatemember->query->get_attr('custom_fields', $form_id ); - - $this->row_data = get_option('um_form_rowdata_'. $form_id ); - - if( isset( $fields ) ){ - foreach( $fields as $key => $array ) { + + $this->row_data = get_option('um_form_rowdata_'. $form_id, array() ); + $this->exist_rows = array(); + + if ( ! empty( $fields ) ) { + foreach ( $fields as $key => $array ) { if ( $array['type'] == 'row' ) { $this->row_data[$key] = $array; unset( $fields[$key] ); } } - } - - foreach( $_POST as $key => $value ) { - + } else { + $fields = array(); + } + + foreach ( $_POST as $key => $value ) { + // adding rows - if (0 === strpos($key, '_um_row_')) { - + if ( 0 === strpos( $key, '_um_row_' ) ) { + $update_args = null; - + $row_id = str_replace( '_um_row_', '', $key ); - + $row_array = array( 'type' => 'row', 'id' => $value, @@ -51,9 +54,9 @@ class UM_Admin_DragDrop { 'cols' => $_POST[ '_um_rowcols_'.$row_id .'_cols' ], 'origin' => $_POST[ '_um_roworigin_'.$row_id . '_val' ], ); - + $row_args = $row_array; - + if ( isset( $this->row_data[ $row_array['origin'] ] ) ) { foreach( $this->row_data[ $row_array['origin'] ] as $k => $v ){ if ( $k != 'position' && $k != 'metakey' ) { @@ -67,91 +70,91 @@ class UM_Admin_DragDrop { } $fields[$key] = $row_args; - + } - + // change field position - if (0 === strpos($key, 'um_position_') ) { + if ( 0 === strpos( $key, 'um_position_' ) ) { $field_key = str_replace('um_position_','',$key); if ( isset( $fields[$field_key] ) ) { $fields[$field_key]['position'] = $value; } } - + // change field master row - if (0 === strpos($key, 'um_row_') ) { + if ( 0 === strpos( $key, 'um_row_' ) ) { $field_key = str_replace('um_row_','',$key); if ( isset( $fields[$field_key] ) ) { $fields[$field_key]['in_row'] = $value; } } - + // change field sub row - if (0 === strpos($key, 'um_subrow_') ) { + if ( 0 === strpos( $key, 'um_subrow_' ) ) { $field_key = str_replace('um_subrow_','',$key); if ( isset( $fields[$field_key] ) ) { $fields[$field_key]['in_sub_row'] = $value; } } - + // change field column - if (0 === strpos($key, 'um_col_') ) { + if ( 0 === strpos( $key, 'um_col_' ) ) { $field_key = str_replace('um_col_','',$key); if ( isset( $fields[$field_key] ) ) { $fields[$field_key]['in_column'] = $value; } } - + // add field to group - if (0 === strpos($key, 'um_group_') ) { + if ( 0 === strpos( $key, 'um_group_' ) ) { $field_key = str_replace('um_group_','',$key); if ( isset( $fields[$field_key] ) ) { $fields[$field_key]['in_group'] = $value; } } - + } - - foreach( $this->row_data as $k => $v ) { - if ( !in_array( $k, $this->exist_rows ) ) + + foreach ( $this->row_data as $k => $v ) { + if ( ! in_array( $k, $this->exist_rows ) ) unset( $this->row_data[$k] ); } - - update_option('um_existing_rows_' . $form_id, $this->exist_rows ); - - update_option('um_form_rowdata_' . $form_id , $this->row_data ); + + update_option( 'um_existing_rows_' . $form_id, $this->exist_rows ); + + update_option( 'um_form_rowdata_' . $form_id , $this->row_data ); $ultimatemember->query->update_attr( 'custom_fields', $form_id, $fields ); - + } - + /*** *** @load form to maintain form order ***/ function load_field_order(){ - + global $ultimatemember; - + $screen = get_current_screen(); - + if ( !isset( $screen->id ) || $screen->id != 'um_form' ) return; ?> - +
- +