Skip to content

Instantly share code, notes, and snippets.

<?php
add_filter('gpeb_filters_col_rows_query', 'custom_optimize_gf_entry_meta_query_with_cache', 10, 3);
function custom_optimize_gf_entry_meta_query_with_cache($sql, $col, $table) {
// Check if the current table and column are the ones we want to optimize
if ($table === GFFormsModel::get_entry_meta_table_name() && $col === 'meta_key') {
// Attempt to retrieve cached meta_key results
$cached_meta_keys = get_transient('gf_entry_meta_keys');
// If the cache exists, skip running the query
@spivurno
spivurno / gw-gravity-forms-emoji-handler.php
Created August 6, 2014 21:59
Gravity Wiz // Gravity Forms // Remove or Validate Emojis ✮
<?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-gravity-forms-skip-pages.php
Last active September 12, 2024 14:58
Gravity Wiz // Gravity Forms // Skip Pages on Multi-Page Form
<?php
/**
* Gravity Wiz // Gravity Forms // Skip Pages on Multi-Page Form
* http://gravitywiz.com/2012/05/04/pro-tip-skip-pages-on-multi-page-forms/
*/
add_filter("gform_pre_render", "gform_skip_page");
function gform_skip_page($form) {
if(!rgpost("is_submit_{$form['id']}") && rgget('form_page') && is_user_logged_in())
GFFormDisplay::$submission[$form['id']]["page_number"] = rgget('form_page');
return $form;
@spivurno
spivurno / woo-gf-remove-fields.php
Last active July 3, 2024 10:39
Gravity Wiz // WooCommerce Gravity Forms Add-on: Add support for removing a field from the product description in the cart.
<?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/wc-gf-product-addons/wcgfpa-remove-fields.php
*/
/**
* WooCommerce Gravity Forms Add-on: Add support for removing a field from the product description in the cart.
*
*/
@spivurno
spivurno / gw-gravity-forms-advanced-conditional-logic.php
Last active June 5, 2024 15:38
Gravity Wiz // Gravity Forms // Advanced Conditional Logic
<?php
/**
* Gravity Wiz // Gravity Forms // Advanced Conditional Logic
*
* PLEASE NOTE: This snippet is a proof-of-concept. It is not supported and we have no plans to improve it.
*
* Allows multiple groups of conditional logic per field.
*
* @version 0.1
* @author David Smith <david@gravitywiz.com>
@spivurno
spivurno / gw-gravity-forms-checkbox-count.php
Last active April 20, 2024 21:21
Gravity Wiz // Gravity Forms // Checkbox Count
<?php
/**
* --------------------------------------------------------------------------
* IMPORTANT!
* This snippet has been superceded by the Choice Counter snippet.
* https://gist.github.com/spivurno/00af5ee7e21dd5d6903fbae6fecd85ce
* --------------------------------------------------------------------------
*
* Gravity Wiz // Gravity Forms // Checkbox Count
*
@spivurno
spivurno / gw-gravity-forms-change-field-id.js
Last active December 12, 2023 01:56
Gravity Wiz // Gravity Forms // Change Field ID via Browser Console
/**
* 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-change-field-id.js
*/
/**
* Gravity Wiz // Gravity Forms // Change Field ID via Browser Console
*
* Provides a simple function for changing the ID of a Gravity Forms field via the browser console from the Form Editor page.
*
@spivurno
spivurno / gw-gravity-forms-populate-form.php
Last active November 24, 2023 05:14
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 / gist:3708752
Created September 12, 2012 18:12
Gravity Wiz // Limit How Many Checkboxes Can Be Checked
<?php
/**
* Limit How Many Checkboxes Can Be Checked
* http://gravitywiz.com/2012/06/11/limiting-how-many-checkboxes-can-be-checked/
*/
class GFLimitCheckboxes {
public static $field_limits;
@spivurno
spivurno / gw-gravity-forms-submission-limit.php
Last active October 23, 2023 15:33 — forked from spivurno/gist:3710653
Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
<?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-submission-limit.php
*/
/**
* Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
*
* Limit the number of times a form can be submitted per a specific time period. You modify this limit to apply to