mmrobins
Forum Replies Created
-
Forum: Requests and Feedback
In reply to: Privacy based on levelsThis has worked better than I anticipated so thanks for the help. There’s still a few issues, but I’m going to post them in a different place since they’re not related to the initial question. Below I’ve pasted in my finished loop that I’m using on my index.php. I haven’t looked at changing the feed loops yet, but I’m sure they’ll be pretty close to the same thing.
<?php
if ($posts) : foreach ($posts as $post) : start_wp();
<!– If the user isnt logged in and the post is in the personal category, ask to login –>
if ($user_level <= ‘0’ && (in_category(26))) { ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h2>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h2>
<small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>
<div class=”entry”>
Please <?php wp_register(”, ”); ?> or <?php wp_loginout(); ?> to read this post.
</div>
<?php }
else { ?>
<div class=”date”><?php the_date(); ?></div><h2 id=”post-<?php the_ID(); ?>”>” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”><?php the_title(); ?></h2>
<div class=”meta”><?php _e(“Filed under:”); ?> <?php the_category(‘,’) ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(); ?></div>
<div class=”storycontent”>
<?php the_content(__(‘(more…)’)); ?>
</div><div class=”feedback”>
<?php wp_link_pages(); ?>
<?php comments_popup_link(__(‘Comments (0)’), __(‘Comments (1)’), __(‘Comments (%)’)); ?>
</div><!–
<?php trackback_rdf(); ?>
–><?php comments_template();
} ?>
<?php endforeach; else: ?>
<?php _e(‘Sorry, no posts matched your criteria.’); ?>
<?php endif; ?>Forum: Requests and Feedback
In reply to: Privacy based on levelsThanks, that’s basically what I wanted. Now I’d like to set it so that only certain categories are hidden. I’m new to php and am not having much luck doing this, but I was trying something along the lines of
if (preg_match (“CategoryName”, the_category()))
{have to login to show post}
else
{show full post}or using if (strpos(the_category(), ‘CategoryName”))
but I’m not getting this to work. Any advice?