diff --git a/README.md b/README.md index 471d682..f57a5a8 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Then Please go to Frontend Dashboard | Frontend Dashboard | Login (Tab) | Settin 4. Fill the input fields and submit to save -**List of shortcodes** +**List of Shortcodes** 1. [fed_login] to generate login, registration, and reset forms 2. [fed_login_only] to show only login page 3. [fed_register_only] to show only register page @@ -78,6 +78,11 @@ Then Please go to Frontend Dashboard | Frontend Dashboard | Login (Tab) | Settin ### Changelog +**v1.1.1 [17-August-2017]** +* Collapse/Expand the frontend dashboard menu +* Bug fixes +* Refactored for developers comfort + **v1.1 [11-August-2017]** * Added more filter and action hooks for developers * Minor: Bug fixed @@ -87,5 +92,7 @@ Then Please go to Frontend Dashboard | Frontend Dashboard | Login (Tab) | Settin - Public release ### Upgrade Notice -**v1.0 [04-August-2017]** -- Public release \ No newline at end of file +**v1.1.1 [17-August-2017]** +* Collapse/Expand the frontend dashboard menu +* Bug fixes +* Refactored for developers comfort \ No newline at end of file diff --git a/admin/function-admin.php b/admin/function-admin.php index dd98b8f..8d938c9 100644 --- a/admin/function-admin.php +++ b/admin/function-admin.php @@ -174,7 +174,7 @@ class="' . $values['class'] . '" placeholder="' . $values['placeholder'] . '" id case 'checkbox': $values['class'] = $values['class'] == 'form-control' ? '' : $values['class']; $input .= ''; + ' . $label . ''; break; @@ -193,7 +193,7 @@ class="' . $values['class'] . '" placeholder="' . $values['placeholder'] . '" id $max = isset( $attr['input_max'] ) ? $attr['input_max'] : 999999; $step = isset( $attr['input_step'] ) ? $attr['input_step'] : 'any'; - $input .= ' 0 ? fed_convert_comma_separated_key_value( $attr['input_value'] ) : array(); + $values['class'] = $values['class'] === 'form-control' ? '' : $values['class']; + $options = fed_get_select_option_value( $attr['input_value'] ); foreach ( $options as $key => $label ) { $input .= ''; @@ -327,20 +327,20 @@ function fed_get_empty_value_for_user_profile( $action ) { function fed_process_user_profile( $row, $action, $update = 'no' ) { $default = array( - 'label_name' => isset( $row['label_name'] ) ? esc_attr( $row['label_name'] ) : '', - 'input_order' => isset( $row['input_order'] ) ? esc_attr( $row['input_order'] ) : '', - 'is_required' => isset( $row['is_required'] ) ? esc_attr( $row['is_required'] ) : 'false', - 'placeholder' => isset( $row['placeholder'] ) ? esc_attr( $row['placeholder'] ) : '', - 'class_name' => isset( $row['class_name'] ) ? esc_attr( $row['class_name'] ) : '', - 'id_name' => isset( $row['id_name'] ) ? esc_attr( $row['id_name'] ) : '', - 'input_value' => isset( $row['input_value'] ) ? esc_attr( preg_replace( '/^\h*\v+/m', '', $row['input_value'] ) ) : '', - 'input_location' => isset( $row['location'] ) ? esc_attr( $row['location'] ) : '', - 'input_min' => isset( $row['input_min'] ) ? esc_attr( $row['input_min'] ) : '', - 'input_max' => isset( $row['input_max'] ) ? esc_attr( $row['input_max'] ) : '', - 'input_step' => isset( $row['input_step'] ) ? esc_attr( $row['input_step'] ) : '', - 'input_row' => isset( $row['input_row'] ) ? esc_attr( $row['input_row'] ) : '', - 'input_type' => isset( $row['input_type'] ) ? esc_attr( $row['input_type'] ) : '', - 'input_meta' => isset( $row['input_meta'] ) ? esc_attr( $row['input_meta'] ) : '', + 'label_name' => isset( $row['label_name'] ) ? sanitize_text_field( $row['label_name'] ) : '', + 'input_order' => isset( $row['input_order'] ) ? sanitize_text_field( $row['input_order'] ) : '', + 'is_required' => isset( $row['is_required'] ) ? sanitize_text_field( $row['is_required'] ) : 'false', + 'placeholder' => isset( $row['placeholder'] ) ? sanitize_text_field( $row['placeholder'] ) : '', + 'class_name' => isset( $row['class_name'] ) ? sanitize_text_field( $row['class_name'] ) : '', + 'id_name' => isset( $row['id_name'] ) ? sanitize_text_field( $row['id_name'] ) : '', + 'input_value' => isset( $row['input_value'] ) ? sanitize_text_field( $row['input_value'] ) : '', + 'input_location' => isset( $row['location'] ) ? sanitize_text_field( $row['location'] ) : '', + 'input_min' => isset( $row['input_min'] ) ? sanitize_text_field( $row['input_min'] ) : '', + 'input_max' => isset( $row['input_max'] ) ? sanitize_text_field( $row['input_max'] ) : '', + 'input_step' => isset( $row['input_step'] ) ? sanitize_text_field( $row['input_step'] ) : '', + 'input_row' => isset( $row['input_row'] ) ? sanitize_text_field( $row['input_row'] ) : '', + 'input_type' => isset( $row['input_type'] ) ? sanitize_text_field( $row['input_type'] ) : '', + 'input_meta' => isset( $row['input_meta'] ) ? sanitize_text_field( $row['input_meta'] ) : '', // 'extra' => isset( $row['extra'] ) ? esc_attr( $row['extra'] ) : '', @@ -422,7 +422,7 @@ function fed_process_menu( $row ) { * @return array */ function fed_convert_comma_separated_key_value( $text ) { - $n = ( explode( "\n", $text ) ); + $n = explode( '|', $text ); $s = array(); foreach ( $n as $m ) { $mm = explode( ',', $m ); diff --git a/admin/layout/add_edit_profile.php b/admin/layout/add_edit_profile.php index 6001761..39ce629 100644 --- a/admin/layout/add_edit_profile.php +++ b/admin/layout/add_edit_profile.php @@ -228,7 +228,7 @@ function fed_get_admin_up_display_permission( $row, $action, $type = '' ) { if ( $action === 'profile' ) { if ( $type === 'file' ) { $value = 'Disable'; - $others = 'disabled'; + $others = true; $notification = ''; } else { $value = $row['show_register']; diff --git a/admin/layout/input_fields/radio.php b/admin/layout/input_fields/radio.php index 1d2aca5..4de66c1 100644 --- a/admin/layout/input_fields/radio.php +++ b/admin/layout/input_fields/radio.php @@ -51,10 +51,7 @@ class="fed_admin_menu fed_ajax"
-

