Commit 628d095d authored by Kevin Stover's avatar Kevin Stover

Fixes a bug with the deprecated code base introduced in version 3.0.17.

parent 97b33d6b
......@@ -701,63 +701,64 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
$migrations->nuke(TRUE, TRUE);
}
}
}
// Scheduled Action Hook
function nf_optin_send_admin_email( ) {
/*
* If we aren't opted in, or we've specifically opted out, then return false.
*/
if ( ! Ninja_Forms()->tracking->is_opted_in() || Ninja_Forms()->tracking->is_opted_out() ) {
return false;
}
// Scheduled Action Hook
function nf_optin_send_admin_email( ) {
/*
* If we aren't opted in, or we've specifically opted out, then return false.
*/
if ( ! Ninja_Forms()->tracking->is_opted_in() || Ninja_Forms()->tracking->is_opted_out() ) {
return false;
}
/*
* If we haven't already submitted our email to api.ninjaforms.com, submit it and set an option saying we have.
*/
if ( get_option ( 'ninja_forms_optin_admin_email', false ) ) {
return false;
}
/*
* If we haven't already submitted our email to api.ninjaforms.com, submit it and set an option saying we have.
*/
if ( get_option ( 'ninja_forms_optin_admin_email', false ) ) {
return false;
}
/*
* Ping api.ninjaforms.com
*/
$admin_email = get_option('admin_email');
$url = home_url();
$response = wp_remote_post(
'http://api.ninjaforms.com',
array(
'body' => array( 'admin_email' => $admin_email, 'url' => $url ),
)
);
if( is_array($response) ) {
$header = $response['headers']; // array of http header lines
$body = $response['body']; // use the content
}
/*
* Ping api.ninjaforms.com
*/
$admin_email = get_option('admin_email');
$url = home_url();
$response = wp_remote_post(
'http://api.ninjaforms.com',
array(
'body' => array( 'admin_email' => $admin_email, 'url' => $url ),
)
);
if( is_array($response) ) {
$header = $response['headers']; // array of http header lines
$body = $response['body']; // use the content
}
update_option( 'ninja_forms_optin_admin_email', true );
}
update_option( 'ninja_forms_optin_admin_email', true );
}
add_action( 'nf_optin_cron', 'nf_optin_send_admin_email' );
add_action( 'nf_optin_cron', 'nf_optin_send_admin_email' );
// Custom Cron Recurrences
function nf_custom_cron_job_recurrence( $schedules ) {
$schedules['nf-monthly'] = array(
'display' => __( 'Once per month', 'textdomain' ),
'interval' => 2678400,
);
return $schedules;
}
add_filter( 'cron_schedules', 'nf_custom_cron_job_recurrence' );
// Custom Cron Recurrences
function nf_custom_cron_job_recurrence( $schedules ) {
$schedules['nf-monthly'] = array(
'display' => __( 'Once per month', 'textdomain' ),
'interval' => 2678400,
);
return $schedules;
}
add_filter( 'cron_schedules', 'nf_custom_cron_job_recurrence' );
// Schedule Cron Job Event
function nf_optin_send_admin_email_cron_job() {
if ( ! wp_next_scheduled( 'nf_optin_cron' ) ) {
nf_optin_send_admin_email();
wp_schedule_event( current_time( 'timestamp' ), 'nf-monthly', 'nf_optin_cron' );
// Schedule Cron Job Event
function nf_optin_send_admin_email_cron_job() {
if ( ! wp_next_scheduled( 'nf_optin_cron' ) ) {
nf_optin_send_admin_email();
wp_schedule_event( current_time( 'timestamp' ), 'nf-monthly', 'nf_optin_cron' );
}
}
}
add_action( 'wp', 'nf_optin_send_admin_email_cron_job' );
add_action( 'wp', 'nf_optin_send_admin_email_cron_job' );
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment