--- 1/user2userpoints/user2userpoints.module	2008-08-17 09:36:57.000000000 -0500
+++ 5.x/user2userpoints/user2userpoints.module	2008-06-25 23:58:48.000000000 -0500
@@ -1,16 +1,4 @@
 <?php
-/**
- * @defgroup example Example: short description of your module
- *
- * Longer description of your module, including all other files and modules.
- */
-/**
- * @file
- *
- * Description of your module's main file.
- *
- * @ingroup example
- */
 
 // $Id: user2userpoints.module,v 1.1.2.1.2.2 2007/10/14 20:09:47 jredding Exp $
 
@@ -18,47 +6,45 @@
 
 define('USER2USERPOINTS_PERM_SEND', 'user2userpoints_send');
 
-function user2userpoints_user($op, &$edit, &$account, $category = NULL) {
-  if ($op == 'view') {
-  $url = 'user2userpoints/'. $account->name;
-  $items[t('!Points', userpoints_translation())] = array(
-          'value' => l(t('Give !points to '. $account->name, userpoints_translation()), $url),
-          'class' => 'member',
-  );
-  return array(t('!Points', userpoints_translation()) => $items);
-  }
-}
+function user2userpoints_user($op, &$edit, &$account, $category = NULL) { 
+   if ($op == 'view') { 
+     $url = 'user2userpoints/' .$account->name;
+     $items[t('!Points', userpoints_translation())] = array(
+          'value' => l(t('Give !points to ' .$account->name, userpoints_translation()), $url), 
+          'class' => 'member', 
+     ); 
+ 
+     return array(t('!Points', userpoints_translation()) => $items); 
+   } 
+ } 
 
 function user2userpoints_perm() {
   return array(USER2USERPOINTS_PERM_SEND);
 }
 
 /* Create the links to givepoints */
-/**
- * Implementation of hook_menu().
- */
-function user2userpoints_menu() {
-  $items['user2userpoints'] = array(
-    'title' => 'Give !points',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('user2userpoints_giveform'),
-    // NOTE: as of Drupal 6.2, all menu items are *required* to have
-    // access control.
-    'access arguments' => array(USER2USERPOINTS_PERM_SEND),
-    'type' => MENU_LOCAL_TASK,
-    'weight' => 1,
-  );
-
-  return $items;
-}
-
+function user2userpoints_menu($may_cache) { 
+  $items = array(); 
+  global $user; 
+
+  if (!$may_cache) { 
+    $items[] = array(
+      'path'               => 'user2userpoints',
+      'title'              => t('Give !points', userpoints_translation()), 
+      'callback'           => 'drupal_get_form',
+      'callback arguments' => array('user2userpoints_giveform'),
+      'access'             => array(USER2USERPOINTS_PERM_SEND),
+    ); 
+  } 
+  return $items; 
+} 
 /* Give points at footer of nodes and comments */
 function user2userpoints_link($type, $node = NULL, $teaser = FALSE) {
   global $user;
   $links = array();
   if ($node->uid != $user->uid && $node->type != 'page' && user_access(USER2USERPOINTS_PERM_SEND)) {
       $links['user2userpoints'] = array(
-      'title'   => t('Give !points', userpoints_translation()),
+      'title'              => t('Give !points', userpoints_translation()),
       'href'    => 'user2userpoints/'. $node->name
       );
   }
@@ -66,7 +52,7 @@ function user2userpoints_link($type, $no
 }
 
 
-function user2userpoints_giveform($name = '') {
+function user2userpoints_giveform($name = '') { 
   $form = array();
   $form['to'] = array(
        '#type'          => 'textfield',
@@ -89,14 +75,14 @@ function user2userpoints_giveform($name 
        '#value'         => t('Give !Points', userpoints_translation())
   );
   return $form;
-}
+} 
 
-function user2userpoints_giveform_validate($form, $form_state) {
+function user2userpoints_giveform_validate($form_id, $form_values) {
   global $user;
 
   /* Check the name to be valid. */
-  if (!empty($form_state['to'])) {
-    $to = user_load(array('name' => $form_state['to']));
+  if (!empty($form_values['to'])) {
+    $to = user_load(array('name' => $form_values['to']));
     if (!$to->uid) {
       form_set_error('to', t('That is not a valid user.'));
     }
@@ -106,33 +92,33 @@ function user2userpoints_giveform_valida
   }
 
   /* Check the value to be valid. */
-  if (!empty($form_state['amount'])) {
-    if ($form_state['amount'] < 1) {
+  if (!empty($form_values['amount'])) {
+    if ($form_values['amount'] < 1) {
       form_set_error('amount', t("You can't give less than one !point.", userpoints_translation()));
     }
-    if ($form_state['amount'] > userpoints_get_current_points($user->uid)) {
+    if ($form_values['amount'] > userpoints_get_current_points($user->uid)) {
       form_set_error('amount', t("You don't have enough !points for that.", userpoints_translation()));
     }
   }
 }
 
-function user2userpoints_giveform_submit($form, &$form_values) {
+function user2userpoints_giveform_submit($form_id, $form_values) {
   global $user;
 
-  $points = $form_state['amount'];
-  $to = user_load(array('name' => $form_state['to']));
+  $points = $form_values['amount'];
+  $to = user_load(array('name' => $form_values['to']));
 
 
   $params = array(
     'uid' => $to->uid,
     'points' => $points,
-    'event' => 'From: '. $user->name,
+    'event' => 'From: ' . $user->name,
   );
   userpoints_userpointsapi($params);
   $params = array(
     'uid' => $user->uid,
     'points' => -$points,
-    'event' => 'To: '. $to->name,
+    'event' => 'To: ' . $to->name,
   );
   userpoints_userpointsapi($params);
 
