From 97f0e512af6cba0a274cd77b41b463e13303421f Mon Sep 17 00:00:00 2001 From: Jonathan Labreuille Date: Thu, 24 Mar 2016 14:13:46 +0100 Subject: [PATCH] populate from/reply_to for signup confirmation - added loading screen to reinstall process --- lib/Config/Populator.php | 32 ++++++++++++++------------------ lib/Models/Setting.php | 2 +- views/settings/advanced.html | 1 + 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/lib/Config/Populator.php b/lib/Config/Populator.php index 7a70c77174..03fd3879cf 100644 --- a/lib/Config/Populator.php +++ b/lib/Config/Populator.php @@ -82,28 +82,24 @@ class Populator { private function createDefaultSettings() { $current_user = wp_get_current_user(); - // user name - $user_name = ''; - if($current_user->user_firstname) { - $user_name = $current_user->user_firstname; - } - if($current_user->user_lastname) { - if($user_name) { - $user_name .= ' '.$current_user->user_lastname; - } - } - if(!$user_name) { - $user_name = $current_user->display_name; - } + // default sender info based on current user + $sender = array( + 'name' => $current_user->display_name, + 'address' => $current_user->user_email + ); // default from name & address - Setting::setValue('sender', array( - 'name' => $user_name, - 'address' => $current_user->user_email - )); + Setting::setValue('sender', $sender); // enable signup confirmation by default - Setting::setValue('signup_confirmation.enabled', true); + Setting::setValue('signup_confirmation', array( + 'enabled' => true, + 'from' => array( + 'name' => get_option('blogname'), + 'address' => get_option('admin_email') + ), + 'reply_to' => $sender + )); } private function createDefaultSegments() { diff --git a/lib/Models/Setting.php b/lib/Models/Setting.php index 22b16aceab..cb096bc12a 100644 --- a/lib/Models/Setting.php +++ b/lib/Models/Setting.php @@ -41,7 +41,7 @@ class Setting extends Model { 'signup_confirmation' => array( 'enabled' => true, 'subject' => sprintf(__('Confirm your subscription to %1$s'), get_option('blogname')), - 'body' => __("Hello!\n\nHurray! You've subscribed to our site.\nWe need you to activate your subscription to the list(s): [lists_to_confirm] by clicking the link below: \n\n[activation_link]Click here to confirm your subscription.[/activation_link]\n\nThank you,\n\nThe team!") + 'body' => __("Hello!\n\nHurray! You've subscribed to our site.\n\nWe need you to activate your subscription to the list(s): [lists_to_confirm] by clicking the link below: \n\n[activation_link]Click here to confirm your subscription.[/activation_link]\n\nThank you,\n\nThe team!") ) ); } diff --git a/views/settings/advanced.html b/views/settings/advanced.html index ae366e1dcc..0c1c836b2a 100644 --- a/views/settings/advanced.html +++ b/views/settings/advanced.html @@ -190,6 +190,7 @@ if(confirm( "<%= __('If you confirm this, all your current MailPoet data will be erased (newsletters, statistics, subscribers, etc...)') %>" )) { + MailPoet.Modal.loading(true); MailPoet.Ajax.post({ 'endpoint': 'setup', 'action': 'reset'