Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
**v1.1.1 [17-August-2017]**
* Collapse/Expand the frontend dashboard menu
* Bug fixes
* Refactored for developers comfort
40 changes: 20 additions & 20 deletions admin/function-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class="' . $values['class'] . '" placeholder="' . $values['placeholder'] . '" id
case 'checkbox':
$values['class'] = $values['class'] == 'form-control' ? '' : $values['class'];
$input .= '<label class="' . $values['class'] . '">
<input ' . $values['disabled'] . $values['extra'] . $values['required'] . ' name="' . $values['name'] . '" value="'.$values['default_value'].'" type="checkbox" id="' . $values['id'] . '" ' . checked( $values['value'], $values['default_value'], false ) . '>' . $label . '</label>';
<input ' . $values['disabled'] . $values['extra'] . $values['required'] . ' name="' . $values['name'] . '" value="' . $values['default_value'] . '" type="checkbox" id="' . $values['id'] . '" ' . checked( $values['value'], $values['default_value'], false ) . '>' . $label . '</label>';

break;

Expand All @@ -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 .= '<input ' . $values['disabled'] . $values['extra'] . $values['required'] . ' type="number" name="' . $values['name'] . '"
$input .= '<input ' . $values['disabled'] . $values['readonly'] . $values['extra'] . $values['required'] . ' type="number" name="' . $values['name'] . '"
value="' . esc_attr( $values['value'] ) . '" class="' . $values['class'] . '"
placeholder="' . $values['placeholder'] . '"
min="' . esc_attr( $min ) . '"
Expand All @@ -202,11 +202,11 @@ class="' . $values['class'] . '" placeholder="' . $values['placeholder'] . '" id
break;

case 'radio':
$values['class'] = $values['class'] == 'form-control' ? '' : $values['class'];
$options = strlen( $attr['input_value'] ) > 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 .= '<label class="' . $values['class'] . '" for="' . $key . '">
<input ' . $values['disabled'] . $values['extra'] . ' name="' . $values['name'] . '" value="' . $key . '"
<input ' . $values['disabled'] . $values['extra'] . $values['readonly'] . ' name="' . $values['name'] . '" value="' . $key . '"
type="radio"' . checked( $values['value'], $key, false ) . $values['required'] . '>
' . $label . '
</label>';
Expand Down Expand Up @@ -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'] ) : '',

Expand Down Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion admin/layout/add_edit_profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<i class="fa fa-info bg-info-font" data-toggle="popover" data-trigger="hover" title=" Status" data-content="Only registered user can upload the files."></i>';
} else {
$value = $row['show_register'];
Expand Down
5 changes: 1 addition & 4 deletions admin/layout/input_fields/radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ class="fed_admin_menu fed_ajax"
<div class="row fed_key_value_eg_container">
<div class="col-md-5">
<label for=""><?php _e( 'Examples:', 'fed' ) ?></label>
<p>key,value</p>
<p>one,One</p>
<p>two,Two</p>
<p>five-category,Five Category</p>
<p>key,value|one,One|two,Two|five-category,Five Category</p>
</div>
<div class="col-md-7">
<b><?php _e( 'This will be output as', 'fed' ) ?></b>
Expand Down
5 changes: 1 addition & 4 deletions admin/layout/input_fields/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ class="fed_admin_menu fed_ajax"
<div class="row fed_key_value_eg_container">
<div class="col-md-5">
<label for=""><?php _e( 'Examples:', 'fed' ) ?></label>
<p>key,value</p>
<p>one,One</p>
<p>two,Two</p>
<p>five-category,Five Category</p>
<p>key,value|one,One|two,Two|five-category,Five Category</p>
</div>
<div class="col-md-7">
<b><?php _e( 'This will be output as', 'fed' ) ?></b>
Expand Down
2 changes: 1 addition & 1 deletion admin/layout/input_fields/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
?>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions admin/menu/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down
4 changes: 2 additions & 2 deletions common/function-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],'<i><b>' ) : '';
$values['label'] = isset( $attr['label'] ) && ! empty( $attr['label'] ) ? strip_tags( $attr['label'], '<i><b>' ) : '';
$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'] ) : '';
Expand All @@ -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();
Expand Down
Binary file added frontend-dashboard-1.1.1.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions frontend-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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' );

/**
Expand Down
4 changes: 1 addition & 3 deletions frontend/controller/posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
13 changes: 5 additions & 8 deletions frontend/controller/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand All @@ -49,7 +49,7 @@ function fed_display_dashboard_profile( $first_element ) {
<div class="panel-heading">
<h3 class="panel-title">
<span class="<?php echo $menus[ $index ]['menu_image_id'] ?>"></span>
<?php echo ucwords( $menus[ $index ]['menu_slug'] ) ?>
<?php echo ucwords( $menus[ $index ]['menu'] ) ?>
</h3>
</div>
<div class="panel-body">
Expand Down Expand Up @@ -78,17 +78,17 @@ class="fed_user_profile_save"

?>
<div class="row fed_dashboard_item_field">
<div class="col-md-4">
<div class="col-md-3">
<div class="pull-right">
<?php echo esc_attr( $single_item['label_name']) ?>
</div>
</div>
<div class="col-md-5">
<div class="col-md-7">
<?php
echo fed_get_input_details( $single_item );
?>
</div>
<div class="col-md-3">
<div class="col-md-2">

</div>
</div>
Expand All @@ -101,9 +101,6 @@ class="fed_user_profile_save"
<i class="fa fa-floppy-o"></i> Save
</button>
</div>
<?php

?>

</form>
<?php } else {
Expand Down
35 changes: 26 additions & 9 deletions frontend/function-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function fed_process_user_profile_required_by_menu( $menu ) {
*
* @return string
*/
function fed_process_author_details( $user, $single_item ) {
function fed_process_author_details( $user, array $single_item ) {
/**
* 'text' => 'Text Box',
* 'number' => 'Number Box',
Expand All @@ -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';
Expand All @@ -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'] );
}

Expand Down Expand Up @@ -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 ) {
Expand All @@ -670,7 +688,6 @@ class="bc_fed fed-profile-area container">

</div>
<?php
//var_dump($single_item);
} ?>
</div>
</div>
Expand Down
14 changes: 8 additions & 6 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down