Skip to content

Instantly share code, notes, and snippets.

@spivurno
spivurno / gravity-forms-move-progress-bar-bottom.php
Last active October 23, 2023 15:32 — forked from n7studios/gravity-forms-move-progress-bar-bottom.php
Gravity Forms - Move Progress Bar to Bottom of Form
/**
* Plugin Name: Gravity Forms: Move Progress Bar to Bottom of Form
* Plugin URI: http://www.n7studios.co.uk
* Version: 1.0.1
* Author: n7 Studios
* Author URI: http://www.n7studios.co.uk
* Description: Moves the progress bar from the top to the bottom of the Gravity Form. The Start Paging section of the form MUST have a CSS class = progress-bar-bottom
*/
/**
@spivurno
spivurno / gist:6584835
Created September 16, 2013 18:51
Gravity Forms Cookies // Saves the query string parameters from a users visit to a cookie and allows these values to be populated via Gravity Forms' Dynamic
<?php
/**
Plugin Name: Gravity Forms Cookies
Plugin URI: http://ounceoftalent.com/
Description: Saves the query string parameters from a users visit to a cookie and allows these values to be populated via Gravity Forms' Dynamic Population feature.
Version: 1.5
Author: David Smith
Author URI: http://ounceoftalent.com
License: GPL2
*/
@spivurno
spivurno / how-i-work-template.md
Created June 14, 2023 13:46 — forked from jazzsequence/how-i-work-template.md
Template for How I Like to Work posts

How I work

This is my own interpretation of how I like to work, feedback welcome! Especially if my own view of how I think I like to work doesn't match your experience of how it seems I like to work!

When I work

@spivurno
spivurno / gw-gravity-forms-minimum-order-quantity-deux.php
Last active June 6, 2023 18:00
Gravity Wiz // Gravity Forms // Minimum Order Quantity
<?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-minimum-order-qty.php
*/
/**
* Gravity Wiz // Gravity Forms // Minimum Order Quantity
* http://gravitywiz.com/set-a-minimum-order-quantity/
*/
@spivurno
spivurno / sse.php
Created June 5, 2023 13:16 — forked from jordymeow/sse.php
SSE (Server-Sent Events) with PHP and JS / Streaming with PHP
<?php
// Various links
// https://serverfault.com/questions/488767/how-do-i-enable-php-s-flush-with-nginxphp-fpm
// https://stackoverflow.com/questions/72394213/nginx-configuration-for-server-sent-event
// https://serverfault.com/questions/801628/for-server-sent-events-sse-what-nginx-proxy-configuration-is-appropriate
// https://qiita.com/okumurakengo/items/cbe6b3717b95944083a1 (in Japanese)
// If '?SSE' is set, send Server-Sent events, otherwise we'll display the page.
if ( isset( $_GET['SSE'] ) ) {
@spivurno
spivurno / gw-gravity-forms-multiple-entries-list-field.php
Last active May 31, 2023 15:31
Gravity Wiz // Gravity Forms // Multiple Entries by List Field
<?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-multiple-entries-list-field.php
*/
/**
* Gravity Wiz // Gravity Forms // Multiple Entries by List Field
*
* Create multiple by entries based on the rows of a List field. All other field data will be duplicated for each entry.
@spivurno
spivurno / gw-gravity-forms-map-fields-to-field.php
Last active May 22, 2023 17:27
Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field
<?php
/**
* Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field
*
* Usage
*
* 1 - Enable "Allow field to be populated dynamically" option on field which should be populated.
* 2 - In the "Parameter Name" input, enter the merge tag (or merge tags) of the field whose value whould be populated into this field.
*
* Basic Fields
@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 / gp-easy-passthrough-save-token-to-field.php
Created January 23, 2020 14:47
Gravity Perks // Easy Passthrough // Save EP Token to Field
<?php
/**
* Gravity Perks // Easy Passthrough // Save EP Token to Field
* http://gravitywiz.com/documentation/gravity-forms-easy-passthrough/
*
* This snippet allows you to populate the EP token into a field so it can be mapped in Gravity Forms feeds. The filter
* fires before feeds are processed so the token is available in time.
*/
// Update "123" to your form ID.
add_filter( 'gform_entry_post_save_123', function( $entry, $form ) {
@spivurno
spivurno / gw-gravity-forms-check-in.php
Last active April 24, 2023 19:33
Gravity Wiz // Gravity Forms // Check-In
<?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-check-in.php
*/
/**
* Gravity Wiz // Gravity Forms // Check-In
*
* "Check-in" for Gravity Forms products.