diff --git a/.DS_Store b/.DS_Store index 0f1337ce..31024259 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/docs/assets/images/component-user-id.png b/docs/assets/images/component-user-id.png new file mode 100644 index 00000000..d99b27c2 Binary files /dev/null and b/docs/assets/images/component-user-id.png differ diff --git a/docs/components.md b/docs/components.md index 03330f25..a98386b5 100644 --- a/docs/components.md +++ b/docs/components.md @@ -24,6 +24,10 @@ Below are the currently available summary boxes that you can use: [![](/assets/images/component-age-dob.png)](/assets/images/component-age-dob.png) +#### bmi + +[![](/assets/images/component-bmi.png)](/assets/images/component-bmi.png) + #### calories-gain [![](/assets/images/component-calories-gain.png)](/assets/images/component-calories-gain.png) @@ -122,11 +126,11 @@ Displays a count of all entries that has a weight entered). #### number-of-days-tracking [![](/assets/images/component-number-of-days-tracking.png)](/assets/images/component-number-of-days-tracking.png) + +#### user-id -#### bmi - -[![](/assets/images/component-bmi.png)](/assets/images/component-bmi.png) - +[![](/assets/images/component-user-id.png)](/assets/images/component-user-id.png) + #### weight-difference-since-previous [![](/assets/images/component-weight-difference-since-previous.png)](/assets/images/component-weight-difference-since-previous.png) diff --git a/includes/components.php b/includes/components.php index 3093ff13..5297f046 100644 --- a/includes/components.php +++ b/includes/components.php @@ -15,7 +15,7 @@ function ws_ls_uikit_summary_boxes( $arguments, $boxes = [] ) { $allowed_boxes = [ 'number-of-entries', 'number-of-weight-entries', 'latest-weight', 'start-weight', 'number-of-days-tracking', 'target-weight', 'previous-weight', 'latest-versus-target', 'bmi', 'bmr', 'latest-award', 'number-of-awards', 'name-and-email', 'start-bmr', 'start-bmi', 'age-dob', 'activity-level', 'height', 'aim', 'gender', 'group', - 'latest-versus-start', 'divider', 'weight-difference-since-previous', 'calories-maintain', 'calories-lose', 'calories-gain', 'calories-auto' ]; + 'latest-versus-start', 'divider', 'weight-difference-since-previous', 'calories-maintain', 'calories-lose', 'calories-gain', 'calories-auto', 'user-id' ]; // Default box selection if ( true === empty( $boxes ) ) { @@ -144,6 +144,9 @@ function ws_ls_uikit_summary_boxes( $arguments, $boxes = [] ) { case 'name-and-email': $html .= ws_ls_component_name_and_email( $arguments ); break; + case 'user-id': + $html .= ws_ls_component_user_id( $arguments ); + break; case 'age-dob': $html .= ws_ls_component_age_dob( [ 'user-id' => $arguments[ 'user-id' ] ] ); break; @@ -870,6 +873,27 @@ function ws_ls_component_name_and_email( $args = [] ) { ); } +/** + * User ID component + * @param array $args + * + * @return string + */ +function ws_ls_component_user_id( $args = [] ) { + + $args = wp_parse_args( $args, [ 'user-id' => get_current_user_id() ] ); + + return sprintf( '
+
+ %1$s
+ %2$d +
+
', + __( 'User ID', WE_LS_SLUG ), + $args[ 'user-id' ] + ); +} + /** * Render link with modal * diff --git a/pro-features/user-preferences.php b/pro-features/user-preferences.php index f5493bea..dbaebd2c 100755 --- a/pro-features/user-preferences.php +++ b/pro-features/user-preferences.php @@ -161,7 +161,7 @@ function ws_ls_user_preferences_form( $user_defined_arguments ) { // If enabled, show Delete data if( ( true === isset( $arguments[ 'allow-delete-data' ] ) && true === $arguments[ 'allow-delete-data' ] ) || - false === empty( $arguments[ 'show-delete-data' ] ) ) { + true === ws_ls_to_bool( $arguments[ 'show-delete-data' ] ) ) { if ( false === ws_ls_to_bool( $arguments[ 'hide-titles' ] ) ) { $html_output .= ws_ls_title( __( 'Delete existing data', WE_LS_SLUG ) ); diff --git a/readme.txt b/readme.txt index bd1f512c..5b439b1d 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: aliakro Tags: weight,tracker,chart,bmi,bmr,macronutrient,measure,awards,custom fields,history,measurements,data Requires at least: 5.7 -Tested up to: 6.0.2 -Stable tag: 10.3.2 +Tested up to: 6.1.1 +Stable tag: 10.3.3 Requires PHP: 7.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -152,6 +152,11 @@ Measurements are created using Custom Fields. You can therefore specify the unit == Changelog == += 10.3.3 = + +* Improvement: Added a new summary box component "user-id". Read more https://docs.yeken.uk/components.html +* Bug fix: [wt-user-settings] now correctly respects the "show-delete-data" argument correctly. + = 10.3.2 = * Improvement: Added Beta support for Barcode scanning in [wt-kiosk]. Read more: https://docs.yeken.uk/shortcodes/wt-kiosk.html diff --git a/weight-loss-tracker.php b/weight-loss-tracker.php index 05796133..8687cce2 100755 --- a/weight-loss-tracker.php +++ b/weight-loss-tracker.php @@ -5,9 +5,9 @@ /** * Plugin Name: Weight Tracker * Description: Allow your users to track their weight, body measurements, photos and other pieces of custom data. Display in charts, tables, shortcodes and widgets. Manage their data, issue awards, email notifications, etc! Provide advanced data on Body Mass Index (BMI), Basal Metabolic Rate (BMR), Calorie intake, Harris Benedict Formula, Macronutrients Calculator and more. - * Version: 10.3.2 + * Version: 10.3.3 * Requires at least: 5.7 - * Tested up to: 6.0.2 + * Tested up to: 6.1.1 * Requires PHP: 7.2 * Author: Ali Colville * Author URI: https://www.YeKen.uk @@ -18,7 +18,7 @@ */ define( 'WS_LS_ABSPATH', plugin_dir_path( __FILE__ ) ); -define( 'WE_LS_CURRENT_VERSION', '10.3.2' ); +define( 'WE_LS_CURRENT_VERSION', '10.3.3' ); define( 'WE_LS_TITLE', 'Weight Tracker' ); define( 'WE_LS_SLUG', 'weight-loss-tracker' ); define( 'WE_LS_LICENSE_TYPES_URL', 'https://docs.yeken.uk/features.html' );