Commit 3d38df43 authored by KR Moorhouse's avatar KR Moorhouse

Finished cleaning up deprecated opt-in process.

parent 53c1c508
......@@ -207,12 +207,14 @@ class NF_THREE_Submenu
/**
* Email address of the current user, defaulting to admin email if they do not have one.
*/
$current_user = wp_get_current_user();
/*$current_user = wp_get_current_user();
if ( ! empty ( $current_user->user_email ) ) {
$email = $current_user->user_email;
} else {
$email = get_option( 'admin_email' );
}
} */
$email = $_REQUEST[ 'user_email' ];
$site_data = array(
'url' => site_url(),
......
......@@ -27,14 +27,16 @@ jQuery(document).ready(function($) {
if ( jQuery( '#optin-send-email' ).attr( 'checked' ) ) {
sendEmail = 1;
userEmail = jQuery( '#optin-email-address' ).val();
} else {
sendEmail = 0;
userEmail = '';
}
// Show spinner
jQuery( '#optin-spinner' ).css( 'visibility', 'visible' );
// Hit AJAX endpoint and opt-in.
jQuery.post( ajaxurl, { action: 'ninja_forms_optin', send_email: sendEmail }, function( response ) {
jQuery.post( ajaxurl, { action: 'ninja_forms_optin', send_email: sendEmail, user_email: userEmail }, function( response ) {
jQuery( '#optin-spinner' ).css( 'visibility', 'hidden' );
optinModal.setContent( jQuery( '#optin-thankyou' ) );
/**
......
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