nf_optin_send_admin_email
The Ninja Forms nf optin send admin email function.
Description
nf_optin_send_admin_email();
Usage
if ( !function_exists( 'nf_optin_send_admin_email' ) ) { require_once ABSPATH . PLUGINDIR . 'ninja-forms/ninja-forms.php'; } // NOTICE! Understand what this does before running. $result = nf_optin_send_admin_email();
Defined (1)
The function is defined in the following location(s).
- /ninja-forms.php
- 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;
- }
- /**
- * 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 );
- }