- if (!empty($ref)) {
- // Test if nickname or numeric id
- if ((EXT_IS_ACTIVE("nickname")) && ($ref != "".bigintval($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);
- } // END - if
+ // Do we have an entry?
+ if (isUserDataValid()) {
+ // Load userid
+ $GLOBALS['refid'] = getUserData('userid');
+ } else {
+ // So do we have a userid?
+ fetchUserData(determineReferalId());