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
// 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;
}
// 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 );
}
// 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 ) {
@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;
@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 / 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 / gf-custom-merge-tags.php
Last active May 26, 2022 01:12
Add custom merge tags to Gravity Forms
<?php
add_filter( 'gform_replace_merge_tags', 'typewheel_custom_merge_tags', 10, 7 );
function typewheel_custom_merge_tags( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) {
$custom_merge_tags = array(
'{date_ymd}' => date( 'Y.m-M.d', strtotime( $entry['date_created'] ) ),
'{timestamp}' => time(),
'{site_url}' => get_site_url(),
'{site_name}' => get_bloginfo( 'name' )
@uamv
uamv / gf-map-class-to-post-meta.php
Last active January 22, 2024 10:54
Save Gravity Form field data to post meta by adding a class to the field.
<?php
/**
* Save Gravity Form field data to post meta by adding a class to any field.
* Meta is mapped so that it is readable by Advanced Custom Fields
* Format class as…
* post_meta-{meta_key} -- for simple fields & writing lists as array to single meta record
* post_meta-{meta_key}-.3 -- for multi-input fields
* post_meta-{repeater_key}-1.{meta_key} -- for list fields mapped to meta readable by ACF
*/
// Run this function after the Gravity Form has created a post
@uamv
uamv / typewheel-itsec-notification-center-assistant.php
Created July 26, 2018 03:20
Enhances your control of the iThemes Security Control Center options
add_action('admin_footer', 'typewheel_notification_assistant' );
function typewheel_notification_assistant() {
// Add script if current screen belongs to iThemes Security
if ( get_current_screen()->id == 'toplevel_page_itsec' ) { ?>
<script>
let myUser = '';
@uamv
uamv / suppress-privacy-notice-pointer-wp496
Last active May 22, 2018 03:50
Run once to automatically dismiss the Privacy Notice pointer in WP 4.9.6 for all users.
add_action( 'admin_init', 'typewheel_remove_privacy_notice_pointer_wp496' );
function typewheel_remove_privacy_notice_pointer_wp496() {
$users = get_users();
foreach ( $users as $user ) {
$dismissed = array_filter( explode( ',', (string) get_user_meta( $user->ID, 'dismissed_wp_pointers', true ) ) );
$pointer = 'wp496_privacy';