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 | |
// 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 = ""; |
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
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
<?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 | |
/** | |
* 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 |
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_Delete_Entry { | |
function __construct() { | |
if( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8.5.8', '>=' ) ) | |
return; | |
add_filter( 'gform_tooltips', array( $this, 'add_delete_tooltip') ); | |
add_filter( 'gform_form_settings', array( $this, 'add_delete_setting' ), 10, 2 ); | |
add_action( 'gform_pre_form_settings_save', array( $this, 'save_delete_setting' ), 10 ); | |
add_action( 'gform_after_submission', array( $this, 'maybe_delete_form_entry' ), 15, 2 ); |
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_checkbox_structure', 10, 5 ); | |
function rw_change_checkbox_structure($input, $field, $value, $lead_id, $form_id){ | |
$input_type = RGFormsModel::get_input_type($field); | |
if($input_type != "checkbox" || IS_ADMIN && RG_CURRENT_VIEW == "entry") | |
return $input; | |
$choices = ""; | |
if(is_array($field["choices"])){ | |
$choice_number = 1; |
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 | |
// format: gform_column_input_content_FORMID_FIELDID_COLUMN | |
add_filter( 'gform_column_input_content_524_2_2', 'change_column_to_checkbox', 10, 6 ); | |
function change_column_to_checkbox( $input, $input_info, $field, $text, $value, $form_id ) { | |
$input_field_name = "input_{$field['id']}[]"; | |
$tabindex = GFCommon::get_tabindex(); | |
$new_input = "<input type='checkbox' {$tabindex} /><input type='hidden' name='{$input_field_name}' value=' ' />"; | |
return $new_input; | |
} |
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 | |
// format: gform_column_input_content_FORMID_FIELDID_COLUMN | |
add_filter( 'gform_column_input_content_524_2_2', 'change_column_to_checkbox', 10, 6 ); | |
function change_column_to_checkbox( $input, $input_info, $field, $text, $value, $form_id ) { | |
$input_field_name = "input_{$field['id']}[]"; | |
$tabindex = GFCommon::get_tabindex(); | |
$new_input = "<div class='ginput_container'><ul class='gfield_checkbox'>" . | |
"<li><input type='checkbox' {$tabindex} value='First Choice' /><label>First Choice</label></li>" . | |
"<li><input type='checkbox' {$tabindex} value='Second Choice' /><label>Second Choice</label></li>" . | |
"</ul><input type='hidden' name='{$input_field_name}' value='' /></div>"; |