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
@spivurno
spivurno / gw-modified-subtotals.php
Created May 2, 2014
Gravity Wiz // Gravity Forms // Subtotal Merge Tag // Support Modified Subtotals
View gw-modified-subtotals.php
<?php
/**
* On the front-end, GF Calculations will include other calculation fields in the calculation formula, even if that
* calculation field comes after the field being currently calculated. On the back-end, calculation fields in formulas
* for other calculation fields that preceed them, are not contributed towards that calculated total.
*
* This means if you are using the {subtotal} merge tag (http://gravitywiz.com/subtotal-merge-tag-for-calculations/) to
* show the Subtotal and then using the {subtotal} merge tag in a field after that subtotal field to add tax, you would
* need to modify the Subtotal field to subtract the tax field amount.
*
@spivurno
spivurno / gw-surve-get-selected-choice.php
Created Jun 30, 2014
Get the selected survey choice based on entry value.
View gw-surve-get-selected-choice.php
/**
* Get the selected survey choice based on entry value.
*/
function gw_survey_get_selected_choice( $entry, $field_id ) {
$form = GFAPI::get_form( $entry['form_id'] );
$key = rgar( $entry, $field_id );
foreach( $form['fields'] as $field ) {
@spivurno
spivurno / gw-gravity-forms-emoji-handler.php
Created Aug 6, 2014
Gravity Wiz // Gravity Forms // Remove or Validate Emojis ✮
View gw-gravity-forms-emoji-handler.php
<?php
/**
* Gravity Wiz // Gravity Forms // Remove or Validate Emojis ✮
*
* Automatically remove or provide a validation error when emojis are submitted via a Gravity Form field.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@spivurno
spivurno / gw-add-spaces-for-multi-select-merge-tag.php
Created Aug 19, 2014
Gravity Wiz // Gravity Forms // Add Spaces for Multi Select Merge Tag
View gw-add-spaces-for-multi-select-merge-tag.php
<?php
add_filter( 'gform_merge_tag_filter', 'gw_add_spaces_for_multi_select_merge_tag', 10, 5 );
function gw_add_spaces_for_multi_select_merge_tag( $value, $merge_tag, $options, $field, $raw_value ) {
if( GFFormsModel::get_input_type( $field ) == 'multiselect' && $merge_tag == $field['id'] ) {
$value = implode( ', ', explode( ',', $value ) );
}
return $value;
@spivurno
spivurno / gp-limit-choices-gwlc_approved_payments_only.php
Created Sep 3, 2014
Gravity Wiz // Gravity Perks // GP Limit Choices // Only count approved payments towards limit
View gp-limit-choices-gwlc_approved_payments_only.php
<?php
# Apply to all forms
add_filter( 'gwlc_approved_payments_only', '__return_true' );
# Apply to specific form (i.e. form ID #1)
add_filter( 'gwlc_approved_payments_only_1', '__return_true' );
@spivurno
spivurno / gp-limit-choices-hide-form-if-choices-exhausted.php
Created Sep 16, 2014
Gravity Perks // GP Limit Choices // Hide Form if Choices Exhausted
View gp-limit-choices-hide-form-if-choices-exhausted.php
/**
* Gravity Perks // GP Limit Choices // Hide Form if Choices Exhausted
* http://gravitywiz.com/documentation/gp-limit-choices/
*
* Hide the form and display a message when the limit has been reached for a Limit-enabled field. This example will hide the form
* if *any* choice is exhausted so it is best used if there is only one field with limits enabled.
*/
add_filter( 'gform_pre_render', 'gw_disable_form_if_choices_exhausted', 12 );
function gw_disable_form_if_choices_exhausted( $form ) {
View keybase.md

Keybase proof

I hereby claim:

  • I am spivurno on github.
  • I am spivurno (https://keybase.io/spivurno) on keybase.
  • I have a public key whose fingerprint is 8079 11CF 8F94 E737 36C9 BA47 1D52 E881 0BCF 5400

To claim this, I am signing this object:

@spivurno
spivurno / gp-limit-choices-spots-left-admin-only.php
Created Oct 23, 2014
(Admin-only) Display how many spots are left in the choice label when using the GP Limit Choices perk
View gp-limit-choices-spots-left-admin-only.php
<?php
/**
* (Admin-only) Display how many spots are left in the choice label when using the GP Limit Choices perk
* http://gravitywiz.com/gravity-perks/
*/
add_filter( 'gplc_pre_render_choice', 'my_add_how_many_left_message', 10, 4 );
function my_add_how_many_left_message( $choice, $exceeded_limit, $field, $form ) {
if( ! current_user_can( 'administrator' ) ) {
@spivurno
spivurno / gp-terms-of-service-shortcode-support.php
Last active Aug 29, 2015
Gravity Perks // GP Terms of Service Field // Add Support for Using Shortcodes in Terms Field
View gp-terms-of-service-shortcode-support.php
/**
* Gravity Perks // GP Terms of Service Field // Add Support for Using Shortcodes in Terms Field
* http://gravitywiz.com/documentation/gp-terms-of-service/
*
* This plug-in-play snippet adds support for shortcodes in terms. It will automatically convert the ToS fields for the given
* form into the HTML-enabled version (default uses <textarea> which does not support HTML).
*
* One way this snippet can be used is in conjuction with the [Post Content Shortcodes](https://wordpress.org/plugins/post-content-shortcodes/)
* which provides a shortcode to retrive the content of a post. You can keep your terms in a single post and then use a
* shortcode (i.e. [post-content id="12"])to display those terms in all of your ToS fields.
@spivurno
spivurno / gp-unique-id-site-address-title-validation.php
Last active Aug 29, 2015
Gravity Perks // GP Unique ID // Unique ID as Site Address and Site Title
View gp-unique-id-site-address-title-validation.php
<?php
/**
* Gravity Perks // GP Unique ID // Unique ID as Site Address and Site Title
*
* The Unique ID field is populated on submission, after validation. This snippet runs post-validation to allow User Registration feeds with a Unique ID
* field mapped as the site address and/or site title to still pass validation.
*
*/
add_filter( 'gform_user_registration_validation', 'gp_unique_id_for_site_validation', 11, 2 );
function gp_unique_id_for_site_validation( $form, $feed ) {
You can’t perform that action at this time.