]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/beg_functions.php
A lot has been rewritten, ext-teams added, ext-forced continued:
[mailer.git] / inc / libs / beg_functions.php
index 12941204e087ab21392c7207b88dd38cd7305bd6..144d9efedd0cc3e0a6dd8a5f29cceebf5ecd3373 100644 (file)
@@ -50,6 +50,9 @@ function addPointsBeg ($userid, $points) {
                // Add points to rallye account
                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=`beg_points`+%s WHERE `userid`=%s LIMIT 1",
                        array($points, $userid), __FUNCTION__, __LINE__);
+
+               // We need to set $add here, two
+               $added = (!SQL_HASZEROAFFECTED());
        } else {
                // Add points to account
                initReferalSystem();
@@ -57,9 +60,9 @@ function addPointsBeg ($userid, $points) {
        }
 
        // Subtract begged points from member account if the admin has selected one
-       if (isValidUserId(getBegUserid())) {
+       if (($added === true) && (isValidUserId(getBegUserid()))) {
                // Subtract from this account
-               subtractPoints('beg_payout', getBegUserid(), $points);
+               $added = ($added && subtractPoints('beg_payout', getBegUserid(), $points));
        } // END - if
 
        // Return result