Skip to content

Instantly share code, notes, and snippets.

@phillipwilhelm
phillipwilhelm / gw-gravity-forms-tag-editor.php
Created September 5, 2016 04:26 — forked from spivurno/gw-gravity-forms-tag-editor.php
Gravity Wiz // Gravity Forms // Tag Editor
<?php
/**
* Gravity Wiz // Gravity Forms // Tag Editor
*
* Provides the ability to more easily modify the properties of specific tags in Gravity Forms markup. Currently supports the <form> tag.
*
* @version 1.0
* @author Gravity Wiz <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@phillipwilhelm
phillipwilhelm / gp-nested-forms-populate-nested-form-field.php
Created September 5, 2016 04:26 — forked from spivurno/gp-nested-forms-populate-nested-form-field.php
Gravity Perks // GP Nested Forms // Populate Nested Form Field
<?php
/**
* Gravity Perks // GP Nested Forms // Populate Nested Form Field
*/
add_action( 'gform_enqueue_scripts', function( $form ) {
if( $form['id'] == 508 ) {
foreach( $form['fields'] as $field ) {
if ( $field->id == 2 ) {
$_POST["input_{$field->id}"] = '7631,7629';
}
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-advanced-conditional-shortcodes.php
Created September 5, 2016 04:27 — forked from spivurno/gw-gravity-forms-advanced-conditional-shortcodes.php
Gravity Wiz // Gravity Forms // Advanced Conditional Shortcodes
<?php
/**
* Gravity Wiz // Gravity Forms // Advanced Conditional Shortcodes
*
* [gravityforms action="conditional" relation="any"
value="{:2}" operator="is" compare="First Choice"
value2="{:1}" operator2="isnot" compare2="Second Choice"]
Content you would like to conditionally display.
[/gravityforms]
*
@phillipwilhelm
phillipwilhelm / sk-gravity-forms-get-username-from-email.php
Created September 5, 2016 04:27 — forked from spivurno/sk-gravity-forms-get-username-from-email.php
Stephen Kam // Gravity Forms // Get Username from Email
<?php
/**
* Stephen Kam // Gravity Forms // Get Username from Email
*
* Capture username portion of an email address and store it into another field.
*
* @version 0.1
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@phillipwilhelm
phillipwilhelm / gp-unique-id-shared-sequences.php
Created September 5, 2016 04:28 — forked from spivurno/gp-unique-id-shared-sequences.php
Gravity Wiz // GP Unique ID // Shared Sequences
<?php
/**
* Gravity Wiz // GP Unique ID // Shared Sequences
* http://gravitywiz.com/
*
* Share sequences between sequential Unique ID fields; works with fields on
* different forms as well.
*/
add_filter( 'gpui_unique_id_attributes', 'gwiz_unique_id_global_sequential_index', 10, 3 );
function gwiz_unique_id_global_sequential_index( $atts, $form_id, $field_id ) {
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-advanced-conditional-logic.php
Created September 5, 2016 04:28 — forked from spivurno/gw-gravity-forms-advanced-conditional-logic.php
Gravity Wiz // Gravity Forms // Advanced Conditional Logic
<?php
/**
* Gravity Wiz // Gravity Forms // Advanced Conditional Logic
*
* Allows multiple groups of conditional logic per field.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-numbering-list-field-rows.css
Created September 5, 2016 04:30 — forked from spivurno/gw-gravity-forms-numbering-list-field-rows.css
Gravity Wiz // Gravity Forms // Numbering List Field Rows
/**
* Numbering List Field Rows
* http://demos.gravitywiz.com/numbering-gravity-forms-list-field-rows/
*/
body .gw-number-rows table.gfield_list {
counter-reset: gflistrowcounter;
margin-left: -24px;
}
.gw-number-rows .gfield_list thead tr:before {
content:'';
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-filter-entries-by-no-checkbox-checked.php
Created September 5, 2016 04:30 — forked from spivurno/gw-gravity-forms-filter-entries-by-no-checkbox-checked.php
Gravity Wiz // Gravity Forms // Allow filtering of entries where no checkbox is selected on the Entry List and Entry Export views.
/**
* Gravity Wiz // Gravity Forms // Allow filtering of entries where no checkbox is selected on the Entry List and Entry Export views.
*/
add_filter( 'gform_form_post_get_meta', function( $form ) {
$page = GFForms::get_page();
$is_export_action = rgpost( 'action' ) == 'rg_select_export_form';
if( $page != 'entry_list' && ! $is_export_action ) {
return $form;
@phillipwilhelm
phillipwilhelm / gp-word-count-change-labels.php
Created September 5, 2016 04:31 — forked from spivurno/gp-word-count-change-labels.php
Gravity Perks // GP Word Count // Change Word Count Labels
<?php
/**
* Gravity Perks // GP Word Count // Change Word Count Labels
*/
add_filter( 'gpwc_script_args', 'gpwc_modify_script_args' );
function gpwc_modify_script_args( $args ) {
$args['defaultLabel'] = '{count} / {limit}';
$args['counterLabel'] = '{count} / {limit}';
$args['limitReachedLabel'] = '<span style="font-weight:bold;">{count} / {limit}</span>';
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-get-entry-limit-percentage.php
Created September 5, 2016 04:31 — forked from spivurno/gw-gravity-forms-get-entry-limit-percentage.php
Gravity Wiz // Gravity Forms // Get the percentage reached for the entry limit
// # Function
function gwiz_get_entry_limit_percentage( $form_id ) {
$form = GFAPI::get_form( $form_id );
$entry_count = RGFormsModel::get_lead_count( $form['id'], '', null, null, null, null, 'active' );
$entry_limit = rgar( $form, 'limitEntriesCount' );
$percentage = ( $entry_count * 100 ) / $entry_limit;
return $percentage;