This file contains hidden or 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 | |
/** | |
* Gravity Perks // GP eCommerce Fields // Deduct Deposit from Order Summary | |
* http://gravitywiz.com/documentation/gravity-forms-ecommerce-fields/ | |
*/ | |
add_action( 'wp_loaded', function() { | |
if( ! function_exists( 'gp_ecommerce_fields' ) ) { | |
return; | |
} |
This file contains hidden or 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
/** | |
* Gravity Perks // Lock // Simple Locking System to Prevent Concurrent Actions | |
* http://gravitywiz.com./ | |
*/ | |
class GP_Lock { | |
private $id; | |
public function __construct( $id = false ) { |
This file contains hidden or 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
/** | |
* Gravity Perks // GP Limit Choices // Prevent Concurrent Submissions from Consuming the Last Choice | |
* http://gravitywiz.com/documentation/gravity-forms-limit-choices/ | |
*/ | |
add_action( 'gform_validation', 'gplc_lock', 99 ); | |
function gplc_lock ( $result ) { | |
$is_last_page = GFFormDisplay::get_target_page( $result['form'], GFFormDisplay::get_source_page( $result['form']['id'] ), rgpost( 'gform_field_values' ) ) == '0'; | |
$lock = new GP_Lock( 'gplc-lock' ); |
This file contains hidden or 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
<script> | |
gform.addAction( 'gpcp_after_update_pricing', function( triggerFieldId, gpcp ) { | |
( function( $ ) { | |
$( 'label[data-gpcp-template], option[data-gpcp-template]' ).each( function() { | |
var $priceElem = $( this ).is( 'option' ) ? $( this ) : $( this ).siblings( 'input' ), | |
price = gformFormatMoney( $priceElem.val().split( '|' )[1] ), | |
template = $( this ).attr( 'data-gpcp-template' ); | |
$( this ).html( template.replace( '{price}', price ) ); | |
} ); | |
} )( jQuery ); |
This file contains hidden or 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 | |
/** | |
* WARNING! THIS SNIPPET MAY BE OUTDATED. | |
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library: | |
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-check-in.php | |
*/ | |
/** | |
* Gravity Wiz // Gravity Forms // Check-In | |
* | |
* "Check-in" for Gravity Forms products. |
This file contains hidden or 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 | |
/** | |
* Gravity Perks // GP Unique ID // Use Unique ID as User Registration Password | |
* http://gravitywiz.com/documentation/gravity-forms-unique-id/ | |
*/ | |
add_filter( 'gform_userregistration_feed_settings_fields', function( $fields, $form ) { | |
foreach( $fields['user_settings']['fields'] as &$field ) { | |
if( $field['name'] == 'password' ) { | |
$field['args']['input_types'][] = 'uid'; |
This file contains hidden or 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 | |
/** | |
* Gravity Wiz // Gravity Forms // Modify Date Format for Custom Field | |
* http://graivtywiz.com/ | |
*/ | |
add_filter( 'gform_post_data', function( $data ) { | |
// Update both instances of "my_date_custom_field" to your custom field name. | |
// Update 'Y-m-d' to your desired date format. | |
$data['post_custom_fields']['my_date_custom_field'] = date( 'Y-m-d', strtotime( $data['post_custom_fields']['my_date_custom_field'] ) ); | |
return $data; |
This file contains hidden or 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 | |
/** | |
* Gravity Wiz // Gravity Forms Coupons // Allow Zero Amount Coupons | |
* http://gravitywiz.com/ | |
*/ | |
add_filter( 'gform_gravityformscoupons_feed_settings_fields', function( $settings ) { | |
foreach( $settings as &$group ) { | |
foreach( $group['fields'] as &$field ) { | |
if( $field['name'] == 'couponAmountType' ) { |
This file contains hidden or 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
/** | |
* Gravity Wiz // Gravity Forms // Map GF Checkbox Field to ACF Checkbox Field | |
* http://graivtywiz.com/ | |
*/ | |
add_filter( 'gform_post_data', function( $data ) { | |
// Update "checkboxes" to your cusotm field name. | |
$data['post_custom_fields']['checkboxes'] = serialize( explode( ',', $data['post_custom_fields']['checkboxes'] ) ); | |
return $data; | |
} ); |
This file contains hidden or 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 | |
/** | |
* Gravity Perks // GP Conditional Logic Dates // Adjust User's Local Time to UTC | |
* http://gravitywiz.com/documentation/gravity-forms-conditional-logic-dates/ | |
*/ | |
// Update "123" to the ID of your form - or - remove to apply to all forms. | |
add_action( 'gform_pre_render_123', function( $form ) { | |
add_action( 'wp_footer', 'gpcld_enable_utc_timezone_script' ); | |
add_action( 'gform_preview_footer', 'gpcld_enable_utc_timezone_script' ); | |
function gpcld_enable_utc_timezone_script() { |