? .cvsignore
? userpoints_expire_expired3.patch
? userpoints_expire_expired_d6.patch
? userpoints_fix_status.patch
? userpoints_fix_status_d6.patch
Index: userpoints.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/userpoints/userpoints.module,v
retrieving revision 1.67.2.62
diff -u -p -r1.67.2.62 userpoints.module
--- userpoints.module	23 Sep 2010 01:05:39 -0000	1.67.2.62
+++ userpoints.module	10 Oct 2010 22:10:12 -0000
@@ -578,16 +578,11 @@ function userpoints_userpointsapi($param
     }
 
     if (!isset($params['moderate'])) {
-      //if not passed then site default is used
-      $params['status'] = variable_get(USERPOINTS_POINTS_MODERATION, 0);
+      // If not passed then site default is used.
+      $params['status'] = variable_get(USERPOINTS_POINTS_MODERATION, USERPOINTS_TXN_STATUS_APPROVED);
     }
     else {
-      if ($params['moderate'] == TRUE) {
-        $params['status'] = 1;
-      }
-      else {
-        $params['status'] = 0;
-      }
+      $params['status'] = $params['moderate'] ? USERPOINTS_TXN_STATUS_PENDING : USERPOINTS_TXN_STATUS_APPROVED;
     }
     if (!isset($params['tid']) || !is_numeric($params['tid'])) {
       //if not passed then site default is used
@@ -632,7 +627,7 @@ function userpoints_userpointsapi($param
   if ($params['points'] < 0) {
     $msg = t('lost');
   }
-  elseif ($params['status'] == 2) {
+  elseif ($params['status'] == USERPOINTS_TXN_STATUS_DECLINED) {
     //points have been declined
     $msg = t('was declined');
   }
@@ -648,7 +643,7 @@ function userpoints_userpointsapi($param
     );
   }
 
-  if ($params['status'] == 1) {
+  if ($params['status'] == USERPOINTS_TXN_STATUS_PENDING) {
     $mesg = (t('User %uname %op %pointsvalue !points, pending administrator approval.',
       array_merge(userpoints_translation(), array(
         '%uname'  => $name,
@@ -701,18 +696,6 @@ function _userpoints_transaction(&$param
         return FALSE;
       }
     }
-    if (!isset($params['moderate'])) {
-      //if not passed then site default is used
-      $params['status'] = variable_get(USERPOINTS_POINTS_MODERATION, 0);
-    }
-    else {
-      if ($params['moderate'] == TRUE) {
-        $params['status'] = 1;
-      }
-      else {
-        $params['status'] = 0;
-      }
-    }
     if (isset($params['expirydate']) && !is_numeric($params['expirydate'])) {
       return FALSE;
     }
