Page 1 of 1

Restricting posts in category when each post is 7 days old

PostPosted: October 11th, 2011, 10:55 pm
by ahammer
Is there a way to restrict a post to a higher member level after the post is x days old? Our site offers a free tip of the week to all users. The following week, when a tip is replaced by the new tip for the current week, the previous tip needs to move to a member's only archive. Could we automatically restrict the access to a member level 1 after 7 days?

Thanks,
Andrew

Re: Restricting posts in category when each post is 7 days o

PostPosted: October 12th, 2011, 7:05 am
by Eduan
Hi ahammer,
maybe this post could help: viewtopic.php?f=4&t=15140.

Re: Restricting posts in category when each post is 7 days o

PostPosted: October 12th, 2011, 7:39 pm
by Cristián Lávaque
Eduan is correct. You can use conditionals and the content dripping as explained in the documentation. WP Admin -> s2Member -> API / Scripting -> Advanced/PHP Conditionals and s2Member Content Dripping

Code: Select all
<?php if (current_user_can('access_s2member_level2') || S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS < 7) { ?>
The tip.
<?php } else { ?>
No tip.
<?php } ?>



I hope this helps. :)

Re: Restricting posts in category when each post is 7 days o

PostPosted: October 12th, 2011, 7:51 pm
by ahammer
Yes, both posts are somewhat helpful. However, the memberships will not be purchased so we won't have that date. Can the logic be adapted to work based on the post date? We are using posts to hold each tip of the week so would need to use post date+7 as the lock for the content.

Thanks,
Andrew