How to wrap upgrade/downgrade buttons in [s2if]?

I’m setting up my upgrade/downgrade buttons on a page called “change membership”, which will open the appropriate form on another page called ‘upgrade downgrade’. I found How would I display upgrade/downgrade options independently? on the forum, which has helped me to understand the concept. However, I am still lost on how to wrap the buttons with [s2if]. For example, the post uses this setup as an example to follow:

[_s2If current_user_can(access_s2member_package2)]
You are on a Level 2.

Upgrade:
buttonModifyToPackage3
buttonModifyToPackage4

Downgrade:
buttonModifyToPackage1

[/_s2If]

This seems to be the code that I need, but getting an actual button in there is proving extremely difficult. I’m using Stripe as my gateway and Beaver Builder to construct the site and BB generates the buttons through it’s button module. I know how to input the code so that the correct option is preselected in the form. Any ideas on how to accomplish this?

Thanks!

Hi Courtney.

To sell s2Member access, you use the s2 buttons or pro-forms. At the moment it’s not sold from another plugin or cart easily.

For Stripe, s2Member has the pro-forms, not buttons. WP Admin > s2Member Pro > Stripe Pro-Forms

Does that help understand it better? :slight_smile:

Thanks, Cristian.
I used the buttons without the [s2if] condition. Doing it this way, I have a button for each upgrade/downgrade level and coded each one to select the correct option in the form. The member will see all the buttons, including his own level. It’s not the most elegant solution, but it seems to get the job done.

Thanks a bunch for your quick response and wonderful help!

Oh ok, so you’re using PayPal Buttons then? That’s totally fine.

You can customize what buttons the user sees based on his current access, and that’s where s2If (or a PHP condition) would be useful. Maybe a current_user_cannot(-capability-) would be good for each level, then he’d only be shown the options he doesn’t have yet, for example. You can of course refine it for an even more tailored page, but that would be a good start. https://s2member.com/kb-article/s2if-simple-shortcode-conditionals/

:slight_smile:

Hmmm…I’ll have to look into the current_user_cannot(-capability-) some more, it may be the solution. I’m using only Stripe for my payment gateway. The buttons that I have setup only takes the member to the checkout form and pre-selects the correct option in the form.

Thanks again for all of your help!

1 Like

No problem :slight_smile: