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.

Open Access after 3 weeks

Home Forums Community Forum Open Access after 3 weeks

Tagged: 

This topic contains 1 reply, has 2 voices. Last updated by  ekarma (Volunteer Moderator) 3 years, 2 months ago.

Topic Author Topic
Posted: Tuesday Oct 8th, 2013 at 11:43 am #60221
peoplescom
Username: cspannos

Hello,

I have purchased and configured s2Member pro. I have searched the forums and KB but have not found a specific answer to my question. s2Member works great for all the member level permissions that our site wants to allow for users. But we need something else too. We need to drip content on a WordPress custom content type so that after three weeks from its published date the content type becomes free for everyone — members and non-members alike. Every month we publish an online magazine and we will have to restrict every article as we upload it. But we want them all to become free three weeks later. Before it becomes free for everyone though, it should only be available for the highest membership level. Making it free to all would override the level restrictions or run in parallel, or something, so long it is free for all…

Is this possible using the default short-code or API scripting options?

Thank you,
C.

  • This topic was modified 3 years, 3 months ago by  peoplescom.
  • This topic was modified 3 years, 3 months ago by  peoplescom.
  • This topic was modified 3 years, 3 months ago by  peoplescom.

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Monday Oct 14th, 2013 at 4:31 pm #60361
Moderator

Hello,

You might add a function like this to your theme’s functions.php file:

function my_custom_is_content_released()
	{
		$release_after = 21 * 86400; // days * seconds per day = total seconds
		$post_age      = date('U') - get_post_time('U');
		if($post_age > $release_after)
				return TRUE;
		else
				return FALSE;
	}

Then you might modify your theme template to check if the user has access to the appropriate level OR if the content has been released (i.e., more than 3 weeks has passed):

<?php if ( current_user_can("access_s2member_level1") || my_custom_is_content_released() ) : ?>
	<?php // a call to the_content() might go here ?>
<?php else : ?>
	<?php // a message showing how to get access or even a redirect might go here ?>
<?php endif; ?>

You could also put that code directly inside the Post content and use a plugin like ezPHP to allow PHP inside the Post, however modifying the theme template would be far easier.

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.