This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set the user that you wish to load to one passed via qs, if not, default to logged in user id | |
$user_id = ( false === isset( $_GET[ 'user-id' ] ) ) ? (int) $_GET[ 'user-id' ] : get_current_user_id(); | |
// Worth checking that the user we're trying to view exists | |
if ( false === get_userdata( $user_id ) ) { | |
// display error saying user doesn't exist | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[wt-macronutrients-table] | |
<!-- Maintain --> | |
[wt-macronutrients progress="maintain" type="total" nutrient="protein"] | |
[wt-macronutrients progress="maintain" type="total" nutrient="carbs"] | |
[wt-macronutrients progress="maintain" type="total" nutrient="fats"] | |
[wt-macronutrients progress="maintain" type="breakfast" nutrient="protein"] | |
[wt-macronutrients progress="maintain" type="breakfast" nutrient="carbs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------------ | |
// Checking is logged in | |
// ------------------------------------------ | |
[wt-if field="is-logged-in"] | |
[wt-chart] | |
[else] | |
You must log in to see your chart. | |
[/wt-if] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Below is an example (not the best one) but an example none the less! | |
*/ | |
[wt-if field="is-logged-in"] | |
Great you're logged in... | |
[wt-if-1 field="height"] | |
... and you have added a height. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Rename some of the measurement fields | |
* | |
* @param $supported_measurements | |
* | |
* @return mixed | |
*/ | |
function yk_docfit_filter_measurements( $supported_measurements ) { | |
$supported_measurements[ 'navel' ][ 'title' ] = 'Bellybutton'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- -------------------------------------------------- --> | |
<!-- Firstname and Last name examples --> | |
<!-- -------------------------------------------------- --> | |
[cs-if conditions="firstname"] | |
First name exists | |
[/cs-if] | |
[cs-if conditions="firstname" operator="not-exists"] | |
First name does not exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filter default WordPress translate functions to look for key Weight Tracker words and replace. | |
* | |
* @param $translation | |
* @param $text | |
* @param $domain | |
* | |
* @return string | |
*/ | |
function wl_ls_cust_replace_words( $translation, $text, $domain ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"0":{"title":"Pounds Only","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":""},"fields":[{"type":"number","id":1,"label":"Your weight in pounds","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","inputs":null,"numberFormat":"decimal_dot","formId":3,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"wlt-pounds","inputName":"","visibility":"visible","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","enableCalculation":false,"rangeMin":"1","rangeMax":"400","productField":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"displayOnly":""},{"type":"date","id":2,"label":"Date of entry","adminLabel":"","isRequired":true,"size":"medium","err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If we're on the Wizard page or not on a page or not logged in, just exit. Otherwise we'll end up in a loop! | |
if ( false !== strpos($_SERVER['REQUEST_URI'], '/wizard/') || false === is_page() || false === is_user_logged_in() || true === is_home() ) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
If the user has not completed their BMR fields or target then automatically redirect them to your Wizard page. | |
1) Add this to your theme's functions.php file | |
2) Ensure your Wizard page has the slug "wizard" or modify line 14 to suit. | |
3) Change your redirect URL in line 21 | |
Disclaimer: Use this as at your own risk. It may require modification! | |
*/ | |
function yeken_force_to_wizard() { |
NewerOlder