Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Gravity Perks // Populate Anything // LMT Extract First Letter
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* Extract the first letter of a string using a Live Merge Tag
*/
// Update "123" to your form ID; and "4" to the field ID you are copying from.
add_filter( 'gppa_live_merge_tag_value_123_4', function( $value ) {
return substr( $value, 0, 1 );
/**
* Gravity Perks // Nested Forms // Copy Parent Values To First Child Entry
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
* Copy parent values into the first child entry automatically. The `{Parent}` merge tag would typically be used
* for this but this would copy the values to all child entries, not just the first.
*/
gform.addAction( 'gpnf_init_nested_form', function( childFormId, gpnf ) {
// Update "123" to your the ID of your child form.
<?php
/**
* Gravity Perks // Nested Forms // Add `Required` label to Nested Form field
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
* Adds a `Required` label to a Nested Form field when a minimum child entry limit is set.
*/
// Replace `123` with your form ID and `4` with your Nested Form field ID
add_filter( 'gform_field_content_123_4', function ( $content, $field, $value, $lead_id, $form_id ) {
<?php
/**
* Gravity Perks // Notification Scheduler // Custom Repeat Schedule
* https://gravitywiz.com/documentation/gravity-forms-notification-scheduler/
*/
add_filter( 'gpns_schedule_timestamp', function ( $timestamp, $notification, $entry, $is_recurring, $current_time ) {
// Update "123" to the form ID.
$form_id = 123;
<?php
/**
* Gravity Perks // Address Autocomplete // Update GravityView Geocoder with coordinates
* https://gravitywiz.com/documentation/gravity-forms-address-autocomplete/
*/
// Replace 123 with your form ID
add_action( 'gform_after_submission_123', function ( $entry, $form ){
$address_field_id = 4; // Replace 4 with your address field ID
$lat_field_id = 6; // Replace 6 with your latitude field ID
<?php
/**
* Gravity Shop // GS Product Configurator // Don't Delay User Registration Feed
*
* Instructions:
* 1. Install per https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
*/
add_filter( 'gspc_delay_feed_processing', function( $delay, $form, $entry, $slug, $payment_feed ){
if( $slug === 'gravityformsuserregistration' ){
<?php
/**
* Gravity Perks // Populate Anything // Populate JetSloth with ACF Image Field
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* Instructions:
*
* 1. Go to the field settings for the Gravity Forms choice field you are populating.
* 3. Add "gppa-jetsloth-acf-image" to the "Custom CSS Class" setting (on the Appearance tab).
*
<?php
/**
* Gravity Perks // GF Better User Activation // Set Redirect URL by User Role
* http://gravitywiz.com/documentation/gravity-forms-better-user-activation/
*/
add_filter( 'gpbua_activation_redirect_url', function( $url, $activation ) {
// Enter the roles and redirect URLs
$redirects = array(
'subscriber' => 'https://google.com',
<?php
/**
* Gravity Perks // Populate Anything // Range Modifier for Live Merge Tags
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* Use the :range modifier with checkbox merge tags to get the range of checked options
* Works well with the :value modifier
*
* Will return `x - y` where the min and max are different, or `x` if they are the same
<?php
/**
* Gravity Perks // GP Google Sheets // Admin Columns Pro Inline Edit Compatability
*
* Allow the Google Sheet to be updated after the entry is edited by Admin Columns Pro Inline Edit
*
* Installation:
* 1. Install per https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
*/
add_action( 'acp/editing/saved', function ( AC\Column $column, $id ) {