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 // 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 ); |
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 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; |
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 // 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 ); | |
} |
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 // 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; |
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 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; | |
} ); | |
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 // 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' ) ); |
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 // 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 ); |