Skip to content

Instantly share code, notes, and snippets.

@JoshEpic
JoshEpic / modify_subscription_trial_days.php
Created February 21, 2018 23:00
Dynamically Update Gravity Forms Subscription Free Trial Days
// Change FORM_ID to your forms ID
add_filter( 'gform_submission_data_pre_process_payment_FORM_ID', 'modify_submission_data', 10, 4 );
function modify_submission_data( $submission_data, $feed, $form, $entry ) {
$today = date_create();
// I have this set to start 1 month from a date I set in a hidden field.
$date = rgar( $entry, '13' ); // Hidden Date Field.
$time = strtotime($date);
$final = date("Y-m-d", strtotime("+1 month", $time)); // Adds One month to date
$states = array(
'AL'=>'Alabama',
'AK'=>'Alaska',
'AZ'=>'Arizona',
'AR'=>'Arkansas',
'CA'=>'California',
'CO'=>'Colorado',
'CT'=>'Connecticut',
'DE'=>'Delaware',
'DC'=>'District of Columbia',
@JoshEpic
JoshEpic / monitor.sh
Last active August 29, 2015 14:16 — forked from mheadd/monitor.sh
#!/bin/bash
UP=$(pgrep mysql | wc -l);
if [ "$UP" -ne 1 ];
then
echo "MySQL is down.";
sudo service mysql start
else
echo "All is well.";
fi