1
MacKnIss
Make A Donation Block
  • 2004/7/11 17:29

  • MacKnIss

  • Just popping in

  • Posts: 20

  • Since: 2004/7/11


Just wondering if that is a php script someone complied and if so could you share it with me. I am helping out an online gaming community and we want to add script just like that to the site (Clan [OtH]) to show who has/has not donated towards game servers.

Any help would be great, Thanks.

2
Mithrandir
Re: Make A Donation Block

I believe it is a very automated and high-tech solution:

A custom block with the text and the PayPal donate image and when a new donation is received, Herko edits the custom block to include the new name and searches for his user ID, so he can make the link to the user's profile.

3
Herko
Re: Make A Donation Block
  • 2004/7/11 17:58

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Yup The 18 anonymous people are people whose e-mail address I couldn't link to a user profile here on xoops.org...

So, if you donated and don't see your name in the list, please contact me with the details!

Herko

4
Mithrandir
Re: Make A Donation Block

It's me... all of them

Just using different email addresses to try it out.

J/K

5
MacKnIss
Re: Make A Donation Block
  • 2004/7/11 18:55

  • MacKnIss

  • Just popping in

  • Posts: 20

  • Since: 2004/7/11


Oh. So its not a php script? Heh, wouldnt it be nice if it was tho

6
Mithrandir
Re: Make A Donation Block

Sure would.

7
Herko
Re: Make A Donation Block
  • 2004/7/11 19:13

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Oh yeah... CHeck out this XOOPS Dev Forge project Version 1.4 of the XOOPS Donations Module is already available

Herko

8
intel352
Re: Make A Donation Block
  • 2004/7/11 20:48

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


1.4 has a bug in the block code.

open the block Donat-O-Meter.php, replace the contents with the following:

/************************************************************************/
/* Donations - Paypal financial management module for XOOPS 2           */
/* Copyright (c) 2004 by Xoops2 Donations Module Dev Team                */
/* http://dev.xoops.org/modules/xfmod/project/?group_id=1060            */
/*                                                                      */
/************************************************************************/
/*                                                                      */
/* Based on NukeTreasury for PHP-Nuke - by Dave Lawrence AKA Thrash     */
/* NukeTreasury - Financial management for PHP-Nuke                     */
/* Copyright (c) 2004 by Dave Lawrence AKA Thrash                       */
/*                       thrash@fragnastika.com                         */
/*                       thrashn8r@hotmail.com                          */
/*                                                                      */
/************************************************************************/
/*                                                                      */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/*                                                                      */
/* This program is distributed in the hope that it will be useful, but  */
/* WITHOUT ANY WARRANTY; without even the implied warranty of           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU     */
/* General Public License for more details.                             */
/*                                                                      */
/* You should have received a copy of the GNU General Public License    */
/* along with this program; if not, write to the Free Software          */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  */
/* USA                                                                  */
/************************************************************************/

include_once XOOPS_ROOT_PATH.'/modules/donations/includes/functions.php';

if ( 
file_exists(XOOPS_ROOT_PATH."/modules/donations/language/".$xoopsConfig['language']."/main.php") ) {
        include_once 
XOOPS_ROOT_PATH."/modules/donations/language/".$xoopsConfig['language']."/main.php";
} else {
        include_once 
XOOPS_ROOT_PATH."/modules/donations/language/english/main.php";
}

