PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Hiding PayPal buttons?

s2Member Plugin. A Membership plugin for WordPress®.

Hiding PayPal buttons?

Postby Graphis » December 3rd, 2010, 5:18 pm

I'm selling downloads on my site, and trying to work out the best way of doing it according to member level.
It occurred to me that a really good way of doing it, would be for the customer to be able to read the post (rather than hiding the entire post), but only if they are at a certain membership level will a 'Buy Now' button appear at the bottom.

So is there any way of restricting the display of the PayPal button?
User avatar
Graphis
Registered User
Registered User
 
Posts: 8
Joined: November 9, 2010

Re: Hiding PayPal buttons?

Postby madsem » December 5th, 2010, 1:38 am

You have to use simple conditionals in your posts and pages:

[s2If !current_user_can(access_s2member_level4) AND !current_user_can(access_s2member_level3) AND !current_user_can(access_s2member_level2) AND current_user_can(access_s2member_level1)]
**paypal button** for level 1 members
[/s2If]
User avatar
madsem
Registered User
Registered User
 
Posts: 26
Joined: October 26, 2010

Re: Hiding PayPal buttons?

Postby Graphis » December 5th, 2010, 9:22 am

Hi, thanks for that, however I've tried it, and it doesn't seem to work. I created a test user with no membership privileges at all, so theoretically, as your code should only allow a level 1 member (and up) to see the button, the test user should not see it. But the button remains unhidden.
User avatar
Graphis
Registered User
Registered User
 
Posts: 8
Joined: November 9, 2010

Re: Hiding PayPal buttons?

Postby madsem » December 5th, 2010, 10:05 am

no the code allows only level1... it was meant as an example though

you can try this:

[s2If current_user_is(s2member_level0)]
Button For Level 0 Members.
[/s2If]
[s2If current_user_is(s2member_level1)]
Button For Level 1 Members.
[/s2If]
[s2If current_user_is(s2member_level2)]
Button For Level 2 Members.
[/s2If]
[s2If current_user_is(s2member_level3)]
Button For Level 3 Members.
[/s2If]
[s2If current_user_is(s2member_level4)]
Button For Level 4 Members.
[/s2If]


And PS: You should enter shortcodes always in html editor mode, just in case...the preview mode could wrangle up the code
User avatar
madsem
Registered User
Registered User
 
Posts: 26
Joined: October 26, 2010

Re: Hiding PayPal buttons?

Postby Graphis » December 5th, 2010, 10:26 am

Hi, OK I misunderstood . So I tried again, this time setting my test user's membership as Level 2. But again it didn't work. Level 2 members can still see the button.

I then tried your other codes, but none of them seem to work either. Sorry. Maybe I'm just not getting this here, I don't understand. I am not using the visual editor, I've disabled it because I'm also using the ExecPHP plug in. I'm also using the plugin 'EasyFileShop', which allows for selling files as downloads. Could either of these be interfering with the conditionals?
User avatar
Graphis
Registered User
Registered User
 
Posts: 8
Joined: November 9, 2010

Re: Hiding PayPal buttons?

Postby madsem » December 5th, 2010, 10:53 am

Could be, why are you using easyfileshop? s2member can also handle filedownloads that are tied to a purchase...

And the exec_php should not interfere, Jason the developer here wrote me in an email that I even should use it :)


It could also be a problem how you test if it works, just to clarify:
[s2If current_user_is(s2member_level2)]
Button For Level 2 Members.
[/s2If]

simply means IF the current member has level2, show the button... So if you don't want the button to show for level2 members you should check with a level 1,3 or 4 member when this level2 conditional is in your page/post
User avatar
madsem
Registered User
Registered User
 
Posts: 26
Joined: October 26, 2010

Re: Hiding PayPal buttons?

Postby Graphis » December 5th, 2010, 11:05 am

Easyfileshop was a legacy plugin: I'm helping a friend develop his site, and he already had that before we got s2Member. I'll try setting it up in s2, and ditching efs, see what happens. If nothing else, the less plugins the better:)

Does the code you provided mean that there will be more than one button i.e. one for each member level?

If so, I would prefer to just have one button, that allows purchase for everyone above the member that is denied: i.e. If a level 1 member cannot see the button, he knows that only levels 2,3, & 4 can purchase. Levels 2, 3, & 4 will be able to see it. And the same for downloads only available to level 4 members for example: everyone below level 4 won't see it.
User avatar
Graphis
Registered User
Registered User
 
Posts: 8
Joined: November 9, 2010

Re: Hiding PayPal buttons?

Postby madsem » December 5th, 2010, 11:57 am

Yeah, this:

[s2If current_user_is(s2member_level2)]
Button For Level 2 Members.
[/s2If]

means only level 2 members can see it, but since s2member levels are incremental it could be that its also visible for member levels above 2 if you only use this conditional. You will have to test a little...

This should work, but I haven't tested it:

[s2If current_user_is(s2member_level2) AND !current_user_is(s2member_level0) AND !current_user_is(s2member_level3) AND !current_user_is(s2member_level4)]
button only visible to level2 members
[/s2If]

Also make sure to take a look in your s2 admin, under API/Scripting--->Simple Condtionals
User avatar
madsem
Registered User
Registered User
 
Posts: 26
Joined: October 26, 2010

Re: Hiding PayPal buttons?

Postby Graphis » December 5th, 2010, 12:13 pm

Great, many thanks for taking the trouble, I appreciate it. I'll test these later and repost if I have any problems.
User avatar
Graphis
Registered User
Registered User
 
Posts: 8
Joined: November 9, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest

cron