1
Cyberglass
Adding user ID to Form
  • 2005/8/14 16:35

  • Cyberglass

  • Just popping in

  • Posts: 11

  • Since: 2004/7/11


Hi Folks,

I'm adding a paypal button to my site and need it to send the user's ID number as a custom hidden variable to PayPal but not really sure how to do that.

I have a custom block which displays the button and works just fine, but when I put any PHP in there and select PHP Script from the Content Type menu the code doesn't display. Not really sure how I would get the user ID number in PHP anyway, but I can't even start experimenting until I can see the PHP.

Any help or suggestions will be most welcome.

Thanks.
Andrew.

2
Cyberglass
Re: Adding user ID to Form
  • 2005/8/17 12:55

  • Cyberglass

  • Just popping in

  • Posts: 11

  • Since: 2004/7/11


Bump!
Still struggling with this. Sorry if it's been answered elsewhere but I did search before posting and couldn't see anything.

3
Mithrandir
Re: Adding user ID to Form

if you select php script, you also use php code to echo the HTML, right?

the user's ID can be found with
$userid $xoopsUser $xoopsUser->getVar('uid') : 0;
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

4
Cyberglass
Re: Adding user ID to Form
  • 2005/8/17 14:26

  • Cyberglass

  • Just popping in

  • Posts: 11

  • Since: 2004/7/11


Thanks Mythrandir,

Initially echo wasn't working but I found another thread that suggested using include. This now works and I can see my button. However, it's just telling me that the user ID is 0 all the time. Here is my (probably wrong) code:
$userid $xoopsUser $xoopsUser->getVar('uid') : 0;
echo 
"


.$userid."'>








"
?>


Many thanks.
Andrew

5
Cyberglass
Re: Adding user ID to Form
  • 2005/8/17 21:24

  • Cyberglass

  • Just popping in

  • Posts: 11

  • Since: 2004/7/11


OK, I think I'm close to getting this. My PHP is displaying the form and button but the $userid variable is getting being picked up but

$userid = $xoopsUser ? $xoopsUser->getVar('uid') : 0

is just returning the '0' (or whatever number I put on the end). If I try removing the ':0' then the page doesn't display at all.

Obviously I'm a complete PHP novice, I've dug around in other XOOPS php pages and seen getVar('uid') in different ways and tried them out but I'm just poking around in the dark.

Peace.
Andrew.

6
Cyberglass
Re: Adding user ID to Form
  • 2005/8/18 11:03

  • Cyberglass

  • Just popping in

  • Posts: 11

  • Since: 2004/7/11


Bump!

Sorry folks, but I still can't get this to work. I'm sure it's something basic that I'm doing wrong.

Thanks.

7
Mithrandir
Re: Adding user ID to Form

pop a
global $xoopsUser;

above the other code.
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

8
Cyberglass
Re: Adding user ID to Form
  • 2005/8/18 11:59

  • Cyberglass

  • Just popping in

  • Posts: 11

  • Since: 2004/7/11


That's fantastic! Thank you so much. Works like a dream now and I am able to get any other user info by changing the the 'uid' bit.

Nice one.

Andrew

Login

Who's Online

206 user(s) are online (34 user(s) are browsing Support Forums)


Members: 0


Guests: 206


more...

Donat-O-Meter

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

Latest GitHub Commits