News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Paypal "subscription" button

Started by Rogerd, January 20, 2017, 08:26:18 AM

Previous topic - Next topic

Rogerd

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.

vbgamer45

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

Rogerd

Quote from: vbgamer45 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

}


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

Kindred

Well, how did you put the paypal button in the header of your site?
Слaва
Украинi

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

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Rogerd

Quote from: Kindred on January 20, 2017, 11:19:26 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.

Rogerd

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>';


vbgamer45

change to

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

Shambles

The first </form> may need to be outside the conditional check...?

vbgamer45

That's right

Should be this instead


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

Rogerd

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.

Illori

you need to add $user_info to the globals.

Rogerd


vbgamer45

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

Rogerd

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.

Shambles

What kind of errors?

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

Rogerd


Shambles


Rogerd

No that doesn't work, still no button, the code looks exactly the same as the index template I posted up.

Kindred

no, it's not the same...    he added the global in the declarations at the top of the function.
Слaва
Украинi

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

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Rogerd

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>';

Advertisement: