Skip to content

Instantly share code, notes, and snippets.

@phillipwilhelm
phillipwilhelm / gw-gravity-forms-prevent-form-update.php
Created September 5, 2016 04:21 — forked from spivurno/gw-gravity-forms-prevent-form-update.php
Gravity Wiz // Gravity Forms // Prevent Form from Being Updated
<?php
/**
* Gravity Wiz // Gravity Forms // Prevent Form from Being Updated
* http://gravitywiz.com
*/
add_action( 'check_admin_referer', function( $action, $result ) {
// update the "723" to your form ID
if( $action == 'gforms_update_form_723' ) {
die( 'Back up off my form, BRO!' );
}
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-require-unique-values.php
Created September 5, 2016 04:21 — forked from spivurno/gw-gravity-forms-require-unique-values.php
Gravity Wiz // Gravity Forms // Require Unique Values Between Fields
<?php
/**
* Gravity Wiz // Gravity Forms // Require Unique Values Between Fields
*
* Allows you to require two or more fields on the same form to be different from each other. For example, if you are
* collecting a personal phone number and an emergency contact phone number, this functionality can be used to ensure
* that the same number is not used for both fields.
*
* @version 1.1
* @author David Smith <[email protected]>
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-exclude-forms-form-list.php
Created September 5, 2016 04:22 — forked from spivurno/gw-gravity-forms-exclude-forms-form-list.php
Gravity Wiz // Gravity Forms // Exclude Forms from Form List
<?php
/**
* Gravity Wiz // Gravity Forms // Exclude Forms from Form List
* http://gravitywiz.com
*/
add_filter( 'query', function( $query ) {
if( rgget( 'page' ) != 'gf_edit_forms' ) {
return $query;
}
@phillipwilhelm
phillipwilhelm / gp-unique-id-fill-sequence-gaps.php
Created September 5, 2016 04:23 — forked from spivurno/gp-unique-id-fill-sequence-gaps.php
GP Unique ID // Gravity Perks // Fill Gaps in Sequential Unique IDs
<?php
/**
* GP Unique ID // Gravity Perks // Fill Gaps in Sequential Unique IDs
* http://gravitywiz.com/documentation/gp-unique-id/
*
* Use this snippet to automatically fill gaps in the sequence of unique IDs for Unique ID fields of the "Sequential"
* type. Gaps will occur when entries containing a sequential unique ID are deleted.
*
* Update the filter name "gpui_sequential_unique_id_pre_insert_519_5", replacing "519" with your form ID and "5" with
* your field ID.
@phillipwilhelm
phillipwilhelm / gp-unique-id-global-unique-id.php
Created September 5, 2016 04:24 — forked from spivurno/gp-unique-id-global-unique-id.php
Gravity Wiz // GP Unique ID // Share a global unique ID across all forms
<?php
/**
* Gravity Wiz // GP Unique ID // Share a global unique ID across all forms
*/
add_filter( 'gpui_unique_id_attributes', 'gwiz_global_unique_id', 10, 3 );
function gwiz_global_unique_id( $atts, $form_id, $field_id ) {
if( $atts['type'] != 'sequential' ) {
$atts['form_id'] = 1;
$atts['field_id'] = 1;
@phillipwilhelm
phillipwilhelm / gp-unique-id-input-type-text.php
Created September 5, 2016 04:24 — forked from spivurno/gp-unique-id-input-type-text.php
GP Unique ID // Gravity Perks // Change Input Type to Text
<?php
/**
* GP Unique ID // Gravity Perks // Change Input Type to Text
* http://gravitywiz.com/documentation/gp-unique-id/
*
* Updates the input HTML from "hidden" (default) to "text".
*/
add_filter( 'gpui_input_html_options', function ( $options ) {
if( rgget( 'view' ) == 'entry' && rgget( 'edit' ) ) {
$options['input_type'] = 'text';
@phillipwilhelm
phillipwilhelm / gp-unique-id-editable-inputs-gravity-view.php
Created September 5, 2016 04:24 — forked from spivurno/gp-unique-id-editable-inputs-gravity-view.php
GP Unique ID // Gravity Perks // Editable Input for Gravity View
<?php
/**
* GP Unique ID // Gravity Perks // Editable Input for Gravity View
* http://gravitywiz.com/documentation/gp-unique-id/
*
* Updates the input HTML from "hidden" (default) to "text" when viewing entry via Gravity View edit view.
*/
if( function_exists( 'gp_unique_id' ) ) {
add_filter( 'gpui_input_html_options', function ( $options ) {
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-populate-field-value-into-subsequent-field.php
Created September 5, 2016 04:25 — forked from spivurno/gw-gravity-forms-populate-field-value-into-subsequent-field.php
Gravity Wiz // Gravity Forms // Populate Field Value from One Page to Field in Subsequent Page
/**
* Gravity Wiz // Gravity Forms // Populate Field from One Page to Field in Subsequent Page
* http://gravitywiz.com/
*/
// update "1074" to the ID of your form
add_filter( 'gform_pre_render_1074', function( $form ) {
foreach( $form['fields'] as &$field ) {
// update "2" to the field ID on the later page
@phillipwilhelm
phillipwilhelm / cu-gf-value-assignment.php
Created September 5, 2016 04:25 — forked from spivurno/cu-gf-value-assignment.php
Craig Udit // Gravity Forms // Value Assignment
<?php
/**
* Craig Udit // Gravity Forms // Value Assignment
*
* Populate a value into a field by a list of conditions provided via CSV.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@phillipwilhelm
phillipwilhelm / gp-multi-page-navigation-disable-navigation-after-set-page.php
Created September 5, 2016 04:25 — forked from spivurno/gp-multi-page-navigation-disable-navigation-after-set-page.php
GP Multi-page Navigation // Gravity Perks // Disable Navigation After Set Page
<?php
/**
* GP Multi-page Navigation // Gravity Perks // Disable Navigation After Set Page
*/
// update the "673" to your form ID
add_filter( 'gform_pre_render_673', function( $form ) {
$submission = rgar( GFFormDisplay::$submission, $form['id'] );