Skip to content

Instantly share code, notes, and snippets.

David Smith spivurno

Block or report user

Report or block spivurno

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
View gp-populate-anything-merge-tags-in-templates.php
<?php
/**
* Gravity Perks // Populate Anything // Use Standard Merge Tags in Choice/Value Templates
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gppa_process_template', function( $template_value, $field, $template, $populate, $object, $object_type, $objects ) {
return GFCommon::replace_variables( $template_value, GFAPI::get_form( $object->form_id ), (array) $object );
}, 10, 7 );
View gp-nested-forms-clear-session-cookie-on-save-and-continue.php
View gp-populate-anything-set-post-taxonomy-terms.php
<?php
/**
* Gravity Perks // Populate Anything // Set Post Taxonomy Terms
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gform_after_create_post', function( $post_id, $entry, $form ) {
foreach( $form['fields'] as &$field ) {
if( is_callable( 'gp_populate_anything' ) && $field->{'gppa-choices-enabled'} && $field->{'gppa-choices-object-type'} == 'term' ) {
$value = gp_populate_anything()->get_field_value( $form, $entry, $field->id );
@spivurno
spivurno / gp-limit-submissions-apply-same-feed-to-group.php
Last active Apr 5, 2019
Gravity Perks // GP Limit Submissions // Apply Limit Feed to Group of Forms
View gp-limit-submissions-apply-same-feed-to-group.php
<?php
/**
* Gravity Perks // GP Limit Submissions // Apply Limit Feed to Group of Forms
* http://gravitywiz.com/documentation/gravity-forms-limit-submissions/
*/
add_filter( 'gpls_rule_groups', function( $rule_groups, $form_id ) {
// Update "123" to the ID of your form.
$primary_form_id = 123;
View gp-limit-choices-gf-real-time-validation.php
<?php
/**
* Gravity Perks // Limit Choices // Fix Conflict with GF Real Time Validation
* http://gravitywiz.com/documentation/gravity-forms-limit-choices/
*/
if( class_exists( 'Gravity_Forms_Live_Validation' ) ) {
$gf_live_validation = Gravity_Forms_Live_Validation::get_instance();
remove_filter( 'gform_pre_render', array( $gf_live_validation, 'lv_apply_validations_to_form' ) );
add_filter( 'gform_pre_render', array( $gf_live_validation, 'lv_apply_validations_to_form' ), 11 );
}
View gp-populate-anything-user-role.php
<?php
/**
* Gravity Perks // Populate Anything // Populate User Role
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gppa_process_template', function( $value, $field, $template, $populate, $object, $object_type, $objects ) {
if( $template == 'role' && is_a( $object, 'WP_User' ) ) {
$value = implode( ', ', $object->roles );
}
return $value;
View gp-copy-cat-copy-product-value.php
<script type="text/javascript">
gform.addFilter( 'gppc_copied_value', function( value, $elem, data ) {
// Update "1" to the ID of the field being copied to.
if( data.target == 1 && value ) {
value = value.split( '|' )[0];
}
return value;
} );
View gp-nested-forms-delay-child-notifications-for-parent-payment.php
<?php
/**
* Gravity Perks // Nested Forms // Delay Child Notifications for Parent Payment
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
add_filter( 'gpnf_should_send_notification', function( $should_send_notification, $notification, $context, $parent_form, $nested_form_field, $entry, $child_form ) {
if( $context == 'parent' ) {
$parent_entry = GFAPI::get_entry( rgar( $entry, 'gpnf_entry_parent' ) );
$should_send_notification = in_array( rgar( $parent_entry, 'payment_status' ), array( 'Paid', 'Active' ) );
View gp-populate-anything-post-meta-as-choices.php
<?php
/**
* Gravity Perks // Populate Anything // Populate Post Meta as Choices
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
// Update "123" with your form ID; Update "4" with your field ID.
add_filter( 'gppa_input_choices_123_4', function( $choices, $field, $objects ) {
$custom_field = str_replace( 'meta_', '', $field['gppa-choices-templates']['label'] );
$meta = get_post_meta( $objects[0]->ID, $custom_field );
View gp-multi-page-navigation.php
<?php
/**
* Gravity Perks // Multi-page Navigation // Bypass Validation on Next
* https://gravitywiz.com/documentation/gravity-forms-multi-page-navigation/
*
* Bypass validation when clicking the next button. Navigation Activation Type must be set to "from the start".
*/
add_filter( 'gform_form_tag', function( $tag ) {
$tag .= '<input type="hidden" name="gw_bypass_validation" value="1">';
return $tag;
You can’t perform that action at this time.