function 
b_donations_donatometer_show($options){
        global 
$xoopsDB;
        
$block = array();
        
$query_cfg "SELECT * FROM ".$xoopsDB->prefix("donations_config")." WHERE subtype = ''";
        
$cfgset $xoopsDB->query($query_cfg);

        while ( 
$cfgset && $row $xoopsDB->fetchArray($cfgset))
        {
                        
$tr_config[$row['name']] = $row['value'];
        }
        
$swingd $tr_config['swing_day'];
        if(!(
$swingd AND $swingd 32))
                
$swingd 6;
        
        
$dmshowdate $tr_config['dm_show_date'];
        
$dmshowamt $tr_config['dm_show_amt'];
        
$DM_TITLE $tr_config['dm_title'];
        
        if(!
$DM_TITLE)
                
$DM_TITLE "Help keep us going!";
                
        if(
is_numeric($tr_config['dm_num_don']) && $tr_config['dm_num_don'] > )
                
$dmlen $tr_config['dm_num_don'];
        else if (
is_numeric($dmlen) && $dmlen ==0)
                
$dmlen = -1;
        else
                
$dmlen 10;
                
        
// Check the current day against the swing day to execute the proper query
        
if( date('d') >= $swingd )
        {
                
$query_Recordset1 "SELECT count(mc_gross) AS count, sum(mc_gross) AS gross, sum("
                
."mc_gross-mc_fee) AS net, date_format( now(),'%M') AS mon, date_format( subdate( date_format( adddate("
                
."now(), INTERVAL 1 MONTH),'%Y-%c-1'), INTERVAL 1 DAY), '%b %e') AS due_by, date_format(now(),'%b') AS "
                
."mon_short FROM ".$xoopsDB->prefix("donations_transactions")." WHERE (payment_date >= date_format("
                
."now(),'%Y-%m-".$swingd."'))";
        
                
$query_Recordset3 "select custom as muser_id, option_selection1 as showname, "
                
."date_format( payment_date, '%b-%e') as date, concat('$',sum(mc_gross)) as amt "
                
."from ".$xoopsDB->prefix("donations_transactions")." where (payment_date >= date_format( "
                
."now(), '%Y-%m-".$swingd."')) group by txn_id order by payment_date desc";
        } else
        {
                
$query_Recordset1 "select count(mc_gross) as count, sum(mc_gross) as gross, sum(mc_gross -" 
                
." mc_fee) as net, date_format( subdate( now(), interval ".$swingd." day), '%M') as mon,"
                
." 'Now!' as due_by, date_format( subdate( now(), interval ".$swingd." day), '%b') as mon_short"
                
." from ".$xoopsDB->prefix("donations_transactions")." where (payment_date < date_format( now(), '%Y-%m-".$swingd."')"
                
.") and payment_date > date_format( subdate( now(), interval ".$swingd." day), '%Y-%m-".$swingd."')";

                
$query_Recordset3 "select custom as muser_id, option_selection1 as showname, "
                
."date_format( payment_date, '%b-%e') as date, concat('$', sum(mc_gross)) as amt "
                
."from ".$xoopsDB->prefix("donations_transactions")." where (payment_date < date_format(now(),"
                
." '%Y-%m-".$swingd."')) and payment_date > date_format( subdate( now(),interval ".$swingd." "
                
."day), '%Y-%m-".$swingd."') group by txn_id order by payment_date desc";
        }

        
// Get the donation totals
        
$Recordset1 $xoopsDB->query($query_Recordset1);
        
$row_Recordset1 $xoopsDB->fetchArray($Recordset1);
        
//If there are not records, then get "null" data
        
if( !$row_Recordset1 )
        {
                
$query_Recordset1 "select '0' as count, '0' as gross, '0' as net, date_format( now(),"
                
."'%M') as mon, date_format( subdate( date_format( adddate( now(), interval 1 month), '%Y-%c-1'),"
                
." interval 1 day), '%b %e') as due_by, date_format( now(), '%b') as mon_short from "
                
." ".$xoopsDB->prefix("donations_transactions")."";
                
$Recordset1 $xoopsDB->query($query_Recordset1);
                
$row_Recordset1 $xoopsDB->fetchArray($Recordset1);
        }
        
// Get the goal
        
$query_Recordset2 "SELECT * FROM ".$xoopsDB->prefix("donations_config")." WHERE name='goal' AND subtype='".$row_Recordset1['mon_short']."'";
        
$Recordset2$xoopsDB->query($query_Recordset2);
        
$row_Recordset2 $xoopsDB->fetchArray($Recordset2);
        
        
// Set our remaining template vars
        
if(!$row_Recordset1['mon']){
                
$DM_MON date('F');
        }else{
                
$DM_MON $row_Recordset1['mon'];
        }
        
$difference $row_Recordset1['net'] - $row_Recordset2['value'];
        
$DM_GOAL sprintf('$%.02f'$row_Recordset2['value']);
        
$DM_DUE $row_Recordset1['due_by'];
        
$DM_NUM $row_Recordset1['count'];
        
$DM_GROSS sprintf('$%.02f',$row_Recordset1['gross']);
        
$DM_NET sprintf('$%.02f',$row_Recordset1['net']);
        
$DM_LEFT sprintf('$%.02f'$row_Recordset2['value'] - $row_Recordset1['net']);
        
$DM_BUTTON $tr_config['dm_button'];
        
$DM_BUTT_DIMS '';
        if( 
is_numeric($tr_config['dm_img_width']) )
                
$DM_BUTT_DIMS .= 'width='.$tr_config['dm_img_width'].' ';
        if( 
is_numeric($tr_config['dm_img_height']) )
                
$DM_BUTT_DIMS .= 'height='.$tr_config['dm_img_height'].' ';
        
        
// Load the template
        
$block['DM_TITLE'] = $DM_TITLE;
        
$block['DM_BUTTON'] = $DM_BUTTON;
        
$block['DM_BUTT_DIMS'] = $DM_BUTT_DIMS;
        
$block['DM_MON'] = $DM_MON;
        
$block['DM_GOAL'] = $DM_GOAL;
        
$block['DM_DUE'] =$DM_DUE;
        
$block['DM_GROSS'] = $DM_GROSS;
        
$block['DM_NET'] = $DM_NET;
        
$block['DON_URL'] = XOOPS_URL.'/modules/donations/index.php';
        
$show_don=0;
        
// Do we want to display the donators? 
        
if(is_numeric($dmlen) && $dmlen >= )
        {
                
$show_don=1;
                
// Get the list of donators
                
$Recordset3$xoopsDB->query($query_Recordset3);
        
                  
// List all the donators
                
$i 0;
                
$var '';
                while ( (
$row_Recordset3 $xoopsDB->fetchArray($Recordset3)) && ($i != $tr_config['dm_num_don']) )
                {
                        
// Refunded transactions will show up with $0 amount
                        
if( $row_Recordset3['amt'] > "$0" )
                        {
                                
$dmalign "center";
                                
$var .= "100%" align="$dmalign" colspan="2">";
                                
// Observe the user's wish regarding revealing their name
                                
$muser_id $row_Recordset3['muser_id'];
                                
$sqlm $xoopsDB->query("SELECT uid FROM ".$xoopsDB->prefix('users')." WHERE uname='$muser_id'");
                                list(
$uid) = $xoopsDB->fetchRow($sqlm);
                                if( 
strcmp($row_Recordset3['showname'],"Yes") == && ($userfoin mgetusrinfo($uid))){
                                        
$var .= ".XOOPS_URL."/userinfo.php?uid=".$userfoin->getVar('uid')."'>".$userfoin->getVar('uname')."";
                                }else{
                                        
$var .= _DM_ANONYMOUS_SHORT;
                                }
                                
$var .= " ";
                                if( 
$dmshowamt )
                                        
$var .=  "(".$row_Recordset3['amt'].")";
                                if( 
$dmshowdate )
                                        
$var .=  $row_Recordset3['date'];
                                
$var .=  "";
                        }
                        
$i++;
                }
        }

        if (
$difference 0) {
            
$DM_OVERAGE sprintf('$%.02f'$row_Recordset1['net'] - $row_Recordset2['value']);
            
$block['DM_LEFT2GO'] = '
                                        '
._DM_SURPLUS.':
                                        '
.$DM_OVERAGE.'
                                    '
;
        } else {
            
$block['DM_LEFT2GO'] = '
                                        '
._DM_LEFT2GO.':
                                        '
.$DM_LEFT.'
                                    ';
        }
        
        
// Define language constants
        
$block['DM_STAT'] = _DM_STAT;
        
$block['DM_MONGOAL'] = sprintf(_DM_MONGOAL,$block['DM_MON']);
        
$block['DM_DUEDATE'] = _DM_DUEDATE;
        
$block['DM_GROSSAMT'] = _DM_GROSSAMT;
        
$block['DM_NETBAL'] = _DM_NETBAL;
        
$block['DM_DONATIONS'] = _DM_DONATIONS;
        
$block['DM_MAKEDON'] = _DM_MAKEDON;

        
// Display block
        
$block['show_don']= $show_don;
        
$block['content'] = $var;
        return 
$block;
}
?>



