Forums

User Role Changes Not Honored in loop.php (6 posts)

  1. tfc10r1
    Member
    Posted 8 months ago #

    I require my users to log in in order to see posts marked PRIVATE. But, I want some users to be Subscribers but still be able to see PRIVATE posts as long as they are logged in.

    I installed plugin User Role Editor which allows me to change Subscribers to Read Private Posts/Read/Read Private Pages. And, if they know the URL of the private post/page they can in fact read them. But, loop.php (or maybe category.php) does not show the private posts in the category list category/my-category-list/ even with the extended role. The answer may be in the way the_post() or have_posts() works.

    Any suggestions on how I can modify the standard TwentyTen php to allow logged in Subscribers with extended roles to view Private posts in the category/ view?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    Private Posts and Pages are not shown at all on the front end of the site unless you use a custom query in the relevant template file. But don't edit the Twenty Ten theme. Instead create a child theme for your customisations.

  3. tfc10r1
    Member
    Posted 8 months ago #

    Great. Thank you. I actually have already customized a theme based on twentyten but I referenced Twentyten because I have not changed the loops for my customization so folk would be familiar with the Twentyten code.

    So, any idea WHICH template file and WHAT custom query I can use?

    It looks like only the author can see their own private page/post regardless of role setting so maybe there is a different approach that someone can recommend (short of passwording them) to have pages/posts only viewable if the member is logged in. Ideas?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    WHICH template file

    loop.php would be the most obvious.

    WHAT custom query I can use

    Something like query_posts( $query_string . '&post_status' => array( 'private', 'publish' )' );

    http://codex.wordpress.org/Function_Reference/query_posts

  5. tfc10r1
    Member
    Posted 8 months ago #

    I see. That makes sense. Thanks. Something tells me there must be an easier way...

  6. tfc10r1
    Member
    Posted 8 months ago #

    I found the general (simple) solution...a plugin called

    Member Access

    http://www.chrisabernethy.com/wordpress-plugins/member-access/

    So, no need to set the page/post as private; just install plugin and check "Ignore the default settings and make this post visible only to members" at the bottom of any page/post edit window.

    SOLVED! {simply}

Reply

You must log in to post.

About this Topic