Skip to content

Instantly share code, notes, and snippets.

Al yekenuk

Block or report user

Report or block yekenuk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yekenuk
yekenuk / gist:0e7a5fcd0e427ecfdb486be9bc1c09ea
Created Jul 10, 2019
Change Weight Tracker measurement titles
View gist:0e7a5fcd0e427ecfdb486be9bc1c09ea
/**
* Rename some of the measurement fields
*
* @param $supported_measurements
*
* @return mixed
*/
function yk_docfit_filter_measurements( $supported_measurements ) {
$supported_measurements[ 'navel' ][ 'title' ] = 'Bellybutton';
View conditional-statement-examples.txt
<!-- -------------------------------------------------- -->
<!-- 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
@yekenuk
yekenuk / gist:acbcb1d91f889c65963f7099db784299
Last active Mar 28, 2019
A snippet of code for replacing certain Weight Tracker words
View gist:acbcb1d91f889c65963f7099db784299
/**
* 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 ) {
View Example Gravity Form
{"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
@yekenuk
yekenuk / gist:6e5b5a3537a420de9557ffe045dddaa2
Created May 8, 2018
WLT Redirect with is_home() condition added
View gist:6e5b5a3537a420de9557ffe045dddaa2
// 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;
}
@yekenuk
yekenuk / Force to Wizard
Last active Sep 29, 2017
Force user to Wizard if they haven't completed height, dob, activity level, gender, current weight and target
View Force to Wizard
/*
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() {
View Using [wlt-if] for a wizard page
[wlt-if field="is-logged-in"]
[wlt-if-1 field="height, dob, activity_level, gender" operator="not-exists"]
<h2>Step 1 - tell us about you!</h2>
[wlt-user-settings allow-delete-data="false"]
[else-1]
[wlt-if-2 field="target" operator="not-exists"]
<h2>Step 2 - set yourself a target</h2>
Time to set yourself a target - this will give you something to aim for!
[wlt-form target="true"]
[else-2]
View Using [wlt-if] for a wizard page
[wlt-if field="is-logged-in"]
[wlt-if-1 field="height, dob, activity_level, gender"]
<h2>Step 1 - tell us about you!</h2>
[wlt-user-settings allow-delete-data="false"]
[else-1]
[wlt-if-2 field="target"]
<h2>Step 2 - set yourself a target</h2>
It's great you're here to track your weight! Why not set yourself a target? This gives you something to aim for or helps you maintain your current weight.
[wlt-user-settings allow-delete-data="false"]
[else-2]
@yekenuk
yekenuk / [wlt-if] - logged in BMR prompt
Created Sep 5, 2017
Show BMR prompt to someone that is logged in
View [wlt-if] - logged in BMR prompt
[wlt-if field="is-logged-in"]
You are logged in :)
[wlt-if-1 field="bmr" operator="not-exists"]
Please get your arse over to the settings page to enter the relevant data.
[/wlt-if-1]
[/wlt-if]
View Nesting [wlt-if]
/*
Below is an example (not the best one) but an example none the less!
*/
[wlt-if field="is-logged-in"]
Great you're logged in...
[wlt-if-1 field="height"]
... and you have added a height.
You can’t perform that action at this time.