- } elseif (NICKNAME_IS_ACTIVE($userid)) {
- // Search for non-empty nickname
- $result = SQL_QUERY_ESC("SELECT nickname FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND nickname != '' LIMIT 1",
- array(bigintval($userid)), __FUNCTION__, __LINE__);
-
- // Found?
- if (SQL_NUMROWS($result) == 1) {
- // Load nickname from database
- list($ret) = SQL_FETCHROW($result);
+ } else {
+ // Init result
+ $result = false;
+
+ // Nickname or userid used?
+ if (''.round($userid).'' === ''.$userid.'') {
+ // Userid given
+ $result = SQL_QUERY_ESC("SELECT `nickname` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid` =%s LIMIT 1",
+ array(bigintval($userid)), __FUNCTION__, __LINE__);
+
+ // Found?
+ if (SQL_NUMROWS($result) == 1) {
+ // Load nickname from database
+ list($ret) = SQL_FETCHROW($result);
+
+ // Put it in cche
+ $GLOBALS['cache_array']['nicknames'][$userid] = $ret;
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+ } else {
+ // Direct nickname found!
+ $ret = $userid;