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
@richardW8k
richardW8k / RW_Button_Field.php
Last active Sep 18, 2019
Adds a Button field type allowing you to add extra buttons to the form, supported type are button, submit and reset.
View RW_Button_Field.php
<?php
/**
* Plugin Name: Gravity Forms - Button Field
* Last Modified: 22/06/2014
*/
class RW_Button_Field {
function __construct() {
if( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8', '>=' ) )
@richardW8k
richardW8k / ListFieldMaskedInput
Created Nov 14, 2013
add an input mask to an input in a Gravity Forms list field column
View ListFieldMaskedInput
// enable input mask for form #95 list field #3 columns 1 and 3
add_filter('gform_register_init_scripts_95', 'enable_list_input_mask');
function enable_list_input_mask($form) {
$field_id = "3"; //set field id here
$col_id = array('1','3'); //set column id here
$mask = "9999"; //define mask here, examples at http://www.gravityhelp.com/documentation/page/Input_Mask
//that's it nothing more to configure
$c_sel = array();
foreach($col_id as $c) {
@richardW8k
richardW8k / gist:8d982aab66ace32a5e0d35ec7e2d6c1b
Last active Jul 30, 2019
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 / 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', '>=' ) ) {
View sum_list_column.php
<?php
add_filter( 'gform_calculation_formula', 'sum_list_column', 10, 4 );
function sum_list_column( $formula, $field, $form, $lead ) {
// {List:1.3} - {Label:ID.Column}
preg_match_all( '/{[^{]*?:(\d+?).(\d+?)}/mi', $formula, $matches, PREG_SET_ORDER );
if( is_array( $matches ) ) {
foreach( $matches as $match ) {
@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 / RWNotificationExtras.php
Last active Feb 2, 2018
Adds a new settings to Gravity Forms notifications allowing uploaded files to be attached to the notification and the notification format to be changed to text.
View RWNotificationExtras.php
<?php
/**
* Plugin Name: Gravity Forms - Notification Extras
* Author: Richard Wawrzyniak
* Description: Adds new settings to Gravity Forms Notifications enabling file uploads to be attached to notifications and the notification format to be changed to text.
* Version: 1.0
*
* Last Modified: 17/10/2014
* Updated attach_file() to allow for possibility that uploads folder was changed
* Added suppot for post_image fields
@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;
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 / radio_input_inside_label.php
Last active Mar 4, 2017
move a Gravity Forms radio input inside the label
View radio_input_inside_label.php
<?php
// move radio input inside label
add_filter("gform_field_choices", "radio_input_inside_label", 10, 2);
function radio_input_inside_label($choices, $field){
if($field["type"] != "radio")
return $choices;
$choices = "";
You can’t perform that action at this time.