Hello all,
I'm very intrigued by the Role Scoper plugin. I maintain a plugin which allows WordPress to be used for webcomics, and I think RS would be ideal for adding the capability to allow certain comics only to be seen by certain members — such as people who've paid for the privilege.
However, I am seeing a conflict. Out of the box, with no custom settings, RS interferes with a custom query my plugin does at the top of the index page. Basically, it creates a custom WP_Query object to find the latest post in the Comics category. This object is then used by most of my other functions throughout the page.
The query string generated is:
&cat=3,&showposts=1&caller_get_posts=1&orderby=date&order=ASC
This is the SQL that WordPress uses when this query is working properly:
SELECT SQL_CALC_FOUND_ROWS stripshow_posts.* FROM stripshow_posts
INNER JOIN stripshow_term_relationships ON (stripshow_posts.ID =
stripshow_term_relationships.object_id) INNER JOIN
stripshow_term_taxonomy ON
(stripshow_term_relationships.term_taxonomy_id =
stripshow_term_taxonomy.term_taxonomy_id) WHERE 1=1 AND
stripshow_term_taxonomy.taxonomy = 'category' AND
stripshow_term_taxonomy.term_id IN ('3') AND stripshow_posts.ID NOT IN
( SELECT tr.object_id FROM stripshow_term_relationships AS tr INNER JOIN
stripshow_term_taxonomy AS tt ON tr.term_taxonomy_id =
tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN
('0') ) AND stripshow_posts.post_type = 'post' AND
(stripshow_posts.post_status = 'publish' OR stripshow_posts.post_status
= 'private') GROUP BY stripshow_posts.ID ORDER BY
stripshow_posts.post_date ASC LIMIT 0, 1
But here is the SQL I see when RS is activated:
SELECT SQL_CALC_FOUND_ROWS DISTINCT stripshow_posts.* FROM
stripshow_posts INNER JOIN stripshow_term_relationships ON
(stripshow_posts.ID = stripshow_term_relationships.object_id) INNER JOIN
stripshow_term_taxonomy ON
(stripshow_term_relationships.term_taxonomy_id =
stripshow_term_taxonomy.term_taxonomy_id) WHERE 1=1 AND
stripshow_term_taxonomy.taxonomy = 'category' AND
stripshow_term_taxonomy.term_id IN ('3') AND stripshow_posts.ID NOT IN
('56', '57', '58', '59', '60', '61', '62', '63') AND
stripshow_posts.post_type = 'post' AND (stripshow_posts.post_status =
'publish' OR stripshow_posts.post_status = 'private') GROUP BY
stripshow_posts.ID ORDER BY stripshow_posts.post_date ASC LIMIT 0, 1
I'm certain I can work around this, but I cannot figure out why these posts are being excluded. The NOT IN clause of the query includes all the posts that are in the category I'm specifying, but not other posts. I cannot figure out why RS modifies the query to exclude the category I want to include.