- if (!empty($ref))
- {
- // Test if nickname ($test == "0") or ID
- $test = "".round($ref)."";
- if ((EXT_IS_ACTIVE("nickname")) && ($test != $ref))
- {
- // Nickname in URL, so load the ID
- $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1", array($ref), __FILE__, __LINE__);
- list($ref) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- }
+ // Do we have an entry?
+ if (isUserDataValid()) {
+ // Load userid
+ $GLOBALS['refid'] = getUserData('userid');
+ } else {
+ // So do we have a userid?
+ fetchUserData(determineReferalId());