Skip to content

Instantly share code, notes, and snippets.

View uamv's full-sized avatar
🏠
Working from home

Joshua Vandercar uamv

🏠
Working from home
View GitHub Profile
@uamv
uamv / gf-notification-interception.php
Created February 19, 2019 12:37
Send all Gravity Form notifications to specified email addres
<?php
add_filter( 'gform_notification', function ( $notification, $form, $entry ) {
$notification['toType'] = 'email';
$notification['to'] = 'email@example.com';
return $notification;
}, 10, 3 );
@uamv
uamv / multi-column-list-populate.php
Last active April 11, 2019 15:50
Populate first column of Gravity Form multi-column list and mark as readonly
<?php
/*
Dynamically populates the first column of a Gravity Form multi-column list field
REQUIREMENTS
(1) The end of the the `gform_field_value_$parameter_name` filter must match the parameter you've set to allow field to be populated dynamically
(2) The key in each row's array element must match the header you have set for the column.
*/
add_filter( 'gform_field_value_certifications', 'typewheel_prefill_certifications_list' );
@uamv
uamv / ticktick-kanban-styling.css
Created June 17, 2020 17:23
Style TickTick Kanban Boards
.column-list-view .column-list .column-list-content {
flex-direction: column;
flex-wrap: wrap;
max-height: calc( 100vh - 72px );
width: fit-content;
}
.column-list-view .column {
margin: 0 1.5em 2em 6px;
height: fit-content;
// remap nested forms for multisite global forms
add_filter( 'gform_form_post_get_meta', function( $form ) {
if ( ! class_exists( 'GH_MGF' ) || is_main_site() ) {
return $form;
}
$primary_form_id = GH_MGF::get_primary_form_id( rgar( $form, 'id' ) );
foreach ( $form['fields'] as &$field ) {
// apply lowercase to email when saved
add_filter( 'gform_save_field_value', function( $value, $lead, $field, $form, $input_id ) {
if ( $field instanceof GF_Field_Email ) {
GFCommon::log_debug( current_filter() . ': transforming email to lowercase' );
return strtolower( $value );
}
// filter recurringly weekly notification to instead schedule as fortnightly
add_filter( 'gpns_schedule_timestamp', function ( $timestamp, $notification, $entry, $is_recurring, $current_time ) {
// properties for a recurring weekly notification
$form_id = 1;
$notification_id = '63595d7aecb08';
if ( (int) $entry['form_id'] !== $form_id || $notification['id'] !== $notification_id || ! $is_recurring ) {
return $timestamp;
}