1
czokie
Wanted: Paypal donations code
  • 2004/4/12 12:49

  • czokie

  • Just popping in

  • Posts: 8

  • Since: 2004/4/12


Hello XOOPS people.

I am looking for any code to help manage site donations for PayPal. Idealy, I would like to get my hands on the code that is used on the XOOPS site...

Features wanted:
Link to paypal site, that passes the uid or uname field to paypal

List of recent contributors

Backend to verify PayPal transactions, and store results.

Czokie

2
Herko
Re: Wanted: Paypal donations code
  • 2004/4/12 12:51

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


The xoops.org site uses true honest handwork When I get the mail that there is a new donation, I go and edit the block manually, as well as the user profile. There is no special code for this.

Herko

3
czokie
Re: Wanted: Paypal donations code
  • 2004/4/12 23:17

  • czokie

  • Just popping in

  • Posts: 8

  • Since: 2004/4/12


OK. I'm game. I may be new to OOP - but that's never stopped me before.

But, I wouldnt mind a little help along the way.

First task: Make {X_UID} available in xoopsblock.php so that I can pass the userid as a variable on the link to the paypal site. Rationale: I want to acknowledge donations like on your site - but paypal email addresses are not always the same as the email address for the registered user. I noticed that this is available in xoopsmailer.php and tried to understand how to replicate the functionality.

I can see that $this is an array that is constructed based on search criteria, and iterated to produce $user for each email that is sent... Thats fine: But which object is available to me to find the currently online user?

Thanks to anyone who can help.

Czokie

4
Dave_L
Re: Wanted: Paypal donations code
  • 2004/4/13 0:41

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


$xoopsUser is the currently logged-in user, if that's what you mean.

Example:

global $xoopsUser// only needed if inside a function

if (is_object($xoopsUser)) {
   
$uid   $xoopsUser->getVar('uid');
   
$uname $xoopsUser->getVar('uname');
   echo 
"You are logged in as $uname ($uid).<br />n";
} else {
   echo 
"You are not logged in.<br />n";
}

5
czokie
Re: Wanted: Paypal donations code
  • 2004/4/13 15:48

  • czokie

  • Just popping in

  • Posts: 8

  • Since: 2004/4/12


Quote:

Dave_L wrote:
$xoopsUser is the currently logged-in user, if that's what you mean.

I played with that a little in xoopsblock.php... but it always returned a uid of 1... Any hints? (code fragment below)

global $xoopsUser;      // only needed if inside a function
if (is_object($xoopsUser)) {
        
$uid   $xoopsUser->getVar('uid');
        
$uname $xoopsUser->getVar('uname');
} else {
        
$uid 0;
        
$uname "";

}

...

if ( 
$c_type == 'H' ) {
        
$content str_replace('{X_SITEURL}'XOOPS_URL.'/'$this->getVar('content''N'));
        
$content str_replace('{X_UID}'$uid$content);
        return 
$content;
        
// The above 3 lines replace the existing line below
        // return str_replace('{X_SITEURL}', XOOPS_URL.'/', $this->getVar('content', 'N'));
}

6
Dave_L
Re: Wanted: Paypal donations code
  • 2004/4/13 15:57

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Quote:
... but it always returned a uid of 1... Any hints?


Hint: Were you logged in as user #1?

Maybe I don't understand what information you're trying to get.

7
czokie
Re: Wanted: Paypal donations code
  • 2004/4/13 17:02

  • czokie

  • Just popping in

  • Posts: 8

  • Since: 2004/4/12


Quote:

Dave_L wrote:
Hint: Were you logged in as user #1?

Maybe I don't understand what information you're trying to get.


Nope - It returns 1 for ALL users.

8
Dave_L
Re: Wanted: Paypal donations code
  • 2004/4/13 17:15

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


You might be looking at cached content. Why are you putting the code in xoopsblock.php?

9
czokie
Re: Wanted: Paypal donations code
  • 2004/4/14 2:07

  • czokie

  • Just popping in

  • Posts: 8

  • Since: 2004/4/12


Bingo! Got it in one. Havnt checked yet, but that makes sense.

Thanks for your time. My next task - Learn how XOOPS modules are built, and turn this thing into a module...

Czokie

10
wtravel
Re: Wanted: Paypal donations code

Hi,

edited: This feature will be included in the new xdonations module being developed on dev.xoops.org.

Regards,

Martijn

Login

Who's Online

219 user(s) are online (164 user(s) are browsing Support Forums)


Members: 0


Guests: 219


more...

Donat-O-Meter

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

Latest GitHub Commits