Hello,
Is it possible to setup S2 in way that you have to be a member to see posts of say older than one month. The newest posts must always be free for every visitor. Or will that require some extra (source)coding?
Thanks
Ron
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™
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<?php
$restrict_after=30 * 86400; // days * seconds per day (30 days)
$post_age = date('U') - get_post_time('U');
if ($post_age < $restrict_after || is_user_logged_in()) { ?>
<div class="entry">
<?php the_content(); ?>
</div>
<?php }
else { ?>
<div class="entry">
<p>This post is older than 30 days and can only be accessed with a <a href="http://example.com/join /">membership</a>. If you already have a membership, please <a href="http://example.com/login/">login</a> to view this post.</p>
</div>
<?php } // Closes if-block that checks post age ?>
</div> <!-- closes 'post class' -->
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
</div> <!-- closes 'content' -->
Users browsing this forum: Exabot [Bot], Google [Bot] and 2 guests