WordPress.org

Ready to get started?Download WordPress

Forums

Member Access
Breaks query if all posts are Members Only (2 posts)

  1. sdhunt
    Member
    Posted 3 years ago #

    Looking for a little help or advice using the "Member Access" plugin v1.1.3.

    When calling a custom query in my theme like this:

    <?php query_posts("showposts=2&cat=7");
    if (have_posts()) :
      while (have_posts()): the_post(); ?>

    if all the resulting posts are set to "Members Only" the query breaks for visitors who are not logged in. This results in only half of the page loading and is a real problem.

    Does anyone have any advice on a solution or something I'm missing?
    Is there a way I can skip over "Members Only" posts in the query if the user is not logged in or at least close the query loop properly without it breaking.

    Thanks, any thoughts would be so appreciated!

    http://wordpress.org/extend/plugins/member-access/

  2. brownoxford
    Member
    Plugin Author

    Posted 2 years ago #

    I tried to reproduce this, but the only issue that I could find is that it is invalid PHP (when using alternative syntax for control structures you can't omit the closing 'endif;', 'endwhile;' etc.

    If I updated the PHP so that it parses correctly, I was not able to see your error. Are you still seeing this problem? If so, can you paste the exact code you have in place?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic