- if (SQL_NUMROWS($result_user) == 1) {
- // Is the refback extension installed?
- if (EXT_IS_ACTIVE("refback")) {
- // Load all referal levels
- $result_levels = SQL_QUERY("SELECT level, percents
-FROM "._MYSQL_PREFIX."_refdepths
-WHERE level > 0
-ORDER BY level ASC", __FILE__, __LINE__);
- } else {
- // Loads surname, family's name and the email address
- $result = SQL_QUERY_ESC("SELECT COUNT(*) FROM `"._MYSQL_PREFIX."_user_data` WHERE refid=%s",
- array($uid), __FILE__, __LINE__);
- $result_lck = SQL_QUERY_ESC("SELECT COUNT(*) FROM `"._MYSQL_PREFIX."_user_data` WHERE refid=%s AND status != 'CONFIRMED' ORDER BY userid",
- array($uid), __FILE__, __LINE__);
- $menge = SQL_RESULT($result , 0, 0);
- $menge_lck = SQL_RESULT($result_lck, 0, 0);
-
- // Free memory
- SQL_FREERESULT($result);
- SQL_FREERESULT($result_lck);
-
- // Query for refs
- $result_levels = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email, status, joined FROM `"._MYSQL_PREFIX."_user_data` WHERE refid=%s ORDER BY userid ASC",
- array($uid), __FILE__, __LINE__);
-
- // Output info message
- OUTPUT_HTML(ADMIN_TOTAL_REFS_1."".ADMIN_USER_PROFILE_LINK($_GET['u_id'])."".ADMIN_TOTAL_REFS_2.$menge.ADMIN_TOTAL_REFS_3.$menge_lck.ADMIN_TOTAL_REFS_4."<br /><br />");
- }
+ if (fetchUserData($userid)) {
+ // Get total refs
+ $menge = countSumTotalData($userid, 'user_data', 'userid', 'refid', true);
+ $menge_lck = countSumTotalData($userid, 'user_data', 'userid', 'refid', true, " AND `status` != 'CONFIRMED'");
+
+ // Output info message
+ displayMessage(sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink(getRequestParameter('userid')), $menge, $menge_lck));
+
+ // Load all referal levels
+ $result_levels = SQL_QUERY("SELECT
+ `level`, `percents`
+FROM
+ `{?_MYSQL_PREFIX?}_refdepths`
+WHERE
+ `level` > 0
+ORDER BY
+ `level` ASC", __FILE__, __LINE__);