Skip to content

Instantly share code, notes, and snippets.

@spivurno
spivurno / gp-nested-forms-change-child-form-submit-button-text.php
Created December 31, 2018 19:56
Gravity Perks // GP Nested Forms // Change Submit Button Text for Child Form
<?php
/**
* Gravity Perks // GP Nested Forms // Change Submit Button Text for Child Form
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
add_filter( 'gform_pre_render_2', function( $form ) {
global $wp_current_filter;
if( ! is_callable( 'gp_nested_forms' ) ) {
return $form;
}
@spivurno
spivurno / gp-populate-anything-unique-choices.php
Created December 22, 2018 12:53
Gravity Perks // GF Populate Anything // Only Show Unique Choices
<?php
/**
* Gravity Perks // GF Populate Anything // Only Show Unique Choices
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gppa_input_choices', function( $choices ) {
global $gppa_uniques;
$gppa_uniques = array();
$choices = array_filter( $choices, function( $var ) {
global $gppa_uniques;
@spivurno
spivurno / gp-populate-anything-plus-gp-limit-choices.php
Last active January 5, 2022 07:43
Gravity Perks // GP Populate Anything + GP Limit Choices
<?php
class GW_Limit_Populated_Choices {
public function __construct( $args = array() ) {
// set our default arguments, parse against the provided arguments, and store for use throughout the class
$this->_args = wp_parse_args( $args, array(
'form_id' => false,
'field_id' => false,
@spivurno
spivurno / gp-limit-submissions-bypass-for-sticky-list.php
Last active December 17, 2018 14:22
Gravity Perks // GP Limit Submissions // Disable Limit Feeds when Editing via Sticky List
<?php
/**
* Gravity Perks // GP Limit Submissions // Disable Limit Feeds when Editing via Sticky List
* http://gravitywiz.com/documentation/gravity-forms-limit-submissions/
*/
add_filter( 'gpls_rule_groups', function( $rule_groups, $form_id ) {
if( rgpost( 'mode' ) == 'edit' ) {
$rule_groups = array();
}
@spivurno
spivurno / gppa-tiny-mailing-list.php
Last active May 3, 2019 07:59
Gravity Perks // GP Populate Anything // Tiny Mailing List
<?php
/**
* Gravity Perks // GP Populate Anything // Tiny Mailing List
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* Send an email all users who have submitted Form A when Form B is submitted. This *should not* be used
* to large numbers of notifications.
*
* # Instructions
*
@spivurno
spivurno / gp-post-content-merge-tags-gravity-pdf-form-a-to-form-b.php
Created December 12, 2018 01:39
Gravity Perks // GP Post Content Merge Tags // Use Merge Tags from Form A in HTML Field on Form B w/ Gravity PDF
<?php
/**
* Gravity Perks // GP Post Content Merge Tags // Use Merge Tags from Form A in HTML Field on Form B w/ Gravity PDF
* http://gravitywiz.com/documentation/gravity-forms-post-content-merge-tags/
*/
add_action( 'gfpdf_pre_pdf_generation', function( $form, $entry, $settings, $pdf ) {
// Update "123" to the ID of your Form B.
$target_form_id = 123;
// Update "3" to the field ID of your Source Pretty ID field.
@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/
*