Skip to content

Instantly share code, notes, and snippets.

@iandunn
Created August 12, 2014 15:49
Show Gist options
  • Save iandunn/7da72f91df8c9b09ddae to your computer and use it in GitHub Desktop.
Save iandunn/7da72f91df8c9b09ddae to your computer and use it in GitHub Desktop.
Make SupportFlow check for new messages every 30 seconds
/*
* Setup fast cron schedule for SupportFlow trial
*/
function sf_cron_schedules( $schedules ) {
$schedules['30-seconds'] = array(
'interval' => 30,
'display' => 'Once every 30 seconds',
);
return $schedules;
}
add_filter( 'cron_schedules', 'sf_cron_schedules' );
/*
* Run SupportFlow retrieve cron jobs more frequently to make trial easier.
*/
function sf_fast_cron_jobs() {
if ( ! wp_next_scheduled( 'sf_30_seconds' ) )
wp_schedule_event( time(), '30-seconds', 'sf_30_seconds' );
if ( function_exists( 'SupportFlow' ) ) {
/** @var SupportFlow $supportflow */
$supportflow = SupportFlow();
add_action( 'sf_30_seconds', array( $supportflow->extend->email_replies, 'retrieve_email_replies' ) );
}
}
add_action( 'init', 'sf_fast_cron_jobs' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment