Rewrote 'we' word a little, rewrote mail order to use SQL_INSERTID() instead of anoth...
[mailer.git] / inc / modules / member / what-nickname.php
index c4fb3d7a4bdb8375b6e09bdd39acc3e58a4e3a5b..5cb477c76767c6155c30bd90d4542eb0bffdb5c9 100644 (file)
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -37,7 +37,7 @@
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       die();
+       exit();
 } elseif (!isMember()) {
        redirectToIndexMemberOnlyModule();
 }
@@ -69,14 +69,13 @@ if ($isValid === true) {
 
        // Look for nickname in database (we only need just one entry so don't worry about the "LIMIT 1" !)
        $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `nickname`='%s' AND `userid` != %s LIMIT 1",
-               array(postRequestElement('nickname'), getMemberId()), __FILE__, __LINE__);
+               array(
+                       postRequestElement('nickname'),
+                       getMemberId()
+               ), __FILE__, __LINE__);
 
        // Is it not in use?
        if (SQL_HASZERONUMS($result)) {
-               // Nickname not in use, so set it now
-               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `nickname`='%s' WHERE `userid`=%s LIMIT 1",
-                       array(postRequestElement('nickname'), getMemberId()), __FILE__, __LINE__);
-
                // Prepare array
                $filterData = array(
                        'history_subject' => 'NICKNAME_CHANGED',
@@ -87,6 +86,13 @@ if ($isValid === true) {
                // Run filter chain
                runFilterChain('add_history_entry', $filterData);
 
+               // Nickname not in use, so set it now
+               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `nickname`='%s' WHERE `userid`=%s LIMIT 1",
+                       array(
+                               postRequestElement('nickname'),
+                               getMemberId()
+                       ), __FILE__, __LINE__);
+
                // Change message
                $content = '{--MEMBER_NICKNAME_SAVED--}';
        } // END - if
@@ -97,7 +103,7 @@ if ($isValid === true) {
        // Load template
        displayMessage($content);
 } else {
-       // Do we have already submit the form?
+       // Is there already submit the form?
        if (isPostRequestElementSet('nickname')) {
                loadTemplate('admin_settings_unsaved', false, '{--MEMBER_NICKNAME_IS_INVALID--}');
        } // END - if