// 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__);
// 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!');