Index: userpoints.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/userpoints/userpoints.module,v
retrieving revision 1.49
diff -u -r1.49 userpoints.module
--- userpoints.module	8 May 2007 01:57:58 -0000	1.49
+++ userpoints.module	31 May 2007 05:33:51 -0000
@@ -1,6 +1,6 @@
 <?php
 
-//$Id: userpoints.module,v 1.49 2007/05/08 01:57:58 kbahey Exp $
+//$Id: userpoints.module,v 1.44.2.6 2007/05/08 01:53:56 kbahey Exp $
 
 // Copyright 2005-2007 Khalid Baheyeldin http://2bits.com
 
@@ -339,6 +339,9 @@
       break;
     case 'view':
       $points = (int)db_result(db_query('SELECT points FROM {userpoints} WHERE uid = %d', $user->uid));
+      if (user_access(USERPOINTS_PERM_ADMIN)) {
+        $points = l($points, 'admin/user/userpoints/add/' .$user->uid, array('title' => t('manage points')));
+      }
       $disp_points[] = array(
         'title' => t('User !points', userpoints_translation()),
         'value' => $points,
@@ -421,7 +424,10 @@
 
   $mode = arg(3);
   $txn_id = (int)arg(4);
-
+  if ($txn_id) {
+    $txn_user = user_load(array('uid' => $txn_id));
+  }
+  
   $timestamp = format_date(time(), 'custom', 'Y-m-d H:i O');
 
   if ($mode == 'edit' && $txn_id) {
@@ -430,12 +436,13 @@
     $timestamp = format_date($txn->time_stamp, 'custom', 'Y-m-d H:i O');
   }
 
-  $form['uid'] = array(
+  $form['txn_user'] = array(
     '#type'          => 'textfield',
-    '#title'         => t('User ID'),
-    '#size'          => 10,
-    '#maxlength'     => 10,
-    '#default_value' => $txn->uid,
+    '#title'         => t('User Name'),
+    '#size'          => 30,
+    '#maxlength'     => 60,
+    '#default_value' => $txn_user->name,
+    '#autocomplete_path' => 'user/autocomplete',
     '#description'   => t('Drupal User ID for the user you want the points to affect'),
     );
 
@@ -490,9 +497,9 @@
       break;
 
    case 'edit':
-     $form['txn_id'] = array(
+     $form['txn_user'] = array(
        '#type'  => 'hidden',
-       '#value' => $txn->txn_id,
+       '#value' => $txn_user,
        );
 
      $form['approver_uid'] = array(
@@ -541,9 +548,10 @@
     return;
   }
 
+  $txn_user = user_load(array('name' => $form['txn_user']));
   switch($form['mode']) {
     case 'add':
-      userpoints_userpointsapi('points', $form['points'], $form['uid'], 'admin', $form['description']);
+      userpoints_userpointsapi('points', $form['points'], $txn_user->uid, 'admin', $form['description']);
       break;
       
     case 'edit':
