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( '