-$result = SQL_QUERY_ESC("SELECT ref_clicks FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array($GLOBALS['userid']), __FILE__, __LINE__);
-
-list($c) = SQL_FETCHROW($result);
-SQL_FREERESULT($result);
-
-OUTPUT_HTML("<FONT class=\"tiny\">".YOUR_PERSONAL_REFLINK.":<br />
-<STRONG><A href=\"".URL."/ref.php?refid=".$GLOBALS['userid']."\" target=\"_blank\">".URL."/ref.php?ref=".$GLOBALS['userid']."</A></STRONG><br />
-<br />");
-
-if (EXT_IS_ACTIVE("nickname"))
-{
+if (!fetchUserData(getMemberId())) {
+ // Something really bad happened
+ debug_report_bug('No user account ' . getMemberId() . ' found.');
+} // END - if
+
+// Prepare some data
+$content['ref_clicks'] = getUserData('ref_clicks');
+$content['userid'] = getMemberId();
+$content['nickname_content'] = '';
+
+// @TODO Move this into a filter
+if (isExtensionActive('nickname')) {