Skip to content

Instantly share code, notes, and snippets.

@spivurno
spivurno / gp-ecommerce-fields-set-tax-amount-dynamically.php
Last active November 22, 2021 20:32
Gravity Perks // GP eCommerce Fields // Set Tax Amount Dynamically
<?php
/**
* Gravity Perks // GP eCommerce Fields // Set Tax Amount Dynamically
* https://gravitywiz.com/documentation/gravity-forms-ecommerce-fields/
*/
add_filter( 'gform_pre_render_123', 'gpecf_dynamic_tax_amount' );
add_filter( 'gform_pre_validation_123', 'gpecf_dynamic_tax_amount' );
add_filter( 'gform_pre_submission_filter_123', 'gpecf_dynamic_tax_amount' );
add_filter( 'gform_admin_pre_render_123', 'gpecf_dynamic_tax_amount' );
function gpecf_dynamic_tax_amount( $form ) {
@spivurno
spivurno / gp-better-user-activation-set-redirect-url-by-entry-value.php
Created November 22, 2018 14:55
Gravity Perks // GF Better User Activation // Set Redirect URL by Entry Value
<?php
/**
* Gravity Perks // GF Better User Activation // Set Redirect URL by Entry Value
* http://gravitywiz.com/documentation/gravity-forms-better-user-activation/
*/
add_filter( 'gpbua_activation_redirect_url', function( $url, $activation ) {
/**
* @var $activation GPBUA_Activate
*/
@spivurno
spivurno / gp-media-library-ajax-upload.php
Last active November 1, 2021 20:00
Gravity Perks // GP Media Library // Ajax Upload
<?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/gp-media-library/gpml-ajax-upload.php
*/
/**
* Gravity Perks // GP Media Library // Ajax Upload
*
* Upload images to the Media Library as they are uploaded via the Gravity Forms Multi-file Upload field.
@spivurno
spivurno / gp-nested-forms-display-child-entries-table-format.php
Last active April 16, 2021 01:22
Gravity Perks // GP Nested Forms // Display Table Format for All Fields
<?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/gp-nested-forms/gpnf-display-child-entries-table-format.php
*/
/**
* Gravity Perks // GP Nested Forms // Display Table Format for All Fields
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
@spivurno
spivurno / gp-limit-submissions-dynamically-set-limit.php
Created September 26, 2018 11:24
Gravity Perks // GP Limit Submissions // Dynamically Set Limit
<?php
/**
* Gravity Perks // GP Limit Submissions // Dynamically Set Limit
* http://gravitywiz.com/gravity-forms-limit-submissions/
*/
add_filter( 'gpls_rule_groups', function( $rule_groups ) {
foreach( $rule_groups as &$rule_group ) {
if( $rule_group->name == 'Your Feed Name' ) {
$rule_group->limit = 100;
@spivurno
spivurno / gp-limit-submissions-poll-results.php
Last active November 26, 2020 19:58
Gravity Perks // GP Limit Submissions // Display Poll Results When Limit Is Reached
<?php
/**
* Gravity Perks // GP Limit Submissions // Display Poll Results When Limit Is Reached
* http://gravitywiz.com/documentaiton/gravity-forms-limit-submissions/
*/
add_action( 'gform_get_form_filter', function( $markup, $form ) {
if( ! is_callable( 'gf_polls' ) || ! gf_polls()->get_form_setting( $form, 'displayResults' ) ) {
return $markup;
}
@spivurno
spivurno / gw-styles-pro-force-validation-message.php
Created July 20, 2018 02:43
Gravity Wiz // Gravity Forms Styles Pro // Force Validation Message
<?php
/**
* Gravity Wiz // Gravity Forms Styles Pro // Force Validation Message
* http://gravitywiz.com
*/
if( class_exists( 'StylesPro' ) ) {
add_filter( 'gform_validation_message', function( $message, $form ) {
add_filter( "gform_validation_message_{$form['id']}", array( StylesPro::get_instance(), 'gf_stylespro_validation'), 11, 2 );
}, 10, 2 );
}
@spivurno
spivurno / gp-nested-forms-require-unique-values.php
Last active December 3, 2021 14:57
Gravity Perks // GP Nested Forms // Require Unique Value Between Parent & Child
<?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/gp-nested-forms/gpnf-require-unique-values.php
*/
/**
* Gravity Perks // GP Nested Forms // Require Unique Value Between Parent & Child
*
* Throw a validation error if a value is present a child entry that has been entered on the parent form.
@spivurno
spivurno / gw-gravity-forms-page-navigation-step-n-of-x.php
Last active April 23, 2018 16:46
Gravity Wiz // Gravity Forms // Display Navigation as "Step {currentPage} of {totalPages}"
<?php
/**
* Gravity Wiz // Gravity Forms // Display Navigation as "Step {currentPage} of {totalPages}"
* http://gravitywiz.com/
*/
add_filter( 'gform_progress_steps', function( $progress_steps, $form, $page ) {
$page = GFFormDisplay::get_current_page( $form['id'] );
$progress_steps = sprintf( 'Step %d of %d', $page, GFFormDisplay::get_max_page_number( $form ) );
@spivurno
spivurno / gp-limit-dates-block-date-range.php
Created April 12, 2018 12:40
Gravity Perks // GP Limit Dates // Block Date Range via Exceptions
<?php
/**
* Gravity Perks // GP Limit Dates // Block Date Range via Exceptions
*/
add_filter( 'gpld_limit_dates_options_1364_1', 'gpld_except_date_range', 10, 3 );
function gpld_except_date_range( $options, $form, $field ) {
$start_date = '2016-07-15';
$end_date = '2017-01-01';