Paypal blocks
Here are two snippets that display how much and who has made donations. Requires the paypal_framework module.
Total money sent to you:
<?php
$result = db_query("
SELECT SUM(payment_gross) as total FROM paypal_log
");
$pp = db_fetch_object($result);
print sprintf( "%01.2f", $pp->total+0 );
?>The 10 most recent people to have sent you the money:
<?php
$result = db_query("
SELECT business,option_name1 FROM paypal_log ORDER BY payment_date DESC LIMIT 10
");
$count = 0;
while( $donor = db_fetch_object($result) ){
print "<li>";
if( $donor->{business} ){
print $donor->{business};
}elseif( $donor->{option_name1} ){
print $donor->{option_name1};
}else{
print "<i>anonymous</i>";
}
print "</li>";
$count = $count + 1;
}
if( $count==0 ){
print "<li><i>none</i></li>";
}
?>
10 last donations snippet - small improvement
I've modified this snippet to be fully compatible (when it comes to layout) with Drupal 5 and its default Garland theme, perhaps it fixes the layout for Drupal 5 in general, I don't know about that. I'm just getting started with Drupal.
<?php$result = db_query("
SELECT business,option_name1 FROM paypal_log ORDER BY payment_date DESC LIMIT 10
");
$count = 0;
print '<div class="item-list"><ul>';
while( $donor = db_fetch_object($result) ){
print '<li>';
if( $donor->{business} ){
print $donor->{business};
}elseif( $donor->{option_name1} ){
print $donor->{option_name1};
}else{
print '<i>anonymous</i>';
}
print '</li>';
$count = $count + 1;
}
if( $count==0 ){
print '<li><i>none</i></li>';
}
print '</ul></div>';
?>