I have a view which uses a user reference field. My plan was to use this view to filter a node reference field. Using the Default argument of the UID from current user as an argument for the view.

This view will work if I put it on a page, or as a block, but wasn't working on the node reference field.

This is the SQL for the view working on a normal page

SELECT node.nid AS nid, node.title AS node_title FROM node node LEFT JOIN content_field_blog_site_users node_data_field_blog_site_users ON node.vid = node_data_field_blog_site_users.vid WHERE (node.type in ('mtblog_site')) AND (node_data_field_blog_site_users.field_blog_site_users_uid = 1) LIMIT 0, 10

This is the SQL for the view on the node edit page

SELECT node.nid AS nid, node.title AS node_title FROM node node WHERE node.type in ('mtblog_site') LIMIT 0, 10

After a bit of testing, it seems that the view (if exposed as a block) will work everywhere except the node edit page in which case it will miss the whole code with the argument in off the query and return all nodes (the content type filter I have set up still works in the view). This is the case even for a node type with no node or user reference fields.

I have spent an age trying to debug this but have not been able to work it out, I believe it is a bug.

note: I am running php 5.3 if this may affect things

Comments

JeremyFrench’s picture

Update.
I have changed the call to _content_type_info in the function content_fields to include the reset argument and the problem goes away, but I think this will have big performance issues.

JeremyFrench’s picture

Status: Active » Closed (fixed)

This was weird. I had Drupal running with memcached. However my memcached server wasn't started. Once I started memcached the issue went away.