? buymeabeer_per_user_2.patch
? buymeabeer_per_user_3.patch
Index: buymeabeer.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/buymeabeer/buymeabeer.module,v
retrieving revision 1.3
diff -u -p -r1.3 buymeabeer.module
--- buymeabeer.module	4 Sep 2008 19:21:17 -0000	1.3
+++ buymeabeer.module	10 Nov 2008 22:32:40 -0000
@@ -99,8 +99,55 @@ function buymeabeer_paypal_link() {
 }
 
 /**
+ * Implementation of hook_link().
+ */
+function buymeabeer_link($type, $object = NULL, $teaser = FALSE) {
+  $links = array();
+  if (isset($object->uid)) {
+    $account = user_load(array('uid' => $object->uid));
+    if (isset($account->paypal_mail)) {
+      $paypal_mail = $account->paypal_mail;
+      $title_text = variable_get('buymeabeer_link_title_text', BMAB_LINK_TITLE_TEXT);
+      $href = "https://www.paypal.com/cgi-bin/webscr";
+      $query = "cmd=_xclick&business=$paypal_mail&item_name=$title_text";
+      $links['buy_a_bear'] = array(
+        'title' => t('Buy %name a bear!', array('%name' => $account->name)),
+        'href' => $href,
+        'query' => $query,
+        'absolute' => TRUE,
+        'html' => TRUE,
+        'attributes' => array('class' => 'buymeabeer-link', 'title' => $title_text)
+      );
+    }
+  }
+
+  return $links;
+}
+
+/**
  * theme function for link display
  */
 function theme_buymeabeer_link($link) {
   return '<div class="buymeabeer">'. $link .'</div>';
-}
\ No newline at end of file
+}
+
+/**
+ *Implementation of hook_user().
+ */
+function buymeabeer_user($op, &$edit, &$account, $category = NULL) {
+  switch ($op) {
+    case 'form':
+      $form['paypal_mail'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Your paypal email'),
+        '#description' => t('set here your paypal email'),
+        '#default_value' => $account->paypal_mail,
+        '#size' => 40,
+        '#maxlength' => 255,
+      );
+      return $form;
+    case 'submit':
+      $edit['data'] = serialize($edit['paypal_mail']);
+      break;
+  }
+}
