Skip to content

Instantly share code, notes, and snippets.

Richard Wawrzyniak richardW8k

Block or report user

Report or block richardW8k

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
View gform_field_validation_emails.php
add_filter( 'gform_field_validation', function ( $result, $value, $form, $field ) {
if ( ! $result['is_valid'] && $field->get_input_type() === 'email' && GFCommon::is_valid_email_list( $value ) ) {
$result['is_valid'] = true;
$result['message'] = '';
}
return $result;
}, 10, 4 );
@richardW8k
richardW8k / gist:8d982aab66ace32a5e0d35ec7e2d6c1b
Last active Jul 21, 2017
Replace the Gravity Flow {workflow_cancel_link} merge tag when used in the step instructions.
View gist:8d982aab66ace32a5e0d35ec7e2d6c1b
add_filter( 'gform_pre_replace_merge_tags', function ( $text, $form, $entry ) {
if ( strpos( $text, '{workflow_cancel_link}' ) === false || empty( $entry ) || ! class_exists( 'Gravity_Flow_Merge_Tags' ) ) {
return $text;
}
$api = new Gravity_Flow_API( $form['id'] );
$step = $api->get_current_step( $entry );
if ( ! $step ) {
return $text;
@richardW8k
richardW8k / gw-gravity-forms-sum-nested-form-fields.php
Last active Mar 30, 2018 — forked from spivurno/gp-nested-forms-sum-nested-form-fields.php
Gravity Wiz // Gravity Perks // Get Sum of Nested Form Field Column
View gw-gravity-forms-sum-nested-form-fields.php
<?php
/**
* Gravity Wiz // Gravity Perks // Get Sum of Nested Form Fields
*
* Get the sum of a column from a Gravity Forms List field.
*
* @version 1.2
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@richardW8k
richardW8k / RW_GF_Rating_Field_Logic.php
Last active Apr 28, 2016
enable support for using the Survey add-on rating type field with conditional logic - Survey Add-On version 3.0 includes this functionality so this snippet is no longer required
View RW_GF_Rating_Field_Logic.php
class RW_GF_Rating_Field_Logic {
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
}
function init() {
if ( ! property_exists( 'GFForms', 'version' ) || ! version_compare( GFForms::$version, '1.9.10', '>=' ) ) {
return;
}
@richardW8k
richardW8k / gist:1b186b76bf45fc496ca6
Last active Aug 29, 2015
adds payment related notification events (drop down appears after notification name on the notification editor page). Requires 1.9.5.13 or greater.
View gist:1b186b76bf45fc496ca6
add_filter( 'gform_notification_events', function ( $notification_events, $form ) {
$has_stripe_feed = function_exists( 'gf_stripe' ) ? gf_stripe()->get_feeds( $form['id'] ) : false;
$has_paypal_feed = function_exists( 'gf_paypal' ) ? gf_paypal()->get_feeds( $form['id'] ) : false;
$has_paypalpaymentspro_feed = function_exists( 'gf_paypalpaymentspro' ) ? gf_paypalpaymentspro()->get_feeds( $form['id'] ) : false;
$has_authorizenet_feed = function_exists( 'gf_authorizenet' ) ? gf_authorizenet()->get_feeds( $form['id'] ) : false;
if ( $has_stripe_feed || $has_paypal_feed || $has_paypalpaymentspro_feed || $has_authorizenet_feed ) {
$payment_events = array(
'complete_payment' => __( 'Payment Completed', 'gravityforms' ),
'refund_payment' => __( 'Payment Refunded', 'gravityforms' ),
@richardW8k
richardW8k / rw-gf-age-calculation.php
Last active Apr 24, 2019
calculate age from date field when age modifier specified on merge tag e.g. {Date of Birth:10:age}
View rw-gf-age-calculation.php
<?php
class RW_GF_Age_Calculation {
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
}
function init() {
if ( ! class_exists( 'GFForms' ) || ! property_exists( 'GFForms', 'version' ) && version_compare( GFForms::$version, '1.9', '>=' ) ) {
@richardW8k
richardW8k / rw-gf-total-field-logic.php
Last active Nov 10, 2017
Enables use of the total field with conditional logic. [hide] this field if [total][less than][0.1] or [show] this field if [total][greater than][0]. Because the total field is always the last field to be saved you can't use it when configuring conditional logic on other fields. Displaying other fields based on the total would prevent those fiel…
View rw-gf-total-field-logic.php
<?php
class RW_GF_Total_Field_Logic {
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
}
function init() {
if ( ! property_exists( 'GFForms', 'version' ) || ! version_compare( GFForms::$version, '1.9', '>=' ) ) {
return;
@richardW8k
richardW8k / extend_conditional_logic.php
Last active Aug 29, 2015
adding support for multi-input fields like the address field.
View extend_conditional_logic.php
/*
Trigger conditional logic by adding an onclick or onchange event to your custom field input or by using something like the following
jQuery('#input_8_1 :input').on('change', function () {
gf_apply_rules(8, [2, 3, 4]);
});
*/
add_filter( 'gform_pre_render', 'extend_conditional_logic_frontend' );
function extend_conditional_logic_frontend( $form ) {
@richardW8k
richardW8k / GF_Field_Button.php
Last active Aug 29, 2015
Testing the GF_Field class in Gravity Forms 1.9
View GF_Field_Button.php
<?php
/**
* Plugin Name: Gravity Forms Button Field
* Last Modified: 18/08/2014
*/
if ( ! class_exists( 'GFForms' ) ) {
die();
}
@richardW8k
richardW8k / logging.php
Last active Aug 29, 2015
Logging statements for Gravity Forms.
View logging.php
<?php
add_filter( 'gform_pre_render', 'log_pre_render' );
function log_pre_render( $form ) {
GFCommon::log_debug( "log_pre_render(): \$form => " . print_r( $form, true ) );
return $form;
}
add_action( 'gform_pre_process', 'log_pre_process' );
function log_pre_process( $form ) {
You can’t perform that action at this time.