latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

specific post/page access & member levels

Home Forums Community Forum specific post/page access & member levels

This topic contains 8 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 9 months ago.

Topic Author Topic
Posted: Monday Mar 12th, 2012 at 1:11 pm #7906

On my site, we are selling specific post/page access to various custom post_types. We would also like to create a membership level that will have access to all of these posts. I’d like some advice on how to do this without creating a conflict between the specific post/page restrictions. We also need for those who already purchased access to specific posts to continue to have access.

In other words we want everyone (level 0 and unregistered) to continue to be able to purchase individual access to certain posts, while adding the option to sell full site access as a membership level.


List Of Topic Replies

Viewing 8 replies - 1 through 8 (of 8 total)
Author Replies
Author Replies
Posted: Monday Mar 12th, 2012 at 2:34 pm #7910
Username: Eduan

Hello Brett, thanks for your inquiry.

Have you looked into offering a specific post/page access package that grants access to all the pages?

Posted: Monday Mar 12th, 2012 at 2:56 pm #7912

That would work, but the plan is to grant this action automatically to certain approved email addresses. I may not be up to date with all of s2Member’s new features, but I thought the best way to do this was to use the registration notifications api to grant access to new registrants with certain email addresses. The notification would run a custom script to sniff the email address and then (if it passes) upgrade that user to the all-access level automatically.

My concern with writing a script to grant specific post/page access is that it would have to be updated (by me) every time the site owner adds a new restricted post/page.

Posted: Monday Mar 12th, 2012 at 8:24 pm #7935

I reread your suggestion and I think it might work for what I’m doing if I can combine it with a free membership form. For example, if I could add the id=”##, ###, ###” attribute to the free form this would work. Or maybe there’s another way to achieve this same behavior. Thanks for any suggestions you might have.

Posted: Monday Mar 12th, 2012 at 8:43 pm #7937
Username: Eduan

Adding that kind of data to the button/pro-form shortcode is very possible, with custom capabilities.

I forgot to mention them, but they do require work on your end.

Please check under Dashboard -› s2Member® -› API / Scripting -› Custom Capabilities for instructions.

There is also a video by Jason on custom capabilities:
Video » s2Member (Custom Capabilities)

Would this work for you?

Posted: Tuesday Mar 13th, 2012 at 3:50 pm #8040

I think this can work, but there’s just one thing I’m not sure how to do. It’s #3 below.

Here’s the steps:
1. I need to “sell” a custom capability with a form.
2. I need to write a function in my theme to test whether the curent user has that capability or not…
3. IF the user CAN view the post… I need to STOP s2Member from redirecting them to the member options page

In the video, Jason’s function redirects users if they CAN’T view the post/page but I can’t do this because the posts in question are already protected by specific post/page restrictions (with no level requirement). If I protect them all by adding them to level 1 (like Jason does in the video), then the people I’ve already sold specific posts/page access to won’t be able to view their purchases anymore. Right? (Because they are still level 0)

So somehow my function that’s called at the “template_redirect” hook needs to PERMIT access to the intended post/page… somehow overriding the redirect.

Please tell me if I’m making sense, and if you have any advice on how to achieve what I’m looking for.

  • This reply was modified 4 years, 10 months ago by  Brett Adcock.
Posted: Wednesday Mar 14th, 2012 at 3:31 am #8086

I’m afraid that the post protected with Spec Page access won’t be accessible with the right link, unless you created a hack to bypass this, which I don’t know how to do.

One thing you could do is to clone that page for the ones you’re selling the custom capability to.

Would that work for you?

Posted: Wednesday Mar 14th, 2012 at 2:47 pm #8144

The cloning idea occurred to me, but it’s not practical because there are many different specific post/pages. I’m sure I could get it working initially, but then the client would be left with a bunch of duplicate posts that would inevitably get confused.

Posted: Wednesday Mar 14th, 2012 at 6:04 pm #8175

Right. I thought it was just one page, but many would be impractical, especially for a client.

I answered here before I found the hook I gave you in the other thread. I hope that one does the trick you need.

Viewing 8 replies - 1 through 8 (of 8 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.