+ // Is the refback still active? ;-)
+ if (isExtensionActive('refback')) {
+ // Load all refs of this user
+ $result_refs = SQL_QUERY_ESC("SELECT `refid` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid`=%s AND `level`='%s' ORDER BY refid ASC",
+ array($userid, $levels['level']), __FILE__, __LINE__);
+ //* DEBUG: */ outputHtml($userid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs)."<br />");
+
+ // Do we have levels?
+ if (SQL_NUMROWS($result_refs) > 0) {
+ // Count entries
+ $menge = countSumTotalData($userid, 'user_data', 'userid', 'refid', true);
+ $menge_lck = countSumTotalData($userid, 'user_data', 'userid', 'refid', true, " AND `status` != 'CONFIRMED'");
+
+ // Output info message
+ $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($userid), $menge, $menge_lck);
+
+ // Init variables
+ $OUT_REFS = ''; $SW = 2;
+
+ // Load all refs
+ while ($content = SQL_FETCHARRAY($result_refs)) {
+ // Query for data
+ $result_user = SQL_QUERY_ESC("SELECT `userid`, `gender`, `surname`, `family`, `email`, `status`, `joined` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
+ array($content['refid']), __FILE__, __LINE__);
+
+ // Is the data there?
+ if (SQL_NUMROWS($result_user) == 1) {
+ // Load data
+ $data = SQL_FETCHARRAY($result_user);
+
+ // Check for referals
+ $refs_cnt = countSumTotalData($data['userid'], 'refsystem', 'counter');
+
+ // Prepare data for the template
+ $content = array(
+ 'sw' => $SW,
+ 'u_link' => generateUserProfileLink($data['userid']),
+ 'gender' => translateGender($data['gender']),
+ 'refs_link' => '0',
+ 'surname' => $data['surname'],
+ 'family' => $data['family'],
+ 'email' => "[<a href=\"".generateEmailLink($data['email'], 'user_data')."\">".$data['email']."</a>]",
+ 'status' => translateUserStatus($data['status']),
+ 'registered' => generateDateTime($data['joined'], '3'),
+ );
+
+ // Check if referal count is larger 0 and update link
+ if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink($data['userid'], $refs_cnt, "list_refs");