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.

Restrict post access based on date published

Home Forums Community Forum Restrict post access based on date published

This topic contains 1 reply, has 2 voices. Last updated by  Cristián Lávaque 3 years, 6 months ago.

Topic Author Topic
Posted: Monday Jul 1st, 2013 at 2:39 pm #52841

Hi there,

I’m just setting up my site with s2Member Pro, and I would like to know about restricting access to posts after they’ve been published a certain amount of time. I have a lot of content scheduled for posting in advance, and have something like 4-5 new posts every day which I load up a month in advance.

Is there a way that I can have only Level 2,3,4 members have access to all posts & archive pages, and have Level 0 & 1 (in my case “free” members) have access to all posts within 1 month of them being published? This is so that as time goes on, more and more content will be only available to the paid members?

I don’t know much about PHP, but I expect this would be something like a comparison between the “post_publish_date” and the “now” / “today’s date” being within 30 days of one another? If that is true, then Level 0 & 1 can access it, but if it is false then they cannot?

And if that is possible, I assume you could add an additional layer, whereby Level 2 could access things within the last 6 months (180 days), and Levels 3 & 4 could access anything.

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Tuesday Jul 2nd, 2013 at 5:51 am #52881

Right, you’d do a check of that kind in a PHP conditional to protect the content of those pages.

These should help:
[hilite path]Dashboard -› s2Member® -› API / Scripting -› Advanced PHP Conditionals[/hilite]
[hilite path]Dashboard -› s2Member® -› API / Scripting -› Content Dripping[/hilite]
http://codex.wordpress.org/Template_Tags/get_post_time
http://php.net/time
http://php.net/strtotime

Viewing 1 replies (of 1 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.