This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', '>=' ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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/... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'gform_field_input', 'rw_change_radio_structure', 10, 5 ); | |
function rw_change_radio_structure($input, $field, $value, $lead_id, $form_id){ | |
$input_type = RGFormsModel::get_input_type($field); | |
if($input_type != "radio" || IS_ADMIN && RG_CURRENT_VIEW == "entry") | |
return $input; | |
$choices = ""; | |
if(is_array($field["choices"])){ | |
$choice_id = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//checks to see if a string is a valid UK phone number | |
add_filter( 'gform_field_validation', 'validate_phone', 10, 4 ); | |
function validate_phone( $result, $value, $form, $field ) { | |
$pattern = "/^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$/"; | |
if ( $field->type == 'phone' && $this->phoneFormat != 'standard' && ! preg_match( $pattern, $value ) ) { | |
$result['is_valid'] = false; | |
$result['message'] = 'Please enter a valid phone number'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
gform.addFilter( 'gform_calculation_result', function(result, formulaField, formId, calcObj ){ | |
if ( formulaField.field_id == "4" ){ | |
jQuery(".ginput_shipping_price").html(gformFormatMoney(result)).prev('input').val(gformFormatMoney(result)); | |
gformCalculateTotalPrice( formId ); | |
} | |
return result; | |
}); | |
</script> |