i will be releasing v1.45 in the next week, with that fix included and other revisions to the block, as submitted by a user.

9
intel352
Re: Make A Donation Block
  • 2004/7/11 20:59

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


btw, i like your site.

fyi, you have the header meta information repeated about 2 extra times.

i see you guys play DoD? and I think I saw CS mentioned in there as well. it also appears that your site isn't running in XOOPS (yet, at least), but if you do move to xoops, I'm working on a port of HLStats for XOOPS (i'm on the XOOPS module dev team, and the hlstats web dev team, lol, worked out nicely), as well as a port of the FatalQuery server status module.

just an fyi, since those modules might be useful to your clan, and the ports integrate nicely into xoops.

i see you currently use an external phpbb forum. you might be interested in the phpbb port to xoops, available at http://www.bbpixel.com

there's a repackaged version of their phpbb port, updated to XOOPS 2.0.7, that i uploaded last week, and i believe there are transfer scripts available to transfer your current phpbb installation to the XOOPS module.

10
MacKnIss
Re: Make A Donation Block
  • 2004/7/12 2:47

  • MacKnIss

  • Just popping in

  • Posts: 20

  • Since: 2004/7/11


its not XOOPS yet. Was a template i just coded for them. Didnt have time to make one myself. I run my site (http://www.rowdy-inc.com). But i want to convert their site to XOOPS as well.

I used to run the clanoth.org site then i went inactive to due loss of internet :P then they messed it all up in my absence.

Login

Who's Online

229 user(s) are online (53 user(s) are browsing Support Forums)


Members: 0


Guests: 229


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Sep 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits