From 06ce5c9e5d9a12040e13e33ba9d10609433d3765 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Sun, 22 Mar 2009 21:07:33 +0000 Subject: [PATCH] Replaced repetitive code with function. Modified after-signup text for clearer instructions. --- e107_languages/English/lan_signup.php | 11 ++-- signup.php | 85 +++++++++++++++------------ 2 files changed, 53 insertions(+), 43 deletions(-) diff --git a/e107_languages/English/lan_signup.php b/e107_languages/English/lan_signup.php index c41dc8daa..627e31a1c 100644 --- a/e107_languages/English/lan_signup.php +++ b/e107_languages/English/lan_signup.php @@ -9,8 +9,8 @@ * Language file - User signup * * $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_signup.php,v $ - * $Revision: 1.16 $ - * $Date: 2009-03-21 22:59:29 $ + * $Revision: 1.17 $ + * $Date: 2009-03-22 21:07:33 $ * $Author: e107coders $ * */ @@ -109,7 +109,7 @@ define('LAN_SIGNUP_68','Error: Unable to open remote XUP file'); define('LAN_SIGNUP_69',''); define('LAN_SIGNUP_70',''); define('LAN_SIGNUP_71', 'You have reached the site limit for account registrations. Please login using one of your other accounts.'); // LAN_202 -define('LAN_SIGNUP_72', "This stage of registration is complete. You will receive a confirmation email containing your login details. Please follow the link in the email to complete the signup process and activate your account."); // LAN_405 +define("LAN_SIGNUP_72", "Thanks for signing up on [sitename]! We just sent you a confirmation email to [email]. Please click on the confirmation link in the email to complete your sign up and activate your account."); // LAN_405 define('LAN_SIGNUP_73', 'Thank you!'); // LAN_406 define('LAN_SIGNUP_74', 'Your account has now been activated, please'); // LAN_401 define('LAN_SIGNUP_75', 'Registration activated'); // LAN_402 @@ -134,8 +134,9 @@ define('LAN_SIGNUP_93', 'Signature: '); // LAN_120 define('LAN_SIGNUP_94', 'Avatar: '); // LAN_121 define('LAN_SIGNUP_95', 'Enter code visible in the image'); // LAN_410 define('LAN_SIGNUP_96', 'Registration details for'); // LAN_404 (used in email) -define('LAN_SIGNUP_97', 'Welcome to'); // LAN_403 (used in email) -define("LAN_SIGNUP_98", "Confirm Email"); +define('LAN_SIGNUP_97', 'Welcome to'); // LAN_403 (used in email) + +define("LAN_SIGNUP_98", "Confirm Your Email Address"); define("LAN_SIGNUP_99", "Problem Encountered"); define("LAN_SIGNUP_100", "Admin Approval Pending"); diff --git a/signup.php b/signup.php index a2b8f88e8..c228f8999 100644 --- a/signup.php +++ b/signup.php @@ -9,8 +9,8 @@ * User signup * * $Source: /cvs_backup/e107_0.8/signup.php,v $ - * $Revision: 1.33 $ - * $Date: 2009-03-21 22:59:29 $ + * $Revision: 1.34 $ + * $Date: 2009-03-22 21:07:33 $ * $Author: e107coders $ * */ @@ -206,22 +206,13 @@ if(ADMIN && (e_QUERY == "preview" || e_QUERY == "test" || e_QUERY == "preview.a if(e_QUERY == "preview.aftersignup") { require_once(HEADERF); - if(trim($pref['signup_text_after'])) - { - $text = $tp->toHTML($pref['signup_text_after'], TRUE, 'parse_sc,defs')."
"; - } - else - { - $text = ($pref['user_reg_veri'] == 2) ? LAN_SIGNUP_37 : LAN_SIGNUP_72; // Admin Approval / Email Approval - } - $caption_arr = array(); - $caption_arr[0] = LAN_406; // Thank you! (No Approval). - $caption_arr[1] = LAN_SIGNUP_98; // Confirm Email (Email Confirmation) - $caption_arr[2] = LAN_SIGNUP_100; // Approval Pending (Admin Approval) - $caption = $caption_arr[$pref['user_reg_veri']]; + $allData['data']['user_email'] = "example@email.com"; + $allData['data']['user_loginname'] = "user_loginname"; - $ns->tablerender(LAN_SIGNUP_73, $text); + $after_signup = render_after_signup($error_message); + + $ns->tablerender($after_signup['caption'], $after_signup['text']); require_once(FOOTERF); exit; } @@ -645,30 +636,10 @@ if (isset($_POST['register'])) $e_event->trigger("usersup", $_POST); // send everything in the template, including extended fields. require_once(HEADERF); - if (isset($pref['signup_text_after']) && (strlen($pref['signup_text_after']) > 2)) - { - $text = $tp->toHTML(str_replace('{NEWLOGINNAME}', $allData['data']['user_loginname'], $pref['signup_text_after']), TRUE, 'parse_sc,defs')."
"; - } - else - { - $text = ($pref['user_reg_veri'] == 2) ? LAN_SIGNUP_37 : LAN_SIGNUP_72; - $text .= "

".$adviseLoginName; - } - $caption_arr = array(); - $caption_arr[0] = LAN_SIGNUP_73; // Thank you! (No Approval). - $caption_arr[1] = LAN_SIGNUP_98; // Confirm Email (Email Confirmation) - $caption_arr[2] = LAN_SIGNUP_100; // Approval Pending (Admin Approval) + $after_signup = render_after_signup($error_message); + $ns->tablerender($after_signup['caption'], $after_signup['text']); - $caption = $caption_arr[$pref['user_reg_veri']]; - - if($error_message) - { - $text = "
".$error_message."
"; // Just display the error message - $caption = LAN_SIGNUP_99; // Problem Detected - } - - $ns->tablerender($caption, $text); require_once(FOOTERF); exit; } @@ -892,4 +863,42 @@ function render_email($userInfo, $preview = FALSE) return $ret; } + + +function render_after_signup($error_message) +{ + global $pref, $allData, $adviseLoginName, $tp; + + $srch = array("[sitename]","[email]","{NEWLOGINNAME}","{EMAIL}"); + $repl = array(SITENAME,"".$allData['data']['user_email']."",$allData['data']['user_loginname'],$allData['data']['user_email']); + + if (isset($pref['signup_text_after']) && (strlen($pref['signup_text_after']) > 2)) + { + $text = $tp->toHTML(str_replace($srch, $repl, $pref['signup_text_after']), TRUE, 'parse_sc,defs')."
"; + } + else + { + $text = ($pref['user_reg_veri'] == 2) ? LAN_SIGNUP_37 : str_replace($srch,$repl, LAN_SIGNUP_72); + $text .= "

".$adviseLoginName; + } + + $caption_arr = array(); + $caption_arr[0] = LAN_SIGNUP_73; // Thank you! (No Approval). + $caption_arr[1] = LAN_SIGNUP_98; // Confirm Email (Email Confirmation) + $caption_arr[2] = LAN_SIGNUP_100; // Approval Pending (Admin Approval) + + $caption = $caption_arr[$pref['user_reg_veri']]; + + if($error_message) + { + $text = "
".$error_message."
"; // Just display the error message + $caption = LAN_SIGNUP_99; // Problem Detected + } + + $ret['text'] = $text; + $ret['caption'] = $caption; + return $ret; + + +} ?> \ No newline at end of file