Skip to content

Instantly share code, notes, and snippets.

View coulterpeterson's full-sized avatar
🤓
Always learning

Coulter Peterson coulterpeterson

🤓
Always learning
View GitHub Profile
@coulterpeterson
coulterpeterson / gw-check-for-duplicate-values-between-a-set-of-fields.php
Created June 1, 2023 18:28
Gravity Forms | Check For Duplicate Values Between a Set of Fields
<?php
/**
* Gravity Wiz // Gravity Forms // Check For Duplicate Values Between a Set of Fields
* https://gravitywiz.com/
*
* Checks for duplicate values between a set of fields. Can be used to create a manual "rank these" setup
* using dropdown fields.
*
* Instructions:
* Update "123" to your form ID, "4" to the field ID of the last field that you want to check for duplicate values,
@coulterpeterson
coulterpeterson / snippet.js
Last active May 31, 2023 15:13
Allow Selecting Days From Another Month in Datepicker | Gravity Forms
/**
* Gravity Wiz // Gravity Forms // Allow Selecting Days From Another Month in Datepicker
* https://gravitywiz.com/
*
* Allow days from other months to be selectable in the calendar view.
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-custom-javascript/
@coulterpeterson
coulterpeterson / snippet.html
Last active June 15, 2023 14:05
Reload a Page One Time After 5 Seconds
<script>
window.onload = function() {
setTimeout(function(){
if(!window.location.hash) {
window.location = window.location + '#loaded';
window.location.reload();
} else {
document.querySelector('body').classList.add('reloaded');
}
}, 5000); // Time to wait in milliseconds. Change as needed
@coulterpeterson
coulterpeterson / snippet.php
Created May 17, 2023 18:42
WordPress Shortcode for Outputting Current User's Email Address
<?php
add_shortcode('user_email', function($atts) {
$the_atts = shortcode_atts([
"encode" => 'false'
], $atts);
if( is_user_logged_in() ) {
$current_user = wp_get_current_user();
if( $the_atts['encode'] == 'true' ) {
@coulterpeterson
coulterpeterson / snippet.js
Last active May 16, 2023 18:36
Provide {RowID} Merge Tag in Child Form | GP Nested Forms
/**
* Gravity Wiz // GP Nested Forms // Provide {RowID} Merge Tag in Child Form
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
* Replaces {RowID} merge tag in the child form with the Row ID while that form is displayed within nested forms.
* Parent element must have a "rowid-merge" CSS class added.
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
@coulterpeterson
coulterpeterson / gw-require-user-autofill-address-once.js
Created May 5, 2023 16:58
Require User to Autofill At Least Once | Gravity Wiz Address Autocomplete
/**
* Gravity Wiz // Gravity Forms Address Autocomplete // Require User to Autofill At Least Once
* https://gravitywiz.com/documentation/gravity-forms-address-autocomplete/
*
* Hides a required field you add to your form, and fills it with a value only if the user successfully autofills
* in the form at least once.
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
@coulterpeterson
coulterpeterson / snippet.html
Created May 4, 2023 18:54
Conditionally Hide A Gravity Forms Post Content Merge Tag Based On Its Value
<div id="timekeeping-solution">{Are you interested in a timekeeping solution that would allow employees to easily clock in and out online?:22}</div>
<script>
// When the page is ready
window.addEventListener('load', function () {
if (document.querySelector('body') !== null) { // Some element that should be rendered by now before we execute code
const timekeepingSolution = document.querySelector('#timekeeping-solution');
if( timekeepingSolution.innerHTML == "No" ) {
timekeepingSolution.style.display = "none";
@coulterpeterson
coulterpeterson / gw-update-user-password-after-submission.php
Last active May 25, 2023 16:54
Update User Password After Submission | Gravity Forms
<?php
/**
* Gravity Wiz // Gravity Forms // Update User Password After Submission
* https://gravitywiz.com/
*
* Updates the password for the user ID associated with the inputted email, allowing a custom password reset form.
*
*/
// Update "123" to your form ID, "4" to your "Password" field ID, and "5" to your "Confirm Password" field ID.
@coulterpeterson
coulterpeterson / snippet.js
Created December 20, 2022 14:44
Navigate Broken Tabs in Fusion Builder for #WordPress and #AvadaTheme
➡️ To go from the General Tab to the Design tab:
jQuery('.fusion-tabs #general').css('display','none'); jQuery('.fusion-tabs #design').css('display','block');
➡️ To go from the General Tab to the Animation Tab:
jQuery('.fusion-tabs #general').css('display','none'); jQuery('.fusion-tabs #animation').css('display','block');
➡️ To go from the General Tab to the Background Tab:
jQuery('.fusion-tabs #general').css('display','none'); jQuery('.fusion-tabs #background').css('display','block');
-----------------
@coulterpeterson
coulterpeterson / snippet.sql
Created September 28, 2022 16:29
Find invalid emails in MSSQL
SELECT *
FROM [Accounts]
WHERE EmailType IN ('HOME', 'EC_EMAIL', 'BUS') AND Active = 1 AND EmailAddress NOT LIKE '%_@__%.__%'