New function fetchUserData() introduced to API, total rewrite (not all)
[mailer.git] / inc / modules / member / what-reflinks.php
index 5f746a4933d58aea9fbce2d749920a35fceb84bd..d4838a47fd337ad03c0977a2b25151d1f64abf0d 100644 (file)
@@ -47,17 +47,14 @@ if (!defined('__SECURITY')) {
 addMenuDescription('member', __FILE__);
 
 // Load current referal clicks
-$result = SQL_QUERY_ESC("SELECT `ref_clicks` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
-       array(getUserId()), __FILE__, __LINE__);
-
-// Load it
-$content = SQL_FETCHARRAY($result);
-
-// Free result
-SQL_FREERESULT($result);
+if (!fetchUserData(getUserId())) {
+       // Something really bad happened
+       debug_report_bug('No user account ' . getUserId() . ' found.');
+} // END - if
 
 // Prepare some data
-$content['userid'] = getUserId();
+$content['ref_clicks'] = getUserData('ref_clicks');
+$content['userid']     = getUserId();
 
 // @TODO Move this into a filter
 if (isExtensionActive('nickname')) {