Skip to content

Instantly share code, notes, and snippets.

@RadGH
RadGH / aa-process-all-users-once-daily.php
Last active June 5, 2020 15:19
WordPress Plugin: Loops through all users on your site, spread out throughout the day for efficiency. Provides a hook to do any sort of maintenance on those users. Does not actually modify any users, this just an API of sorts.
<?php
/*
Plugin Name: RS Process Users Daily
Description: Provides an API action for developers which iterates all users once per day, based on cofigurable settings. Usage: <code class="code">add_action( 'aa_process_all_users_daily/user', 'example_process_user' );</code>
Author: Radley Sustaire
Version: 1.1.0
*/
/*
// EXAMPLE
@rafaehlers
rafaehlers / gv-entry-notes-from.php
Last active April 14, 2020 06:51
Modify the FROM address from entry notes
<?php // DO NOT COPY THIS LINE
add_filter( 'gravityview/field/notes/email_content', 'gv_modify_notes_email_content', 10, 4 );
function gv_modify_notes_email_content( $email_settings ) {
extract( $email_settings );
$email_settings['from'] = '[email protected]';
$email_settings['from_name'] = 'GravityView Website';
/*
$email_settings['to'] = $to; //[email protected]
$email_settings['bcc'] $bcc; //[email protected]
<?php
/**
* Gravity Perks // Populate Anything // Add Line Break Between Live Merge Tag Checkbox Values
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
// Update "123" with your form ID and "4" with your Checkbox field ID.
add_filter( 'gppa_live_merge_tag_value_123_4', function( $value, $merge_tag, $form, $field_id, $entry_values ) {
$values = array_map( 'trim', explode( ',', $value ) );
return implode( '<br>', $values );
}, 10, 5 );
@spivurno
spivurno / gw-gravity-forms-round-robin.php
Last active September 22, 2020 12:57
Gravity Wiz // Gravity Forms // Round Robin
<?php
/**
* Gravity Wiz // Gravity Forms // Round Robin
*
* Cycle through the choices of a designated field assigning the next available choice when an entry is submitted. The
* cycle starts with the first choice progressing to the next available choice on each submission. After each choice has
* been assigned it will restart from the first choice.
*
* This functionality is useful when distributing leads evenly to a group of sales reps, scheduling shifts such that
* employees are assigned to the next available shift, and/or balancing the responsibility of any task-oriented
@zackkatz
zackkatz / gravityview-check-has-entry-revisions.php
Created February 27, 2020 00:29
GravityView Entry Revisions - How to check whether an entry is a revision
<?php
$entry = GFAPI::get_entry( 1234 ); // Replace '1234' with your own Entry ID
if( 'gv-revision' === $entry['status'] ) {
// This entry is actually a revision!
}
@spivurno
spivurno / gw-gravity-forms-shortcodes-as-merge-tags.php
Created February 24, 2020 15:19
Gravity Wiz // Gravity Forms // Shortcodes as Merge Tags for Gravity Forms Conditional Shortcode
<?php
/**
* Gravity Wiz // Gravity Forms // Shortcodes as Merge Tags for Gravity Forms Conditional Shortcode
* http://gravitywiz.com/
*
* Requires Gravity Forms 2.4.17.2+
*
* Usage:
*
* 1. First convert your shortcode into a merge tag.
@zackkatz
zackkatz / prevent-adding-revision.php
Last active April 14, 2020 06:48
Entry Revisions - Prevent adding revisions for a specific form
<?php
/**
* Prevent adding revisions for a specific form
*
* @param bool $add_revision Should a revision be added?
* @param integer $entry_id The entry ID that was updated
* @param array $form The form object for the entry.
* @param array $original_entry The entry object before being updated
*
@damiencarbery
damiencarbery / slideout.js.php
Created February 1, 2020 21:10
Use Slideout.js with Genesis Sample theme - Similar to ShiftNav but lighter. https://www.damiencarbery.com/2020/02/use-slideout-js-with-genesis-sample-theme/
<?php
/*
Plugin Name: Slideout.js with Genesis Sample
Plugin URI: https://www.damiencarbery.com/2020/02/slideout-js-with-genesis-sample/
Description: Use Slideout.js mobile menu with Genesis Sample theme.
Author: Damien Carbery
Version: 0.1
*/
@spivurno
spivurno / gp-easy-passthrough-save-token-to-field.php
Created January 23, 2020 14:47
Gravity Perks // Easy Passthrough // Save EP Token to Field
<?php
/**
* Gravity Perks // Easy Passthrough // Save EP Token to Field
* http://gravitywiz.com/documentation/gravity-forms-easy-passthrough/
*
* This snippet allows you to populate the EP token into a field so it can be mapped in Gravity Forms feeds. The filter
* fires before feeds are processed so the token is available in time.
*/
// Update "123" to your form ID.
add_filter( 'gform_entry_post_save_123', function( $entry, $form ) {
@spivurno
spivurno / gw-gravity-forms-check-if-form-will-be-loaded.php
Last active October 27, 2021 14:59
Gravity Wiz // Gravity Forms // Check If Form Will Be Loaded on Page
<?php
/**
* Gravity Wiz // Gravity Forms // Check If Form Will Be Loaded on Page
* http://gravitywiz.com/
*
* This snippet will allow you to check if a form will be loaded on the current page and do something if it will be.
* Note: this is a simple version that will only work on singular views where the [gravityforms] shortcode is used in
* the post content.
*
* @todo: