LM Paypal Donations block is ugly

lyricnz - April 1, 2009 - 21:35
Project:lm_paypal
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

- Button image support is broken

- The language on the donation block is bad

- The sample code in the online help at /admin/help/lm_paypal_donations is incorrect. Here is the text:

<?php
if (function_exists('lm_paypal_donate')) {
 
// 10 = amount, 'USD' is the currency followed by a description
 
print 'We would really like a $10 donation ' .
   
lm_paypal_donate(10, 'USD', 'donation to example.com') .'<br>';
 
// The amount is a one element array so an text input with the one value as
  //  default
 
print 'Write your own amount to give, we suggest $5' .
   
lm_paypal_donate(array(5), 'USD', 'donation to example.com') . '<br>';
 
// The amount is a multi element array so a select will be used. Note if one
  //   of the elements is itself an array that will be the default selection
  // The final two parameters are an alternative button (here we use the default)
  //   and a replacement label before the amount
 
print 'We would really like a $10, or more, donation ' .
   
lm_paypal_donate(array(5,array(10),15), 'USD', 'donation to example.com', '', 'Donation') .'<br>';
}
?>

Per the screenshot: currency USD is not used, message about example.com is not shown, heading text is not 'Donation' in last example is not shown well, etc

AttachmentSize
skitched-20090402-083505.jpg30.05 KB

#1

lyricnz - April 1, 2009 - 21:38

The documentation and definition for lm_paypal_donate() is:

<?php
/**
* Display a dynamically generated PayPal donate button.
*
* @param $amount
*   Required.
*     If a number it is the amount of the donation. User not asked.
*     If a single element array then a text input will appear with
*       this as the default value for the amount.
*     If a multi element array then a select will appear with the given
*       values. If one of the values is itself an array that will be the
*       default.
* @param string $ccc
*   A PayPal 3 letter currency code for the donation (e.g: USD).
* @param string $name = NULL
*   The name of the donation, displayed on PayPal donate form
* @param string $button_url = NULL
*   The url of button to click on to make the donation
* @param string $amount_label = NULL
*   Label to put before the amount if asking the user
* @param string $return_path = NULL
*   If non empty it is the url the user is returned to after the transaction
* @return
*   The html string representing the button.
*/

function lm_paypal_donate($amount, $ccc = NULL, $name = NULL, $button_url = NULL, $amount_label = NULL, $return_url = NULL) {
...
?>

#2

pounard - April 16, 2009 - 16:06

I think this method signature, is somehow, messed up by itself. This array encapsulation thing is horrible and scratch my eyes.

#3

pounard - May 3, 2009 - 23:37

Button support is now OK, all we have to do is somehow decide which is the default button, and how the user could change it.
See http://drupal.org/cvs?commit=206506
and http://drupal.org/cvs?commit=206508

#4

DeepSky - July 6, 2009 - 10:08

to solve the issue with the currency, add this code in lm_paypal_donations.module, in function lm_paypal_donate
$options['currency'] = $ccc;

 
 

Drupal is a registered trademark of Dries Buytaert.