Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




is_restricted_rs() with custom query bug

UserPost

1:05 pm
February 4, 2010


metal450

Member

posts 178

1

In a PAGE that uses a custom template, I observed the erroneous behavior commented below:

$my_query = new WP_Query('post_type=post&post_status=publish&posts_per_page=6');
while( $my_query->have_posts() )
{
    $my_query->the_post();

    if( function_exists('is_protected') && is_protected($post->ID) )
    {
      //is_protected() does not return true even for posts which ARE protected
    }
}

I traced the bug into template-interceptor_rs.php::is_restricted_rs(), which is returning "nothing" in the final catch-all else:

else
  return ( isset( $scoper->restricted_ids[$src_name][$id][$op_type] ) );

1:14 pm
February 4, 2010


metal450

Member

posts 178

2

Note: same behavior if I remove &post_status=publish from the query :)


Also, I do NOT notice this behavior when performing the identical code on a page outside my WP installation (from when I access its functions by doing require_once("wordpress/wp-blog-header.php"); - but it's not a "page", just an external PHP file that I call some WP functions from)

10:08 am
February 8, 2010


Kevin

Admin

posts 2503

3

The is_restricted() / is_protected() template function should now work correctly with secondary queries in the updated Role Scoper Development Snapshot.


About the Agapetry forum

Currently Online:

9 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1247

Posts: 5656

Members:

There are 1259 members

There are 1 guests


Kevin has made 2503 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin