Skip to main content
added 1364 characters in body
Source Link

My plan is to have a custom page view at blog/% so bloggers can see their own unpublished posts.

If I remove everything except these:

Filter criteria
Content: Type (= Blog entry)
Content: Published (No)

Contextual filters
Content: Author uid

I still can't see the unpublished nodes without making that user an admin. (IE: I log into uid 12 and go to blog/12 - see no nodes. Make uid 12 admin - see 1 unpublished node)

Edit: A look at the SQL shows for admin:

SELECT node.title AS node_title, node.nid AS nid, node.changed AS node_changed, node.created AS node_created
FROM node node
WHERE (( (node.uid = :node_uid ) )AND(( (node.type IN (:db_condition_placeholder_0)) AND (node.status = :db_condition_placeholder_1) ))) 
ORDER BY node_created DESC LIMIT 10 OFFSET 0 

And for normal user:

SELECT node.title AS node_title, node.nid AS nid, node.changed AS node_changed, node.created AS node_created
FROM node node
WHERE (( (node.uid = :node_uid ) )AND(( (node.type IN (:db_condition_placeholder_0)) AND (node.status = :db_condition_placeholder_1) )))
AND ( EXISTS (
  SELECT na.nid AS nid
  FROM node_access na
  WHERE (( (na.gid = :db_condition_placeholder_2) AND (na.realm = :db_condition_placeholder_3) )OR( (na.gid = :db_condition_placeholder_4) AND (na.realm = :db_condition_placeholder_5) )OR( (na.gid = :db_condition_placeholder_6) AND (na.realm = :db_condition_placeholder_7) ))AND (na.grant_view >= :db_condition_placeholder_8) AND (node.nid = na.nid) ))
ORDER BY node_created DESC LIMIT 10 OFFSET 0

Obviously there's a massive amount more SQL for normal users than admins despite my not having put anything related to node_access in there. What is views automatically doing and how can I stop it?

My plan is to have a custom page view at blog/% so bloggers can see their own unpublished posts.

If I remove everything except these:

Filter criteria
Content: Type (= Blog entry)
Content: Published (No)

Contextual filters
Content: Author uid

I still can't see the unpublished nodes without making that user an admin. (IE: I log into uid 12 and go to blog/12 - see no nodes. Make uid 12 admin - see 1 unpublished node)

My plan is to have a custom page view at blog/% so bloggers can see their own unpublished posts.

If I remove everything except these:

Filter criteria
Content: Type (= Blog entry)
Content: Published (No)

Contextual filters
Content: Author uid

I still can't see the unpublished nodes without making that user an admin. (IE: I log into uid 12 and go to blog/12 - see no nodes. Make uid 12 admin - see 1 unpublished node)

Edit: A look at the SQL shows for admin:

SELECT node.title AS node_title, node.nid AS nid, node.changed AS node_changed, node.created AS node_created
FROM node node
WHERE (( (node.uid = :node_uid ) )AND(( (node.type IN (:db_condition_placeholder_0)) AND (node.status = :db_condition_placeholder_1) ))) 
ORDER BY node_created DESC LIMIT 10 OFFSET 0 

And for normal user:

SELECT node.title AS node_title, node.nid AS nid, node.changed AS node_changed, node.created AS node_created
FROM node node
WHERE (( (node.uid = :node_uid ) )AND(( (node.type IN (:db_condition_placeholder_0)) AND (node.status = :db_condition_placeholder_1) )))
AND ( EXISTS (
  SELECT na.nid AS nid
  FROM node_access na
  WHERE (( (na.gid = :db_condition_placeholder_2) AND (na.realm = :db_condition_placeholder_3) )OR( (na.gid = :db_condition_placeholder_4) AND (na.realm = :db_condition_placeholder_5) )OR( (na.gid = :db_condition_placeholder_6) AND (na.realm = :db_condition_placeholder_7) ))AND (na.grant_view >= :db_condition_placeholder_8) AND (node.nid = na.nid) ))
ORDER BY node_created DESC LIMIT 10 OFFSET 0

Obviously there's a massive amount more SQL for normal users than admins despite my not having put anything related to node_access in there. What is views automatically doing and how can I stop it?

Source Link

Views won't display unpublished nodes when explicitly told to

My plan is to have a custom page view at blog/% so bloggers can see their own unpublished posts.

If I remove everything except these:

Filter criteria
Content: Type (= Blog entry)
Content: Published (No)

Contextual filters
Content: Author uid

I still can't see the unpublished nodes without making that user an admin. (IE: I log into uid 12 and go to blog/12 - see no nodes. Make uid 12 admin - see 1 unpublished node)