Page 1 of 1

HTML Link Instead of Form/Button for Paypal Subscribe

PostPosted: October 30th, 2011, 8:09 pm
by Raam Dev
I'd like to create an HTML subscription link that works with s2Member instead of using a <form> or WordPress shortcode. Is this possible?

I want to do something like this:

Code: Select all
<a href="<subscribe link">Subscribe to my Journal - $5/month</a>

Re: HTML Link Instead of Form/Button for Paypal Subscribe

PostPosted: October 31st, 2011, 11:17 am
by Bruce C
Creating an link with <a> would not be possible, since s2member passes hidden variables in through the form, which cannot be passed in a link. However, you could create something similar by pointing to an image that doesn't exist and changing the alt="" in the form.

Re: HTML Link Instead of Form/Button for Paypal Subscribe

PostPosted: October 31st, 2011, 12:04 pm
by Raam Dev
I fell asleep last night thinking about this problem and I realized that I could use JavaScript to achieve what I wanted: First, I hide the submit button using CSS, then I submit the form using JavaScript by adding onClick to the link HTML.

However, before I can do any of that, I need to give the s2Member form a name. Both the shortcode-generated form and the HTML provided by the button generator don't have a form a name.

How to Create an HTML link that submits Subscribe buttons

Update: As Cristián points out below, this can be achieved using the output="url" shortcode option (read more here: WP Admin -> s2Member -> PayPal Button -> Shortcode Attributes).

By changing the output option to 'url', the shortcode will return a raw URL that we can then use in an anchor tag to create a link:

Code: Select all
<a href="[s2Member-PayPal-Button level="1" ccaps="" desc="Raam's Journal ($5/month)" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="raamdev.com" ta="0" tp="0" tt="D" ra="5.00" rp="1" rt="M" rr="1" rrt="" rra="1" image="default" output="url" /]">Subscribe to the Journal ($5/month)</a>


When the post is published, that code turns into a link that allows my reader to subscribe to my journal:

Image

Re: HTML Link Instead of Form/Button for Paypal Subscribe

PostPosted: November 1st, 2011, 12:06 am
by Cristián Lávaque
Raam, have you tried using the anchor or URL output for the shortcode? WP Admin -> s2Member -> PayPal Button -> Shortcode Attributes -> output

Re: HTML Link Instead of Form/Button for Paypal Subscribe

PostPosted: November 1st, 2011, 11:35 am
by Raam Dev
Cristián Lávaque wrote:Raam, have you tried using the anchor or URL output for the shortcode? WP Admin -> s2Member -> PayPal Button -> Shortcode Attributes -> output


Cristián, the URL output option is exactly what I was looking for -- thanks! I'll update my original post with the 'correct' solution to prevent confusion for others. :)

Cheers!

Re: HTML Link Instead of Form/Button for Paypal Subscribe

PostPosted: November 2nd, 2011, 2:10 am
by Cristián Lávaque
Cool! Glad I could help. :)