Skip to content

Instantly share code, notes, and snippets.

View saifsultanc's full-sized avatar
🏠
Remote

Saif Sultan saifsultanc

🏠
Remote
View GitHub Profile
@saifsultanc
saifsultanc / gpmpn-dropdown-navigation.js
Created May 28, 2025 11:28
gp-multi-page-navigation/gpmpn-dropdown-navigation.js
/**
* Gravity Perks // Multi-page Navigation // Dropdown Navigation
* https://gravitywiz.com/documentation/gravity-forms-multi-page-navigation/
*
* Instruction Video: https://www.loom.com/share/38fcc941036842d6a81a599fd8de39d7
*
* This snippet is designed to be used with the Gravity Forms Code Chest plugin.
* https://gravitywiz.com/gravity-forms-code-chest/
*/
const pageNameTemplate = 'Step {pageNumber}: {pageName}';
@saifsultanc
saifsultanc / gpeb_queryer_entries-multi-field-sorting.php
Last active May 21, 2025 02:00
gpeb_queryer_entries-multi-field-sorting.php
<?php
add_filter( 'gpeb_queryer_entries', function( $entries, $gf_queryer ) {
// Update the form ID to match your form.
if ( $gf_queryer->form_id != 933 ) {
return $entries;
}
// Update the field IDs to match your form.
@saifsultanc
saifsultanc / gpld-populate-new-minimum-date-into-linked-date-field.js
Created May 20, 2025 10:28
gpld-populate-new-minimum-date-into-linked-date-field.js
const sourceFieldId = 37; // Replace with the ID of the source field (Field A)
// Track completion of required events
let postRenderComplete = false;
let minDateComplete = false;
let formId;
let calculationTimeout;
function checkAndRunCalculations() {
if (postRenderComplete && minDateComplete) {
@saifsultanc
saifsultanc / gw-snippet-gcgs_gppa_query_builder_args-78195.php
Created April 16, 2025 06:37
gw-snippet-gcgs_gppa_query_builder_args-78195.php
<?php
add_filter( 'gcgs_gppa_query_builder_args', function( $query_builder_args, $args, $object ) {
/** @var string|string[] */
$filter_value = null;
/** @var array */
$filter = null;
/** @var int */
$filter_group_index = null;
@saifsultanc
saifsultanc / test.php
Created April 14, 2025 09:39
test.php
<?php
add_action( 'gform_entry_post_save', function( $entry ) {
$form = GFAPI::get_form( $entry['form_id'] );
foreach ( $form['fields'] as $field ) {
if ( $field->get_input_type() === 'html' ) {
// Save HTML field content into entry meta
gform_update_meta( $entry['id'], 'html_field_' . $field->id, $field->content );
}
}
@saifsultanc
saifsultanc / gwiz_entry_count_shortcode_excluding_unsubscribed.php
Created April 8, 2025 05:42
gwiz_entry_count_shortcode_excluding_unsubscribed.php
<?php
add_filter( 'gform_shortcode_entry_count', 'gwiz_entry_count_shortcode', 10, 2 );
function gwiz_entry_count_shortcode( $output, $atts ) {
$email_field_id = 1; // Replace with your the email field ID.
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
extract( shortcode_atts( array(
'id' => false,
'status' => 'total', // accepts 'total', 'unread', 'starred', 'trash', 'spam'
'format' => false, // should be 'comma', 'decimal'
@saifsultanc
saifsultanc / custom-snippet-79632.php
Created April 3, 2025 05:07
custom-snippet-79632.php
<?php
add_filter( 'gform_replace_merge_tags', function ( $text, $form, $entry ) {
$pick = '';
if ( $text == '@{:1} @{:3} @{:10}' ) {
$trigger_field_id = 8;
$trigger_field_value = rgpost( 'input_' . $trigger_field_id );
if ( $trigger_field_value == 'First Choice' ) {
$pick = '1';
@saifsultanc
saifsultanc / gwaft_template_showhidden.php
Created March 29, 2025 09:06
gwaft_template_showhidden.php
<?php
add_filter( 'gwaft_template_output', function( $content, $slug, $name, $data, $suffixes ) {
if ( ! in_array( 'showhidden', $suffixes, true ) ) {
return $content;
}
$items = array();
foreach ( $data['form']['fields'] as $field ) {
$items[] = array(
'label' => $field->label,
@saifsultanc
saifsultanc / gcgs_gppa_query_builder_args.php
Created March 21, 2025 12:21
gcgs_gppa_query_builder_args.php
<?php
add_filter( 'gcgs_gppa_query_builder_args', function( $query_builder_args, $args, $object ) {
/** @var string|string[] */
$filter_value = null;
/** @var array */
$filter = null;
@saifsultanc
saifsultanc / gcgs-gppa-custom-query-builder-args.php
Last active March 13, 2025 10:09
gc-google-sheets/gcgs-gppa-custom-query-builder-args.php
<?php
add_filter( 'gcgs_gppa_query_builder_args', function( $query_builder_args, $args, $object ) {
/** @var string|string[] */
$filter_value = null;
/** @var array */
$filter = null;