• 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?

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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.

    Thread Starter tfc10r1

    (@tfc10r1)

    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?

    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' )' );

    https://codex.www.ads-software.com/Function_Reference/query_posts

    Thread Starter tfc10r1

    (@tfc10r1)

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

    Thread Starter tfc10r1

    (@tfc10r1)

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

    Member Access

    https://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}

    Hi,

    Just wondering if you used this for your front-page also? as in if the user wasn’t logged in they wouldnt see any post marked private in the the loop?

    thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘User Role Changes Not Honored in loop.php’ is closed to new replies.