Advertisement:

Author Topic: Paypal "subscription" button  (Read 2435 times)

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Paypal "subscription" button
« on: January 20, 2017, 08:26:18 AM »
Hi...I wonder if someone could help me with a paypal subscription button, I've got the button up and running in the header of my forum, trouble is it's shown to guests, could someone tell what and where I need to add some code so guests don't see the button, thank's in advance.
SMF 2.0.13 and using default theme.

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,349
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Paypal "subscription" button
« Reply #1 on: January 20, 2017, 10:10:35 AM »
You would need to place the code in the following
if (!$user_info['is_guest'])
{
// your paypal code echoed here

}
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #2 on: January 20, 2017, 10:24:08 AM »
You would need to place the code in the following
if (!$user_info['is_guest'])
{
// your paypal code echoed here

}


Thank's for the reply but I've no idea what that means, sorry to be so thick lol

Online Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,106
  • Gender: Male
    • Kindred-999 on GitHub
Re: Paypal "subscription" button
« Reply #3 on: January 20, 2017, 11:19:26 AM »
Well, how did you put the paypal button in the header of your site?
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #4 on: January 20, 2017, 11:54:29 AM »
Well, how did you put the paypal button in the header of your site?

I didn't, someone did it for me, unfortunately he's not available at the moment, and it was only recently I noticed it was view-able by guests.

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #5 on: January 20, 2017, 12:35:11 PM »
Here is the paypal button code, would anyone be kind enough to copy it and paste it back into a post with the code in place so the button won't be seen by guests, thanks.

echo '
       
       </form>
       <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" style="padding-top: 50px;">
       <input type="hidden" name="cmd" value="_s-xclick">
       <input type="hidden" name="hosted_button_id" value="*************">
       <input type="image" src="http://www.********************/Website%20Integrated%20Pictures/subscribeCC_LG.png" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!"
 <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
       </form>';


Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,349
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Paypal "subscription" button
« Reply #6 on: January 20, 2017, 12:40:07 PM »
change to
Code: [Select]
if (!$user_info['is_guest'])
echo '
       
       </form>
       <form action="https://www.paypal.com/cgi-bin/webscr [nofollow]" method="post" target="_top" style="padding-top: 50px;">
       <input type="hidden" name="cmd" value="_s-xclick">
       <input type="hidden" name="hosted_button_id" value="*************">
       <input type="image" src="http://www [nofollow].********************/Website%20Integrated%20Pictures/subscribeCC_LG.png" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!"
 <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif [nofollow]" width="1" height="1">
       </form>';

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline sǝๅqɯɐɥS

  • SMF Hero
  • ******
  • Posts: 4,510
  • Gender: Male
    • i30 Owners Club
Re: Paypal "subscription" button
« Reply #7 on: January 20, 2017, 12:41:56 PM »
The first </form> may need to be outside the conditional check...?

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,349
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Paypal "subscription" button
« Reply #8 on: January 20, 2017, 12:44:11 PM »
That's right

Should be this instead

Code: [Select]
echo '</form>';

if (!$user_info['is_guest'])
echo '
             
       <form action="https://www.paypal.com/cgi-bin/webscr [nofollow]" method="post" target="_top" style="padding-top: 50px;">
       <input type="hidden" name="cmd" value="_s-xclick">
       <input type="hidden" name="hosted_button_id" value="*************">
       <input type="image" src="http://www [nofollow].********************/Website%20Integrated%20Pictures/subscribeCC_LG.png" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!"
 <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif [nofollow]" width="1" height="1">
       </form>';
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #9 on: January 20, 2017, 01:11:49 PM »
Thank's for that but the button doesn't show for anyone now, even admins, it just shows a tiny sqaure where the button should be, see attachment.

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 48,063
Re: Paypal "subscription" button
« Reply #10 on: January 20, 2017, 01:18:09 PM »
you need to add $user_info to the globals.

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #11 on: January 20, 2017, 01:28:09 PM »
you need to add $user_info to the globals.

Pardon LOL

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,349
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Paypal "subscription" button
« Reply #12 on: January 20, 2017, 01:28:23 PM »
Add before the code
global $user_info;
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #13 on: January 20, 2017, 01:37:50 PM »
Thank's for trying to help but I'm getting errors now, will have to wait until the chap who put the button up is available.

Offline sǝๅqɯɐɥS

  • SMF Hero
  • ******
  • Posts: 4,510
  • Gender: Male
    • i30 Owners Club
Re: Paypal "subscription" button
« Reply #14 on: January 20, 2017, 01:49:20 PM »
What kind of errors?

