Possible fix #2
authorRoland Häder <roland@mxchange.org>
Tue, 17 Nov 2009 20:30:22 +0000 (20:30 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 17 Nov 2009 20:30:22 +0000 (20:30 +0000)
inc/libs/user_functions.php

index 32d21c1..8e14355 100644 (file)
@@ -415,7 +415,11 @@ function doNewUserPassword ($email, $userid) {
 
        // Probe userid/nickname
        // @TODO We should try to rewrite this to fetchUserData() somehow
-       if ((isExtensionActive('nickname')) && (isNicknameOrUserid($userid))) {
+       if (!empty($email)) {
+               // Email entered
+               $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `email`='%s' LIMIT 1",
+                       array($email), __FUNCTION__, __LINE__);
+       } elseif ((isExtensionActive('nickname')) && (isNicknameOrUserid($userid))) {
                // Nickname entered
                $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `nickname`='%s' OR `userid`='%s' OR `email`='%s' LIMIT 1",
                        array($userid, $userid, $email), __FUNCTION__, __LINE__);
@@ -423,10 +427,6 @@ function doNewUserPassword ($email, $userid) {
                // Direct userid entered
                $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
                        array(bigintval($userid)), __FUNCTION__, __LINE__);
-       } elseif (!empty($email)) {
-               // Email entered
-               $result = SQL_QUERY_ESC("SELECT `userid`, `status` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `email`='%s' LIMIT 1",
-                       array($email), __FUNCTION__, __LINE__);
        } else {
                // Userid not set!
                logDebugMessage(__FUNCTION__, __LINE__, 'Userid is not set! BUG!');