- $result_ref = SQL_QUERY_ESC("SELECT DISTINCT SUM(p.points)
-FROM `{!_MYSQL_PREFIX!}_user_points` AS p
-LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d
-ON p.userid=d.userid
-WHERE d.`status`='CONFIRMED' AND d.max_mails > 0 AND d.mails_confirmed >= %s AND p.ref_depth=1 AND p.points > 0 AND d.userid=%s",
- array(getConfig('ref_payout'), bigintval($content['userid'])), __FUNCTION__, __LINE__);
+ $result_ref = SQL_QUERY_ESC("SELECT
+ SUM(p.points) AS points
+FROM
+ `{?_MYSQL_PREFIX?}_user_points` AS p
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_user_data` AS d
+ON
+ p.userid=d.userid
+WHERE
+ d.`status`='CONFIRMED' AND
+ d.max_mails > 0 AND
+ d.mails_confirmed >= {?ref_payout?} AND
+ p.ref_depth=1 AND
+ p.points > 0
+ AND d.userid=%s",
+ array(bigintval($content['userid'])), __FUNCTION__, __LINE__);
+
+ // Get points