Attach the file you've been editing (to your next post) and it will be sorted out for you.

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #15 on: January 20, 2017, 01:54:17 PM »
Thank's

Offline sǝๅqɯɐɥS

  • SMF Hero
  • ******
  • Posts: 4,510
  • Gender: Male
    • i30 Owners Club
Re: Paypal "subscription" button
« Reply #16 on: January 20, 2017, 02:06:43 PM »
This should be ok


Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #17 on: January 20, 2017, 02:16:03 PM »
No that doesn't work, still no button, the code looks exactly the same as the index template I posted up.

Online Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,106
  • Gender: Male
    • Kindred-999 on GitHub
Re: Paypal "subscription" button
« Reply #18 on: January 20, 2017, 02:29:23 PM »
no, it's not the same...    he added the global in the declarations at the top of the function.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #19 on: January 20, 2017, 02:33:13 PM »
Perhaps we should start again, using the code below the button appears ok, but can be seen by guests, can someone add the code to this so guests cannot see the button, thanks.
Kindred. if it is different it's still not showing the button.

  echo '
       
      </form>
      <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" style="padding-top: 50px;">
      <input type="hidden" name="cmd" value="_s-xclick">
      <input type="hidden" name="hosted_button_id" value="T6AJ5VJND97YJ">
      <input type="image" src="http://www.rogers-relics-uk.com/Website%20Integrated%20Pictures/subscribeCC_LG.png" border="0" name="submit" alt="PayPal  The safer, easier way to pay online!">
      <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
      </form>';

Online Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,106
  • Gender: Male
    • Kindred-999 on GitHub
Re: Paypal "subscription" button
« Reply #20 on: January 20, 2017, 02:39:15 PM »
Code: (replace that with this) [Select]
echo '</form>';

if ($context['user']['is_logged'])
echo '
             
       <form action="https://www.paypal.com/cgi-bin/webscr [nofollow]" method="post" target="_top" style="padding-top: 50px;">
       <input type="hidden" name="cmd" value="_s-xclick">
       <input type="hidden" name="hosted_button_id" value="*************">
       <input type="image" src="http://www [nofollow].********************/Website%20Integrated%20Pictures/subscribeCC_LG.png" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!"
 <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif [nofollow]" width="1" height="1">
       </form>';

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #21 on: January 20, 2017, 02:52:20 PM »
The paypal button has disappeared again (cannot be viewed by admin or members) using that code.

Offline Chen Zhen

  • Sophist Member
  • *****
  • Posts: 1,028
  • Gender: Male
  • If you're going through hell, keep going!
    • Underdog-01 on GitHub
    • WebDev.ca
Re: Paypal "subscription" button
« Reply #22 on: January 20, 2017, 03:44:01 PM »

What Kindred just posted should work.

This is more or less the same but corrected for XHTML (assuming we are working with the file prior to you editing it in this thread):
Code: [Select]
echo '
</form>', $context['user']['is_logged'] ? '
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" style="padding-top: 50px;">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="T6AJ5VJND97YJ" />
<input type="image" src="http://www.rogers-relics-uk.com/Website%20Integrated%20Pictures/subscribeCC_LG.png" style="border:0;" name="submit" alt="PayPal  The safer, easier way to pay online!" />
<img alt="" style="border:0;width: 1px;height: 1px;" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" />
</form>' : '';

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #23 on: January 20, 2017, 04:18:43 PM »
You are a genius, that worked a treat, thank you Chen Zhen and all others who tried to help me, sorry for all the hassle though lol

Online Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,106
  • Gender: Male
    • Kindred-999 on GitHub
Re: Paypal "subscription" button
« Reply #24 on: January 20, 2017, 09:47:21 PM »
If that worked, then what I posted would have worked... 
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Rogerd

  • Semi-Newbie
  • *
  • Posts: 39
Re: Paypal "subscription" button
« Reply #25 on: January 21, 2017, 04:12:07 AM »
If that worked, then what I posted would have worked... 

I'm afraid I don't know enough about coding to argue with you kindred lol, but the button couldn't be seen by anybody after pasting in your code, but never mind as I'm happy it's now working after pulling most of my hair out, thank's again all.

Offline SaltedWeb

  • Full Member
  • ***
  • Posts: 617
  • Calm down your being very undude
Re: Paypal "subscription" button
« Reply #26 on: November 29, 2017, 11:40:49 PM »
I know this topic is old, but you could have your paypal button forward to a page thats not seen by guests via permissions.
You could then even give a small explanations on the page.  If you have a portal of some kind they usually have pages built in making what I said easier. Just thought in case anyone else was wanting it, would put it out if it was not already obvious to try.

SW


“Yeah, well, you know, that’s just, like, your opinion, man.”