--- affiliates.module.orig	2008-11-24 15:16:53.000000000 -0800
+++ affiliates.module	2008-12-29 02:01:03.000000000 -0800
@@ -2,7 +2,7 @@
 // $Id
 
 // Portions Copyright 2006 http://2bits.com
-define ('AFFILIATE_BUTTONS_DIRECTORY_RELATIVE_FILES', '/images/affiliates');
+define ('AFFILIATE_BUTTONS_DIRECTORY_RELATIVE_FILES', '/affiliates');
 
 define('AFFILIATE_HOMEPAGE_PROFILE',      'affiliate_homepage_profile');
 define('AFFILIATE_BLOCK_TEXT',            'affiliate_block_text');
@@ -260,7 +260,7 @@
    $form['affiliates_settings']['revenue'] = array(
     '#type' => 'fieldset',
     '#title' => t('Revenue'),
-    '#collapsible' => TRE,
+    '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );	
 
@@ -1013,7 +1013,14 @@
   // Record it in the userpoints
   if (module_exists('userpoints')) {
     $points = (int)db_result(db_query("SELECT points FROM {affiliates_ads} WHERE ad_id = %d", $ad_id));
-    userpoints_userpointsapi('points', $points, $uid, "affiliates");
+    $params = array(
+    	'points'      => $points,
+        'uid'         => $uid,
+        'operation'   => 'affilate click',
+        'tid'         => variable_get('AFFILIATES_USERPOINTS_TID', 0),
+        'reference'   => 'affiliates'
+    );
+    userpoints_userpointsapi($params);
   }
 
   if ($redirect) {
@@ -1033,16 +1040,27 @@
         '#type' => 'fieldset',
         '#collapsible' => TRUE,
         '#collapsed' => TRUE,
-        '#title' => t('%Points for nodevote', userpoints_translation()),
+        '#title' => t('!Points for Affiliates', userpoints_translation()),
       );
-    
-      $form[$group][AFFILIATES_USERPOINTS] = array(
-        '#type' => 'textfield',
-        '#title' => t('%Points for affiliate click', userpoints_translation()),
-        '#default_value' => variable_get(AFFILIATES_USERPOINTS, 1),
-        '#size' => 5,
-        '#maxlength' => 5,
+      
+//This form item is commented out as the value does not modify anything currently. It could be used later on as a modifier.
+//      $form[$group][AFFILIATES_USERPOINTS] = array(
+//        '#type' => 'textfield',
+//        '#title' => t('!Points for Affiliates clicks', userpoints_translation()),
+//        '#default_value' => variable_get(AFFILIATES_USERPOINTS, 1),
+//        '#size' => 5,
+//        '#maxlength' => 5,
+//      );
+      
+      $form[$group]['AFFILIATES_USERPOINTS_TID'] = array(
+        '#type'          => 'select',
+        '#title'         => t('Category'),
+        '#default_value' => variable_get(AFFILIATES_USERPOINTS_TID, 0),
+        '#options'       => userpoints_get_categories(),
+        '#description'   => t('Points for Affilates button click-throughs will be assigned to this category. You can modify what categories are available by modifying the <a href="!url"><b>Userpoints taxonomy</b></a>. Points values are set in the <a href="/affiliates/admin"><b>Affiliates Admin</b></a> section on a per button basis.', 
+          array('!url' => url('admin/content/taxonomy/'. variable_get(USERPOINTS_CATEGORY_DEFAULT_VID, '')))),
       );
+      
       return $form;
   }
 }
@@ -1069,7 +1087,7 @@
           else {
             $output .= '<br/>' . t('No clicks yet.');
           }
-          $output .= "<br/><a href=\"/affiliates/top_users\">more &raquo;</a>";
+          $output .= "<br/><a href=\"affiliates/top_users\">more &raquo;</a>";
 
           if ($user->uid) {
             $output .= "<br/><br/>You have " . _get_user_points($user->uid) . " points.";
