Skip to content

Instantly share code, notes, and snippets.

View michaeledi's full-sized avatar

Edi Weigh michaeledi

View GitHub Profile
@Idealien
Idealien / functions.php
Created September 26, 2018 01:49
Example of post-workflow step calculations
<?php
add_action( 'gravityflow_post_webhook', 'sh_action_gravityflow_post_webhook', 10, 4 );
function sh_action_gravityflow_post_webhook( $response, $args, $entry, $current_step ) {
//Replace step ID and fields for calculation to match your use case.
if ( $current_step->get_id() == 77 && is_numeric( $entry['3'] ) && is_numeric( $entry['16'] ) ) {
$entry['14'] = round( $entry['3'] * $entry['16'], 2);
$result = GFAPI::update_entry( $entry );
}
}
@grantalltodavid
grantalltodavid / functions.php
Created July 20, 2018 09:53
Sliced Invoices - change default ordering of quotes/invoices in admin list view
// this will set default order by invoice/quote number
if ( is_admin() ) {
add_action( 'pre_get_posts', 'sliced_set_default_orderby', 11 );
}
function sliced_set_default_orderby( $query ) {
// double check to avoid interfering with any ajax requests
if ( ! sliced_get_the_type() ) {
@spivurno
spivurno / gp-limit-dates-block-date-range.php
Created April 12, 2018 12:40
Gravity Perks // GP Limit Dates // Block Date Range via Exceptions
<?php
/**
* Gravity Perks // GP Limit Dates // Block Date Range via Exceptions
*/
add_filter( 'gpld_limit_dates_options_1364_1', 'gpld_except_date_range', 10, 3 );
function gpld_except_date_range( $options, $form, $field ) {
$start_date = '2016-07-15';
$end_date = '2017-01-01';
@richardW8k
richardW8k / gist:8d982aab66ace32a5e0d35ec7e2d6c1b
Last active July 30, 2019 10:06
Replace the Gravity Flow {workflow_cancel_link} merge tag when used in the step instructions.
add_filter( 'gform_pre_replace_merge_tags', function ( $text, $form, $entry ) {
if ( strpos( $text, '{workflow_cancel_link}' ) === false || empty( $entry ) || ! class_exists( 'Gravity_Flow_Merge_Tags' ) ) {
return $text;
}
$api = new Gravity_Flow_API( $form['id'] );
$step = $api->get_current_step( $entry );
if ( ! $step ) {
return $text;
@michaeledi
michaeledi / gp-multi-page-navigation-disable-on-first-page.php
Created April 7, 2016 16:35 — forked from spivurno/gp-multi-page-navigation-disable-on-first-page.php
GP Multi-page Navigation // Gravity Perks // Disable Navigation on First Page Only
<?php
/**
* GP Multi-page Navigation // Gravity Perks // Disable Navigation on First Page Only
*/
// update the "673" to your form ID
add_filter( 'gform_pre_render_673', function( $form ) {
$submission = rgar( GFFormDisplay::$submission, $form['id'] );
@spivurno
spivurno / gw-gravity-forms-list-field-chained-selects.php
Last active October 11, 2020 19:55
Gravity Wiz // Gravity Forms // Chained Selects for List Fields
<?php
/**
* Gravity Wiz // Gravity Forms // Chained Selects for List Fields
*
* Convert List Field inputs into selects and allow them to be chained.
*
* @version 1.13
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@spivurno
spivurno / gw-gravity-forms-currencies.php
Created September 24, 2015 13:32
Gravity Wiz // Gravity Forms // Default Currencies
{
"USD": {
"name": "U.S. Dollar",
"symbol_left": "$",
"symbol_right": "",
"symbol_padding": "",
"thousand_separator": ",",
"decimal_separator": ".",
"decimals": 2
},
@spivurno
spivurno / gw-gravity-forms-populate-date-usage.php
Last active October 21, 2020 20:49
Gravity Wiz // Gravity Forms // Populate Date
<?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-populate-date.php
*/
/**
* Gravity Wiz // Gravity Forms // Populate Date (Usage)
*/
@carlosleopoldo
carlosleopoldo / delete-orphans-usermeta.sql
Last active June 16, 2023 13:23
Delete all orphans user meta in WordPress
DELETE FROM wp_usermeta
WHERE NOT EXISTS (
SELECT * FROM wp_users
WHERE wp_usermeta.user_id = wp_users.ID
)
@ericmann
ericmann / wp-index-redis.php
Last active September 3, 2019 07:48
Alternative Index file for WordPress that uses Redis as a full-page cache.
<?php
/**
* WP Redix Index
*
* Redis caching system for WordPress. Inspired by Jim Westergren.
*
* @author Jeedo Aquino
* @see http://www.jeedo.net/lightning-fast-wordpress-with-nginx-redis/
* @see http://www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/
*/