-$result = SQL_QUERY_ESC("SELECT `ref_clicks` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
-$content = SQL_FETCHARRAY($result);
-SQL_FREERESULT($result);
-
-OUTPUT_HTML("<div class=\"tiny\">{--YOUR_PERSONAL_REFLINK--}:<br />
-<strong><a href=\"{!URL!}/ref.php?refid=".getUserId()."\" target=\"_blank\">{!URL!}/ref.php?ref=".getUserId()."</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')) {