SimplePortal

Customization => Blocks and Modifications => Block Requests => Topic started by: Ares on January 07, 2011, 08:08:02 PM

Title: i would like to share this code: Thank you marquee
Post by: Ares on January 07, 2011, 08:08:02 PM
I use:Treasury 2.08 with smf2.0 rc4

i use it with simple portal.
the marquee gets the name of all your members that have donated in the month and says thank you to them like
***Thank you Ares for your Donation******Thank you qdawg for your Donation***
up to 10 member. can be changed to what ever here
Code: [Select]
$limit = 10;   // Amount of donors to retrieve.  (default: last 10)
please post something if you are going to use it or even try it so i will know if i should share more or not.
just a ty or thank you will do even

open notepad and past this code save as donation-marquee.php upload to sources
Code: [Select]
<?php

if (!defined('SMF'))
   die (
'Hacking Attempt...');

function 
retreiveDonors()
{
   global 
$context$smcFunc;
   
$limit 10;   // Amount of donors to retrieve.  (default: last 10)
   
$results $smcFunc['db_query']('''
            SELECT *
            FROM smf_treas_donations
            ORDER BY smfi7_treas_donations.id DESC
            LIMIT {int:limit}'
,
            array(
                  
'limit' => !empty($limit) ? $limit '0',
            )
   );
   
$context['donors']['list'] = array();
$month strftime('%m'forum_time());

while (
$row $smcFunc['db_fetch_assoc']($results))
{
    if(
strftime('%m'$row['payment_date']) == $month)
    {
        
$context['donors']['list'][$row['id']] = array(
                                
'id' => $row['id'],
                                
'name' => $row['custom'],
                                
'date' => $row['payment_date'],
                                );
    }
}
}
?>

simple portal php block code
Code: [Select]
<?php

   
global $sourcedir$context;

   require_once(
$sourcedir'/donation-marquee.php');
   
retreiveDonors();

     echo 
'<marquee>';
   foreach (
$context['donors']['list'] as $donor)
      echo 
'***Thank you<span style="color: #ff0000;"> '$donor['name'], ' </span>for your Donation***';
   echo 
'</marquee>';
?>
Title: Re: i would like to share this code: Thank you marquee
Post by: Old Fossil on March 03, 2011, 12:07:54 AM
I'm sure someone will find this useful.
SimplePortal 2.3.8 © 2008-2024, SimplePortal