From 2837af0de7b38d6719c61d9613569ee1b1576d2a Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Tue, 10 Jul 2018 17:10:37 +0300 Subject: [PATCH] - changed notice; --- includes/admin/assets/js/um-admin-global.js | 18 +------ includes/admin/core/class-admin-notices.php | 60 +-------------------- 2 files changed, 3 insertions(+), 75 deletions(-) diff --git a/includes/admin/assets/js/um-admin-global.js b/includes/admin/assets/js/um-admin-global.js index a6b5273c..cdc76dd9 100644 --- a/includes/admin/assets/js/um-admin-global.js +++ b/includes/admin/assets/js/um-admin-global.js @@ -30,23 +30,7 @@ jQuery(document).ready(function() { jQuery(document).on('click', '#um_opt_in_start', function (e) { - var obj = jQuery(this); - var dismiss = jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ); - jQuery(this).prop('disabled', true).attr('disabled', 'disabled'); - - wp.ajax.send( 'um_opt_in_notice', { - data: { - nonce: um_admin_scripts.nonce - }, - success: function( data ) { - dismiss.trigger('click'); - obj.prop('disabled', false).removeAttr( 'disabled' ); - }, - error: function( data ) { - obj.prop('disabled', false).removeAttr( 'disabled' ); - return false; - } - }); + jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ).trigger('click'); }); diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 75577290..01aa88fd 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -31,7 +31,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { add_action( 'admin_notices', array( &$this, 'render_notices' ), 1 ); add_action( 'wp_ajax_um_dismiss_notice', array( &$this, 'dismiss_notice' ) ); - add_action( 'wp_ajax_um_opt_in_notice', array( &$this, 'opt_in_notice' ) ); } @@ -514,24 +513,18 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { return; } - $optin_url = esc_url( add_query_arg( 'um_adm_action', 'opt_in' ) ); - ob_start(); ?>

- %s! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions for %s via our website. If you subscribe to our mailing list we will email you a 20%% discount code for our extensions bundle (you\'ll need to confirm your opt-in via email before the discount code can be sent).', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?> + %s! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions. If you subscribe to our mailing list we will send you a 20%% discount code for our extensions bundle.', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>

- +  

-

- privacy policy', 'ultimate-member' ), 'https://ultimatemember.com/privacy-policy/' ); ?> -

- add_notice( 'opt_in_notice', array( @@ -715,54 +708,5 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { wp_send_json_success(); } - - - function opt_in_notice() { - $nonce = isset( $_POST["nonce"] ) ? $_POST["nonce"] : ""; - if ( ! wp_verify_nonce( $nonce, "um-admin-nonce" ) ) { - wp_send_json_error( esc_js( __( "Wrong Nonce", 'ultimate-member' ) ) ); - } - - // Send a maximum of once per period - $last_send = get_option( 'um_opt_in_last_send', false ); - if ( $last_send && $last_send > strtotime( '-1 day' ) ) { - return; - } - - $data = array(); - - UM()->setup()->install_basics(); - - $data['email'] = get_option( 'admin_email' ); - $data['send_discount'] = ! get_option( '__ultimatemember_coupon_sent' ) ? 1 : 0; - $data['unique_sitekey'] = get_option( '__ultimatemember_sitekey' ); - - $request = wp_remote_post( 'https://ultimatemember.com/?um_action=checkin', array( - 'method' => 'POST', - 'timeout' => 45, - 'redirection' => 5, - 'httpversion' => '1.0', - 'blocking' => true, - 'body' => $data, - 'user-agent' => 'UM/' . ultimatemember_version . '; ' . get_bloginfo( 'url' ), - ) ); - - if ( ! is_wp_error( $request ) ) { - $request = json_decode( wp_remote_retrieve_body( $request ), true ); - } - - $request = ( $request ) ? maybe_unserialize( $request ) : false; - - if ( ! empty( $request['id'] ) && ! empty( $request['list_id'] ) ) { - update_option( 'um_opt_in_last_send', time() ); - - if ( $request['discount_ready'] ) { - update_option( '__ultimatemember_coupon_sent', 1 ); - } - } - - wp_send_json_success(); - } - } } \ No newline at end of file