Skip to content

Instantly share code, notes, and snippets.

View tareqhi's full-sized avatar
💭
“Experience is the name everyone gives to their mistakes.”

Md Akter Hosen tareqhi

💭
“Experience is the name everyone gives to their mistakes.”
View GitHub Profile
@alpha1
alpha1 / gf_add_comment_when_entry_value_is_changed.php
Last active May 6, 2017 10:56
Gravity Forms Add Comment for Edited Entry Values
/*
Gravity Forms 1.9.12.9 and above. Needs the 3rd arg on gform_after_update_entry
Compares values from the previous entry to the current (updated) entry, and adds a comment marking the user, time, field, and previous to current values that was changes - one comment per change.
*/
function gf_add_note($entry_id, $note){
RGFormsModel::add_note($entry_id, 0, __('gravity Forms'), $note);
}
add_action( 'gform_after_update_entry', 'magx_add_comment_for_changes_details', 10, 3 );
function magx_add_comment_for_changes_details($form, $entry_id, $original_entry){
$entry = GFAPI::get_entry( $entry_id );
@spivurno
spivurno / gw-gravity-forms-force-default-value.php
Last active October 20, 2021 10:42
Gravity Wiz // Gravity Forms // Force Default Value
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-force-default-value.php
*/
/**
* Gravity Wiz // Gravity Forms // Force Default Value
*
* Force the default value to be captured for fields hidden by conditional logic.
@spivurno
spivurno / gw-gravity-forms-file-generator.php
Created April 18, 2015 19:38
Gravity Wiz // Gravity Forms // File Generator
<?php
/**
* Gravity Wiz // Gravity Forms // File Generator
*
* Generate a file on submission which will be processed for merge tags.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@spivurno
spivurno / gw-gravity-forms-date-range-display.php
Last active April 30, 2020 04:48
Gravity Wiz // Gravity Forms // Date Range Display
<?php
/**
* Gravity Wiz // Gravity Forms // Date Range Display
*
* Display a group of color-coded date ranges on a calendar based on a GF selected date.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@spivurno
spivurno / gp-preview-submission-advanced-file-uploader.php
Created April 7, 2015 15:24
Gravity Perks // GP Preview Submission // Adds Support for Gravity Forms Advanced File Uploader
<?php
/**
* Gravity Perks // GP Preview Submission // Adds Support for Gravity Forms Advanced File Uploader
*
* By default, AFU does not provide any merge tags for displaying the files in Notifications and Confirmations. This
* snippet provides these merge tags and also makes them available prior to submission.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
@richardW8k
richardW8k / rw-gf-age-calculation.php
Last active April 24, 2019 06:14
calculate age from date field when age modifier specified on merge tag e.g. {Date of Birth:10:age}
<?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 / extend_conditional_logic.php
Last active August 29, 2015 14:08
adding support for multi-input fields like the address field.
/*
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 / RW_Button_Field.php
Last active January 15, 2020 08:44
Adds a Button field type allowing you to add extra buttons to the form, supported type are button, submit and reset.
<?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 / change_col_to_checkboxes.php
Created May 3, 2014 16:14
To convert a list field column to use checkboxes add the php excluding the first line to your theme functions.php file. The JavaScript can be placed between script tags in a HTML field on the form.
<?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>";