- $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
-
- // Is there an entry?
- if (SQL_NUMROWS($result) == 1) {
- // Loads surname, family's name and the email address
- list($sname, $fname, $email) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Grab user's all unconfirmed mails
- if (EXT_IS_ACTIVE("bonus")) {
- // Load bonus ID
- $result = SQL_QUERY_ESC("SELECT stats_id, bonus_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s ORDER BY `id`",
- array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
- } else {
- // Load stats ID (2nd will be ignored later! But it is needed for the same fetchrow command)
- $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s ORDER BY `id`",
- array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
- }
-
- // Get number of rows from the query
- $nums = SQL_NUMROWS($result);
-
- if ($nums > 0) {
+ if (fetchUserData(getRequestElement('userid'))) {
+ // Default is ext-bonus is not installed
+ $rowName = 'stats_id';
+
+ // Is ext-bonus installed?
+ if (isExtensionActive('bonus')) {
+ // Use bonus_id
+ $linkDataName = 'bonus_id';
+ } // END - if
+
+ // Load user links data
+ $result = SQL_QUERY_ESC("SELECT `userid`, `stats_id`, `%s`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s ORDER BY `id` ASC",
+ array(
+ $linkDataName,
+ bigintval(getRequestElement('userid'))
+ ), __FILE__, __LINE__);
+
+ // Are there some entries?
+ if (!SQL_HASZERONUMS($result)) {