Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Morrigan

    (@morrigan)

    I’m curious if anyone has found a way to lock categories from unregistered users? The above blocks users from pages but not categories, is there a way to filter them from categories?

    I think it has something to do with making an array for the categories that would be something like:
    if (logged_in)
    {
    $category=array(Category numbers);
    }
    else
    {
    $category=array(Category numbers);
    }

    Thread Starter Morrigan

    (@morrigan)

    That’s what I needed.

    If anyone else needs this for pages on their site:

    <?php
    /*
    Template Name: Template Name
    */
    get_header();
    get_currentuserinfo();
    //Only Authors and higher can read this page.
       if (current_user_can('publish_posts')) { ?>
    
    	<div id="content" class="narrowcolumn">
    
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><?php the_title(); ?></h2>
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    			</div>
    		</div>
    		<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    	</div>
    
    <?php     }
    else
    {
    //Tell the people that don't have access to this page that they do not have access.
    ?>
    You don't have access to this page.
    <?php } ?>
    <?php get_footer(); ?>

    Thread Starter Morrigan

    (@morrigan)

    I think to describe this more clearly, I just need an If Then statement that I can add

    if (user_has_permission(‘publish_posts’));
    The Page
    else
    Sorry you can’t access this

    I’ve tried it multiple times and each time it does nothing or it gives me SQL errors.
    As for the categories I’m either going to have to mod the admin and other code or something but I would need the same code that I’m using here to mod it I would assume.

    Thread Starter Morrigan

    (@morrigan)

    Thanks a million!

    Thread Starter Morrigan

    (@morrigan)

    See but that’s not a good answer to me as password protecting, especially with the same password, is unsafe. Also, what if I change an Author/Editor to a Contributor or Subscriber because of issues, Then I have to go through the hassle of changing the password for every post/page and then update every member that needs that password with the new password and there is no simple way for me to provide that other then email them.

    Unfortunately that is not a good solution.

Viewing 5 replies - 1 through 5 (of 5 total)