Skip to content

Instantly share code, notes, and snippets.

@spivurno
spivurno / gp-notification-scheduler-cc-expiration.php
Created July 1, 2017 14:45
Gravity Perks // GP Notification Scheduler // Credit Card Expiration
<?php
/**
* Gravity Perks // GP Notification Scheduler // Credit Card Expiration
*
* Send notifications based on a credit card expiration date.
*
* @version 0.1
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/
@spivurno
spivurno / gw-gravity-forms-user-registration-update-by-email.php
Last active November 5, 2021 12:47
Gravity Wiz // Gravity Forms // User Registration // Update by Email
<?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/gravity-forms/gw-user-registration-update-by-email.php
*/
/**
* Gravity Wiz // Gravity Forms // User Registration // Update by Email
*
* Create User Registration feeds that will update the user by the submitted email address, allowing non-logged-in users
@spivurno
spivurno / gw-gravity-forms-display-prices-for-choice-based-product-fields.php
Last active May 19, 2023 21:48
Gravity Wiz // Gravity Forms // Display Price for Drop Down and Radio Button Product Fields
<?php
/**
* Gravity Wiz // Gravity Forms // Display Price for Drop Down and Radio Button Product Fields
* http://gravitywiz.com/
* Source: https://www.gravityhelp.com/documentation/article/gform_field_choice_markup_pre_render/#2-include-price-for-product-fields
*/
add_filter( 'gform_field_choice_markup_pre_render', function ( $choice_markup, $choice, $field, $value ) {
if ( $field->type == 'product' ) {
$new_string = sprintf( '>%s - %s<', $choice['text'], GFCommon::to_money( $choice['price'] ) );
@spivurno
spivurno / gw-gravity-forms-populate-form.php
Last active July 22, 2025 06:51
Gravity Wiz // Gravity Forms // Populate Form with Entry (Optionally Update Entry on Submission)
<?php
/**
* Gravity Wiz // Gravity Forms // Populate Form with Entry (Optionally Update Entry on Submission)
*
* Pass an entry ID and populate the form automatically. No form configuration required. Optionally update the entry on
* submission.
*
* @version 1.5
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
@spivurno
spivurno / gp-post-content-merge-tags-lastform.php
Created June 20, 2017 01:49
Gravity Perks // GP Post Content Merge Tags // Add Support for Lastform
<?php
/**
* Gravity Perks // GP Post Content Merge Tags // Add Support for Lastform
* http://gravityperks.com/
*/
add_filter( 'gform_post_process', function( $form ) {
global $lf_gform_processed;
if( ! rgpost( 'is_lastform' ) ) {
return $form;
@spivurno
spivurno / gw-gravity-forms-modify-date-field-format.php
Created June 10, 2017 00:52
Gravity Wiz // Gravity Forms // Modify Date Field Format in Entries
<?php
/**
* Gravity Wiz // Gravity Forms // Modify Date Field Format in Entries
* http://gravitywiz.com/
*/
// Replace "123" with your form ID and "7" with your Date field ID.
add_filter( 'gform_get_input_value_123_7', function( $value ) {
// See PHP date() documentation for more details on date formatting: http://php.net/manual/en/function.date.php
$date_format = 'l, m/d/Y'; // i.e. Tuesday, 01/13/1987.
return date( $date_format, strtotime( $value ) );
@spivurno
spivurno / gw-gravity-forms-format-date-merge-tags.php
Last active May 31, 2019 15:52
Gravity Wiz // Gravity Forms // Add Formatting Options for Date Merge Tags
<?php
/**
* Gravity Wiz // Gravity Forms // Add Formatting Options for Date Merge Tags
* http://gravitywiz.com/
*
* {Date:1:dmy} => 31/1/2017
* {Date:2:l} => Tuesday
*
* See PHP's date() function documentation for full details on formatting:
* http://php.net/manual/en/function.date.php
@spivurno
spivurno / gw-gravity-forms-redirect-if-email-exists.php
Created June 3, 2017 14:52
Gravity Wiz // Gravity Forms // Redirect if Email Exists
<?php
/**
* Gravity Wiz // Gravity Forms // Redirect if Email Exists
*
* Redirect to a specified URL if the the submitted email address matches an existing user.
*
* Note: Does not work with AJAX-enabled forms.
*
* @version 0.1
* @author David Smith <david@gravitywiz.com>
@spivurno
spivurno / gw-gravity-forms-to-wp-job-manager.php
Last active October 25, 2021 20:30
Gravity Wiz // Gravity Forms // Populate GF Data into WP Job Manager Custom 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/experimental/gw-gravity-forms-to-wp-job-manager.php
*/
/**
* Gravity Wiz // Gravity Forms // Populate GF Data into WP Job Manager Custom Fields
*
* Provides support for mapping a GF multiselect field to a WPJM multiselect field.
@spivurno
spivurno / gw-gravity-forms-get-uploaded-file-deets.php
Created May 19, 2017 15:39
Gravity Wiz // Gravity Forms // Get Uploaded Files Prior to Submission
<?php
/**
* Gravity Wiz // Gravity Forms // Get Uploaded Files Prior to Submission
*
* @param integer $form_id The form ID that contains that field for which you are fetching the uploaded file details.
* @param GF_Field $field The field object for which you are fetching the uploaded file details.
*
* @return array|bool
*/
function gw_get_uploaded_file_deets( $form_id, $field ) {