=== Plugin Name === Contributors: aliakro Tags: weight, loss, lose, helper, bmi, body, mass, index, graph, track, stones, kg, table, data, plot, target, history, pounds, responsive, chart, measurements, cm, centimeters, inches, hip, waist, bicep, thigh Requires at least: 4.1.0 Tested up to: 4.7.2 Stable tag: 4.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Donate Link: https://www.paypal.me/yeken Allow registered users of your website to track their weight and relevant body measurements. History can be displayed in both tables & charts. == Description == = Core Features = An easy to use plugin that allows registered users of your website to track their weight and relevant body measurements. Their history can be displayed in both tables, charts, widgets and various shortcodes. Simply place the tag [weight-loss-tracker] on a given page and the user is presented with a tabbed form to enter a date (UK or US), weight and notes for that entry. When the person saves their entry the data table and graph are refreshed. The plugin also allows users to specify their target weight which is drawn on the chart as a comparison. If data is entered for an existing date, then the previous entry is simply updated. The graph is shown when there are two or more entries. The following weight formats are supported: * Metric (Kg) * Imperial - Stones & Pounds * Imperial - Pounds only Also supports the following tags: [weightloss_weight_difference] - total weight lost by the logged in member [weightloss_weight_start] - start weight of the logged in member [weightloss_weight_most_recent] - end weight of the logged in member [weightloss_weight_difference_from_target] - difference from target [weightloss_target_weight] - user's target weight (if specified) Pro Shortcodes: [weight-loss-tracker-chart] - Displays a chart [weight-loss-tracker-form] - Displays a form [weight-loss-tracker-table] - Displays a data table [weight-loss-tracker-most-recent-bmi] - Displays the user's BMI for most recent weight [weight-loss-tracker-total-lost] - Total lost / gained by the entire community. [weight-loss-tracker-league-table] - Show a league table of weight loss users. [weight-loss-tracker-progress-bar] - Show a progress bar indicating progress towards target weight. [weight-loss-tracker-reminder]. This allows you to display reminder messages for users to add a target weight or weight / measurement entry for the day. [Weight Loss Tracker Website - Shortcode guide](https://weight.yeken.uk/shortcodes "Weight Loss Tracker Website - Shortcode guide") = Pro Version = Our Pro version has now been released! If you upgrade, you get the additional features: * **Measurements.** Support for recording measurements like Hip, Waist, Leg, Bicep, etc. Displayed on charts and tables. * **BMI.** Allows a user to specify their height. Once specified, their BMI is displayed next to each weight entry. There is also a shortcode to render the latest BMI. * **Email notifications.** Receive email notifications when a person updates their target or adds / edits a weight. * **Overall user stats.** Shortcodes that allow you to display the total lost / gained for the community and another to display a league table. * **Widgets.** Widgets that allow you to display the graph and quick weight entry form within any widget area. * **Chart and form Shortcodes.** That allow you to display the graph and quick weight entry form by placing a shortcode on any post or page. * **Progress Bar shortcode.** A shortcode that visually displays the logged in user\'s progress towards their target * **Reminder shortcode.** A shortcode that can be used to remind the user to enter their target or weight for today. * **Message shortcode** A shortcode that allows you to congratulate a user when they lose weight x number of times. It also provides the opposite allowing you to provide encouragement when someone gains weight. * **Text Shortcodes.** Additional shortcodes for earliest and most recent dates entered. * **Progress Bar shortcode / widget.** Display a user\'s progress towards their weight target. * **Reminder shortcode.** Display a reminder to enter their weight for the given day or enter a target. * **Admin: View / Delete user data**. Admin will be able to view and delete existing user data. * **User preferences**. If enabled, the user will be able to select which unit they wish to store their weight in Metric or Imperial. They will also be able to specify date format and clear all their weight data. * **Bar Charts**. Fancy something different to a line chart? The plugin will also support Bar Charts. * **Decimals**. Decimals will be allowed weight in Pounds only or Kg modes. * **Delete existing entry**. A logged in user will be able to delete or edit an existing weight entry. * **Better Tables.**. Data tables in front end and admin will support paging and sorting. * **Admin: Extra Settings**. Extra settings to customise the plugin will be added e.g. number of plot points on graph, rows per page, etc.', WE_LS_SLUG) = Languages support = The plugin is written in English (UK) but has support for other languages such as French, Spanish, Dutch, Italian, Norwegian, Portuguese-Brazil, etc. For a list of supported languages please visit: [Weight Loss Tracker Website - Supported Languages](https://weight.yeken.uk/weight-units-date-formats-languages/ "Weight Loss Tracker Website - Supported Languages") Need a translation? Please read the following guide: [Translating the Weight Loss Tracker plugin](https://weight.yeken.uk/translating-weight-loss-tracker-plugin/ "Translating the Weight Loss Tracker plugin") = Documentation = Need further help? Please visit the dedicated site: [Weight Loss Tracker Website](https://weight.yeken.uk "Weight Loss Tracker Website") = Donate = Paypal Donate: [www.paypal.me/yeken](https://www.paypal.me/yeken "www.paypal.me/yeken") == Installation == 1. Install "Weight Loss Tracker" via the "Plugins" page in WordPress Admin (or download zip and upload). 2. Setup the plugin in WordPress Admin panel by goto to Settings > Weight Loss Tracker 3. Create a page that users will visit. Within the page content add the shortcode [weightlosstracker]. 4. Voila == Frequently Asked Questions == = Do you have any guides / documentation? = Yes! Please visit our dedicated site [Weight Loss Tracker Website](https://weight.yeken.uk "Weight Loss Tracker Website") = Does it create any custom mySQL tables = Yes it creates three: - WP_WS_LS_DATA_TARGETS - Stores user target data - WP_WS_LS_DATA - Store weight and measurement information per user - WS_LS_DATA_USER_PREFERENCES - Stores user preferences = What date formats doe it support? = Currently it supports both UK (dd/mm/yyy) and US (mm/dd/yyyy) date formats. = What measurement formats doe it support? = Currently it supports both Centimetres (CM) and Inches. = How do I change the plugin settings? = In WordPress Admin goto Settings. = How do I switch it from Metric (Kg) to Imperial (Stones / Pounds)? = In WordPress Admin goto Settings > Weight Loss Tracker and change the setting "Weight Units" to the desired type. = How do I enable tabs? = Yes. In WordPress Admin goto Settings > Weight Loss Tracker and change the setting "Display data in tabs?" to Yes. = Can I change measurement units while the site is live? = Yes. Only recommended if you first installed the plugin at version 1.6 or greater. Newer versions stores measurements in Kg and Pounds. Versions prior 1.6 didn't so you may find data isn't present for previous date entries. = How do I disable "Target weight" = Yes. In WordPress Admin goto Settings > Weight Loss Tracker and change the setting "Allow targets?" to No. == Screenshots == 1. All three tabs of the main [weight-loss-tracker] shortcode 2. Tab one of [weight-loss-tracker]: Chart, Target and Weight form. 3. Tab two of [weight-loss-tracker]: Target Weight and Weight History 4. Tab three of [weight-loss-tracker]: User preferences page 5. Examples of random placements of [weight-loss-tracker-chart] and [weight-loss-tracker-form] 6. Examples of the Chart and Form widgets 7. Settings page: General 8. Settings page: User Experience 9. Settings page: Chart 10. Settings page: Measurements 11. Admin - managing user data 12. Admin - Delete ALL data == Upgrade Notice == Lots of new features. Three new Pro shortcodes, email notifications and more. == Changelog == = 4.2 = * New feature: Message shortcode to motivate people when they gain weight x number of times or congratulate if they lose weight x number of times. - Read more: https://weight.yeken.uk/shortcodes/ * New feature: Reminder shortcode to display reminder messages for users to add a target weight or weight / measurement entry for the day. - Read more: https://weight.yeken.uk/shortcodes/ * New feature: Progress bar towards target [weight-loss-tracker-progress-bar] - Read more: https://weight.yeken.uk/shortcodes/ * New Feature: Added widget for progress bar shortcode above. - Read more: https://weight.yeken.uk/widgets/ * New feature: Email notifications for update of user's target or adding / editing a weight entry: https://weight.yeken.uk/email-notifications/ * New feature: New attribute "redirect-url" added for the shortcode [ws_ls_shortcode_form]. If specified and once the data has been saved, the user will be redirected to the given URL. Please note, the URL has to be one for the current site, otherwise the redirect will not happen (URL is passed through wp_safe_redirect()). Read more https://weight.yeken.uk/shortcodes/ * New feature / improvements: Additional hooks and filters added. Read more: * Improvement: Added the following to [weight-loss-tracker] shortcode: 'hide-first-target-form', 'hide-second-target-form' and 'show-add-button'. Read more: https://weight.yeken.uk/shortcodes/ * Improvement: Every license activation is instantly sent to YeKen. * Improvement: Stats now sent weekly (instead of monthly) using a WP cron job. If "Send usage data to YeKen" is enabled, usage stats will be sent on weekly basis to YeKen by a scheduled WP cron job (instead of relying on an expired cached value to trigger the send). * Improvement: Upgraded Chart.js to 2.5.0. * Improvement: Changed "Upgrade to Pro" and documentation links to point to new website https://weight.yeken.uk * Improvement: Changed comms and license activations to be sent to https://weight.yeken.uk (instead of yeken.uk) * Improvement: Slight tweaks to advanced data table layouts. * Bug fix: Setting "min-chart-points" attribute to 0 will now display the chart if no weight data has been entered. * Bug fix: Issue generating stats for a user when a target weight is entered but no user weights exist (division by zero). * Bug fix: Stats are instantly tidied up / re-generated if all user data is delete or an individual user deletes their data. * Bug fix: If no target weight has been set, the shortcode will now inform the user when the shortcode [ws_ls_weight_difference_target] is rendered. * Bug fix: Weight loss comparison figures shown properly when in stone / pounds. * Bug fix: When using [weight-loss-tracker-total-lost], Kg values are now rounded to two decimal places. = 4.1.10 = * Updated Portuguese translations. (thanks @Thomas) = 4.1.9 = * Updated Dutch translations (thanks @Robin) * Updated Italian translations (thanks @Salvo) * Bug fix: Deal with negative numbers in ws_ls_pounds_to_stone_pounds() and ws_ls_to_stone_pounds() - Thanks (@GatorDev) = 4.1.8 = * Updated German translations (thanks @Christian) = 4.1.7 = * Bug fix: Corrected nonce name. Issue on some installs to do with verfiying nonces used to secure AJAX calls for loading user data in Admin. = 4.1.6 = * Added fixes to sort issues with Ultimate Tables plugin when both including the Datatables JS library. = 4.1.5 = * Updated Danish translations (thanks @spaniole) = 4.1.4 = * Added % lost / gained to stats table. * Changed graph text when no weight data has been entered. * Added some additional Danish translations for date picker. = 4.1.3 = * Added some Norwegian (Norsk bokmål) translations (Thanks Rodrigo). * Date picker now translated into relevant locale - the majority driven from the WP Locale object. The words "Today" and "Done" can further be translated if provided. * Bug fix: Removed rogue double quote in Chart HTML (Thanks Rodrigo). * Bug fix: Only include ws_ls_config_advanced_datatables[] JS object when actually on the admin User Data page (Thanks Rodrigo). * Bug fix: Only include wp_config[] JS object once. If multiple widgets / shortcodes were placed it would embed the object more than once. = 4.1.2 = * Bug fix: When saving weight data / targets it was trying to generate stats when the user didn't have a Pro license. This caused 500 errors! * Bug fix: Stats settings should only be editable in Pro mode. * Updated "Go Pro" page Thanks @Terrence and @Steevie for your help! = 4.1.1 = Bug fix: Certain array declarations causing issues on non PHP7 sites. = 4.1 = * New shortcode: [weight-loss-tracker-total-lost] - Total lost / gained by the entire community. * New shortcode: [weight-loss-tracker-league-table] - Show a league table of weight loss users. * New cron job that runs every hour to refresh old user stats. * Upgraded DataTables.js library to 1.10.13. * Upgraded Chart.js library to 2.4.0. * Bug fix: If weight data was empty the Chart widget would throw a PHP exception. Now fixed. * Bug fix: Forcing a SQL query to uppercase was causing issues with case sensitive MySQL table names. Thanks Rodrigo! = 4.0.3 = * Added Hungarian (Magyar) translations - about 80% translations supplied. Thanks Noam. = 4.0.2 = * Added some more Dutch translations (thanks Yvon and Bart). * Bug fix: Chart yAxes can now be translated * Bug fix: Measurement labels can now be translated on form. * Bug fix: Measurement columns can now be translated in data table. * Bug fix: Measurement columns can now be translated in admin when viewing user data. * Bug fix: Header and footer columns on user data page (admin) can now be translated = 4.0.1 = * Added "Shoulders" to measurement fields. * Changed order of measurement fields to be more inline with body order. = 4.0 = **Pro Changes:** * Support for measurements added - can now add and edit measurements for each entry! * Measurements for "Bicep - Left", "Bicep - Right", "Forearm - Left", "Forearm - Right", "Calf - Left", "Bust / Chest", "Buttocks", "Hips", "Navel", "Thigh - Left", "Thigh - Right" and "Waist". * Height can also be specified on the user preferences page. * If height is specified the BMI value for the given height / weight will be displayed. * New Shortcodes: [weight-loss-tracker-most-recent-bmi] - Displays the user's BMI for most recent weight given. The argument "display" determines what is rendered: 'index' - Actual BMI value. 'label' - BMI label for given value. 'both' - Label and BMI value in brackets **Other changes:** * Upgraded jQuery Datatables library to 1.10.12 * Upgraded Chart.js to version 2! (1.0.2 to 2.3.0) * Target Weight line is now dashed to make it stand out more. * New chart option added to start y Axes at 0 (instead of auto calculated). * Use of tabs defaults to "Yes" on settings page. **Bug fixes:** * User preferences are now cached correctly. * Fixed nounce check when fetching all user data. * Various minor bug fixes. = 3.6.1 = * Fudge fix to remove .git folder from plugin directory! = 3.6 = * Added the shortcode [weightloss_target_weight] to display the user's target weight (assuming they have specified one). = 3.5.1 = * BUG FIX: Additional logic around array_reverse when rendering a chart to ensure the object is an array and not empty. = 3.5 = * Added locale support for advanced data tables (Pro feature) * Updated Dutch translations for advanced data tables and others = 3.4.1 = * CSS is included by default as some installations had issues. JavaScript includes have been moved to footer. = 3.4 = * Modified the including of JavaScript / CSS dependencies. To reduce conflicts with other plugins, JavaScript and CSS files are only included when widgets and shortcodes are placed. = 3.3 = * Added some additional Romanian translations (although not complete for plugin). * BUG FIX: Finnish translation files were given the wrong code so not included as expected. = 3.2 = * Updated Finnish translations. = 3.1.1 = * Modified the main charts ([weight-loss-tracker-chart] and [weight-loss-tracker]) so they display the most recent date entries as opposed to the earliest. * BUG FIX: Fixed difference in date ordering of widget and main charts. Previously the Widget displayed dates in desc as opposed to asc. = 3.1 = **Pro Changes:** * Added new Shortcode for displaying a data table: [weight-loss-tracker-table] - By default it will display data for the current user logged in. Specifying the attribute "user-id" will allow you to display a table for the given user e.g. [weight-loss-tracker-table user-id="5"] * Admin can now specify a message to be displayed in the place of widgets when the user is not logged in. * BUG FIX: Charts and Form shortcodes now display a login message when the user isn't logged. Previously they would see the data weight data for admin account. **Core changes:** * Can now specify the minimum number of weight entries needed before chart is displayed e.g. [weight-loss-tracker min-chart-points=5] * Improved jQuery loading of tabs. Tabs are hidden until jQuery has rendered them correctly (this will stop the unstyled tabs appearing). * "Clear Target" button added to target forms. = 3.0.1 = - Extended MySQL table checker to ensure the data table for user preferences has been created. - Removed CSS import statements for Open Sans and Lato. = 3.0 = Wey hey! Our first Pro version, if you upgrade you get the following additional features: - Widgets. Widgets that allow you to display the graph and quick weight entry form within any widget area. - Chart and form Shortcodes. That allow you to display the graph and quick weight entry form by placing a shortcode on any post or page. - Text Shortcodes. Additional shortcodes for earliest and most recent dates entered. - Admin: View / Delete user data. Admin will be able to view and delete existing user data. - User preferences. If enabled, the user will be able to select which unit they wish to store their weight in Metric or Imperial. They will also be able to specify date format and clear all their weight data. - Bar Charts. Fancy something different to a line chart? The plugin will also support Bar Charts. - Decimals. Decimals will be allowed weight in Pounds only or Kg modes. - Delete existing entry. A logged in user will be able to delete or edit an existing weight entry. - Better Tables.. Data tables in front end and admin will support paging and sorting. - Admin: Extra Settings. Extra settings to customise the plugin will be added e.g. number of plot points on graph, rows per page, etc. Core changes: - Removed support for Avada theme - Changed jQuery to document ready instead of window ready (jQuery kicks in quicker) = 2.0.1 = BUG FIX: Target weight was appearing twice on non-tabbed mode. - Removed some reundant jQuery regarding old tab library. - Added an additional CSS rule to override some theme CSS causing issues. = 2.0 = This is a major release of the plugin and a complete rewrite of its core. As the plugin has grown unexpectedly the code base has became unmaintainable and each upgrade was a pain in the a$$. So, this version fixes that and provides a solid base for the future Pro version. Changes in this release: New features: * Better out the box styling and look - looks sharper and more presentable with no need for CSS knowledge. * Supports UK and US date formats * jQuery UI tabs replaced with cleaner, animated and responsive tabs. * Shortcode name added [weight-loss-tracker] (works in exactly the same way as [weightlosstracker]). * Admin menu has been expanded (ready for Pro version). * Improved form validation and added more visual cues to prompt the user to correct the form. Bug fixes: * Other shortcodes (like weightloss_weight_difference) return the weight unit but no value when not logged in. Fixed to return nothing at all. * Tab index order fixed on forms. Underlying changes: * Added caching to database queries - all queries are cached for upto 15 minutes. This will reduce the number of queries against the MySQL database and reduce overall load. It is estimated that DB queries will reduce by two thirds. * All JavaScript (e.g. Chart) has been removed from inline statements to external files. * All JavaScript and CSS files have been minified. * Redundant / development copies of JavaScript, PHP and CSS files have been removed. Folder structures have been simplified and tidied. * Increased chart height. Will be configurable in future releases. * Major refactoring of ALL code. * Various PHP performance tweaks to increase load time (e.g. replacing all double quotes for strings and replacing with single). * Added additional CSS class names to HTML elements allowing developers to target their CSS better. * Support added for multiple charts to be placed (the base to build shortcodes / widgets in the Pro version). = 1.20.1 = BUG FIX: Previous release broke the "Delete all data" button on admin page. Fixed. = 1.20 = * Changed input fields for weight to: type="number". * Settings page: Added logic to check the required MySQL tables are present. If not, an option to rebuild them is available. * Removed redundant upgrade script to add column to main data table. * BUG FIX: If DateInterval class is not present (i.e. older version of PHP) disable date range selection on weight history table * BUG FIX: Stopped non numeric values being entered for target weights. * BUG FIX: When in Stones & Pounds mode, maximum pounds that can be entered is limited to 14. = 1.19.2 = * BUG FIX: Rookie mistake! Left debug data in! = 1.19.1 = * BUG FIX: Pound Only value not being saved correctly. = 1.19 = * Ability to specify the line and fill colours used on the graph. (thanks for the suggestion @Hardware Guru) * Added Spanish translations - THANKS @idelfonsog2 * BUG FIX: In some cases the MySQL Target table was not being created correctly. The activate logic has been modified to correct this. = 1.18 = * BUG FIX: Gave the language function a unique name as clashing with some other plugins. * IMPROVEMENT: Removed -50px off width of graph. = 1.17 = * Updated Romanian translations for admin page - THANKS @alexiarna * Removed some redundant PHP files. * BUG FIX: All text translated on admin page. One piece of text wasn't being translated. = 1.16 = * Added Danish translations - THANKS @kfasterholdt * Updated Romanian translations (front end) - THANKS @alexiarna = 1.15 = - Removed upgrade check. This was trying to recreate the MySQL table for target data and throwing errors on some installs. - Added versions numbers when enqueuing Js and CSS scripts. - Tidied up includes statements. = 1.14 = - Chart.new.js (library used for charts) has been reverted back to Chart.js. Unfortunately this means labels are lost on graphs. However, Chart.js is still maintained by the developers. - New option to display plot points on graph. If enabled, target and recorded weight will be displayed on hover. - Chart JavaScript tidied up. - BUG FIX: Removed references to jQuery Tabs when Tabs disabled. = 1.13 = - BUG FIX: Some third party plugins / installs insert additional input fields within