key,value

-

one,One

-

two,Two

-

five-category,Five Category

+

key,value|one,One|two,Two|five-category,Five Category

diff --git a/admin/layout/input_fields/select.php b/admin/layout/input_fields/select.php index adf3784..eae4089 100644 --- a/admin/layout/input_fields/select.php +++ b/admin/layout/input_fields/select.php @@ -49,10 +49,7 @@ class="fed_admin_menu fed_ajax"
-

key,value

-

one,One

-

two,Two

-

five-category,Five Category

+

key,value|one,One|two,Two|five-category,Five Category

diff --git a/admin/layout/input_fields/url.php b/admin/layout/input_fields/url.php index 38da9eb..dd8b1f4 100644 --- a/admin/layout/input_fields/url.php +++ b/admin/layout/input_fields/url.php @@ -40,7 +40,7 @@ class="fed_admin_menu fed_ajax" fed_get_admin_up_role_based($row, $action ); - fed_get_input_type_and_submit_btn( 'text', $action ); + fed_get_input_type_and_submit_btn( 'url', $action ); ?>
diff --git a/admin/menu/menu.php b/admin/menu/menu.php index 2f66a55..49d135e 100644 --- a/admin/menu/menu.php +++ b/admin/menu/menu.php @@ -34,8 +34,8 @@ function fed_menu() { add_submenu_page( 'fed_settings_menu', __( 'Add Profile / Post Fields', 'fed' ), __( 'Add Profile / Post Fields', 'fed' ), 'manage_options', 'fed_add_user_profile', 'fed_add_user_profile' ); - add_submenu_page( 'fed_settings_menu', __( 'Plugins', 'fed' ), __( 'Plugins', 'fed' ), - 'manage_options', 'fed_plugin_pages', 'fed_plugin_pages' ); +// add_submenu_page( 'fed_settings_menu', __( 'Plugins', 'fed' ), __( 'Plugins', 'fed' ), +// 'manage_options', 'fed_plugin_pages', 'fed_plugin_pages' ); add_submenu_page( 'fed_settings_menu', __( 'Status', 'fed' ), __( 'Status', 'fed' ), 'manage_options', 'fed_status', 'fed_status' ); diff --git a/common/function-common.php b/common/function-common.php index e8c707a..f90895f 100644 --- a/common/function-common.php +++ b/common/function-common.php @@ -154,7 +154,7 @@ function fed_input_box( $meta_key, $attr = array(), $type = 'text' ) { $values = array(); $values['placeholder'] = isset( $attr['placeholder'] ) && ! empty( $attr['placeholder'] ) ? esc_attr( $attr['placeholder'] ) : ''; - $values['label'] = isset( $attr['label'] ) && ! empty( $attr['label'] ) ? strip_tags( $attr['label'],'' ) : ''; + $values['label'] = isset( $attr['label'] ) && ! empty( $attr['label'] ) ? strip_tags( $attr['label'], '' ) : ''; $values['class_name'] = isset( $attr['class'] ) && ! empty( $attr['class'] ) ? esc_attr( $attr['class'] ) : ''; $values['user_value'] = isset( $attr['value'] ) && ! empty( $attr['value'] ) ? esc_attr( $attr['value'] ) : ''; @@ -167,7 +167,7 @@ function fed_input_box( $meta_key, $attr = array(), $type = 'text' ) { $values['readonly'] = isset( $attr['readonly'] ) && $attr['readonly'] === true ? true : ''; $values['user_value'] = isset( $attr['value'] ) && ! empty( $attr['value'] ) ? esc_attr( $attr['value'] ) : ''; $values['input_value'] = isset( $attr['options'] ) && ! empty( $attr['options'] ) ? $attr['options'] : ''; - $values['disabled'] = isset( $attr['disabled'] ) && ! empty( $attr['disabled'] ) ? esc_attr( $attr['disabled'] ) : ''; + $values['disabled'] = isset( $attr['disabled'] ) && $attr['disabled'] === true ? true : ''; $values['default_value'] = isset( $attr['default_value'] ) && ! empty( $attr['default_value'] ) ? esc_attr( $attr['default_value'] ) : 'yes'; $values['extra'] = isset( $attr['extra'] ) ? $attr['extra'] : ''; $values['extended'] = isset( $attr['extended'] ) && ! empty( $attr['extended'] ) ? esc_attr( $attr['extended'] ) : array(); diff --git a/frontend-dashboard-1.1.1.zip b/frontend-dashboard-1.1.1.zip new file mode 100644 index 0000000..116bf3d Binary files /dev/null and b/frontend-dashboard-1.1.1.zip differ diff --git a/frontend-dashboard.php b/frontend-dashboard.php index 6642503..b00729d 100644 --- a/frontend-dashboard.php +++ b/frontend-dashboard.php @@ -3,7 +3,7 @@ * Plugin Name: Frontend Dashboard * Plugin URI: https://buffercode.com/plugin/frontend-dashboard * Description: Front end dashboard provide high flexible way to customize the user dashboard on front end rather than WordPress wp-admin dashboard. - * Version: 1.1 + * Version: 1.1.1 * Author: vinoth06 * Author URI: http://buffercode.com/ * License: GPLv2 @@ -16,7 +16,7 @@ /** * Version Number */ -define( 'BC_FED_PLUGIN_VERSION', '1.1' ); +define( 'BC_FED_PLUGIN_VERSION', '1.1.1' ); define( 'BC_FED_PLUGIN_VERSION_TYPE', 'FREE' ); /** diff --git a/frontend/controller/posts.php b/frontend/controller/posts.php index e0fe838..9b2227c 100644 --- a/frontend/controller/posts.php +++ b/frontend/controller/posts.php @@ -403,9 +403,7 @@ function fed_process_dashboard_add_new_post( $post ) { } foreach ( $extras as $index => $extra ) { - if ( isset( $post[ $index ] ) ) { - $default['meta_input'][ $index ] = sanitize_text_field( $post[ $index ] ); - } + $default['meta_input'][ $index ] = isset( $post[ $index ] ) ? sanitize_text_field( $post[ $index ] ) : ''; } $success = wp_insert_post( $default ); diff --git a/frontend/controller/profile.php b/frontend/controller/profile.php index 0c003d7..fa8a444 100644 --- a/frontend/controller/profile.php +++ b/frontend/controller/profile.php @@ -34,10 +34,10 @@ function fed_process_dashboard_display_profile() { * @param string $first_element Check First Element */ function fed_display_dashboard_profile( $first_element ) { - //var_dump( $profiles ); $profiles = fed_process_dashboard_display_profile(); $user = get_userdata( get_current_user_id() ); $menus = fed_process_dashboard_display_menu(); + foreach ( $profiles as $index => $item ) { if ( $index == $first_element ) { $active = ''; @@ -49,7 +49,7 @@ function fed_display_dashboard_profile( $first_element ) {

- +

@@ -78,17 +78,17 @@ class="fed_user_profile_save" ?>
-
+
-
+
-
+
@@ -101,9 +101,6 @@ class="fed_user_profile_save" Save
- 'Text Box', * 'number' => 'Number Box', @@ -168,18 +168,34 @@ function fed_process_author_details( $user, $single_item ) { * 'file' => 'File', * 'color' => 'Color' */ - if ( $single_item['input_type'] == 'file' ) { - return wp_get_attachment_image( intval( $user->get( $single_item['input_meta'] ) ), 'thumbnail' ); + if ( $single_item['input_type'] === 'file' ) { + return wp_get_attachment_image( (int) $user->get( $single_item['input_meta'] ), 'thumbnail' ); } - if ( $single_item['input_type'] == 'url' ) { + if ( $single_item['input_type'] === 'url' ) { return make_clickable( $user->get( $single_item['input_meta'] ) ); } - if ( $single_item['input_type'] == 'color' ) { - return fed_input_box( $single_item['input_meta'], array( 'value' => $user->get( $single_item['input_meta'] ) ), 'color' ); + + if ( $single_item['input_type'] === 'color' ) { + return fed_input_box( $single_item['input_meta'], array( + 'value' => $user->get( $single_item['input_meta'] ), + 'readonly' => true + ), 'color' ); + } + + if ( $single_item['input_type'] === 'checkbox' ) { + return fed_input_box( $single_item['input_meta'], array( + 'value' => $user->get( $single_item['input_meta'] ), + 'disabled' => true, + ), 'checkbox' ); } - if ( $single_item['input_type'] == 'date' ) { + if ( $single_item['input_type'] === 'radio' ) { + $input_value = fed_convert_comma_separated_key_value( $single_item['input_value'] ); + return $input_value[ $user->get( $single_item['input_meta'] ) ]; + } + + if ( $single_item['input_type'] === 'date' ) { $user_date = $user->get( $single_item['input_meta'] ); $extended = is_string( $single_item['extended'] ) ? unserialize( $single_item['extended'] ) : $single_item['extended']; $format = $extended['enable_time'] == 'true' ? '%e %B %Y - %I:%M %p' : '%e %B %Y'; @@ -204,6 +220,8 @@ function fed_process_author_details( $user, $single_item ) { return ucfirst( strftime( $format, strtotime( $user_date ) ) ); } + + return $user->get( $single_item['input_meta'] ); } @@ -652,7 +670,7 @@ class="bc_fed fed-profile-area container"> if ( $single_item['input_meta'] === 'user_pass' || $single_item['input_meta'] === 'confirmation_password' ) { continue; } - if ( in_array( $single_item['input_meta'], fed_no_update_fields() ) ) { + if ( in_array( $single_item['input_meta'], fed_no_update_fields(), false ) ) { $single_item['readonly'] = 'readonly'; } if ( count( array_intersect( $user->roles, unserialize( $single_item['user_role'] ) ) ) <= 0 ) { @@ -670,7 +688,6 @@ class="bc_fed fed-profile-area container">
diff --git a/readme.txt b/readme.txt index e76295e..ee232c3 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: dashboard, frontend dashboard, custom login, custom register, custom role, Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7DHAEMST475BY Requires at least: 4.3 Tested up to: 4.8.1 -Stable tag: 1.1 +Stable tag: 1.1.1 License: GPL V3 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html @@ -118,9 +118,10 @@ Then Please go to Frontend Dashboard | Frontend Dashboard | Login (Tab) | Settin 6. [fed_user role=user_role] to generate the role based user page == Changelog == -= v1.2 [17-August-2017]= += v1.1.1 [17-August-2017]= * Collapse/Expand the frontend dashboard menu - +* Bug fixes +* Refactored for developers comfort = v1.1 [11-August-2017] = * Added more filter and action hooks for developers @@ -130,9 +131,10 @@ Then Please go to Frontend Dashboard | Frontend Dashboard | Login (Tab) | Settin * Public release == Upgrade Notice == -= v1.1 [11-August-2017] = -* Added more filter and action hooks for developers -* Minor: Bug fixed += v1.1.1 [17-August-2017]= +* Collapse/Expand the frontend dashboard menu +* Bug fixes +* Refactored for developers comfort == Screenshots == 1. Frontend Dashboard Settings | Login | Settings