I have a view that is supposed to list a load of nodes, but only those whose source domain is active. All of these nodes are assigned to All Affiliates, to a specific domain, and have the domain source set to the specific domain - so they are primarily nodes from the sub-domain (because of domain_source), but also available to all affiliates.
I have added a relationship in my view to the source domain, and then added a 'Domains: Valid' filter set to true, and set it to use the source domain relationship.
I would expect this to only list nodes that are assigned to an active source domain - However, the view lists all domains, including inactive ones.
If I change the 'Domains: Valid' filter to False, then only those inactive domain are listed - so clearly it knows which are inactive. It's just a problem when filtering on Domains: Valid = TRUE.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | view.txt | 5.39 KB | agentrickard |
Comments
Comment #1
agentrickardIn my testing, I was able to duplicate this, but only because the {domain_source} table was empty. If the nodes you want are not recorded in the {domain_source} table, this relationship will fail.
In most cases, you don't need the relationship anyway.
Comment #2
mrfelton commentedIn my case, domain_source is not empty for the nodes in question.
Comment #3
mrfelton commentedAlso, I have tried without the relationship - but it still doesn't work.
Comment #4
mrfelton commentedCould this be related to #925268: It is not possible to set the domain source to an inactive domain - if you remember, this patch allows a node to have an inactive domain set as domain_source in the first place. I can't see why that would make any difference, as views should only be looking at the raw table data, I would have thought.
Comment #5
mrfelton commentedI have stripped my view down so it's about as basic as I can get it. Looking at the SQL that is generates shows something strange.
This is the SQL that is generated when Domains : valid = False:
And an excerpt from the view result:
And this is the SQL that is generated when Domains : valid = True:
As you would expect, they are identical, expect for the condition node_domain_source__domain.valid =
And an excerpt from the view result:
Notice how nid 10337 is now showing node_domain_source__domain_valid as 1, where before it was 0!
If I remove the condition altogether, the results look correct
So how does the presence of that condition actually change the value in the column?? I really don't get it.
Comment #6
agentrickardI suspect it's the gid in the join; it really needs an extra parameter to ensure the join is against domain_id.
Comment #7
mrfelton commentedHmm. definitely something up. Any ideas on how to get that extra parameter in?
Comment #8
agentrickardThe join syntax for hook_views_data supports an "extra" element.
Comment #9
agentrickardI looked at this again, and almost set up a duplicate View (attached). What I can't figure out is why your query has an INNER JOIN in it.
Note: I'm using Views 3.
I also think you may not need the relationships at all.
Comment #10
dqdI'll close this issue due to inactivity for 14 years and even if I would move it to the next nearest core version which is 7, there is upcoming EOL of Drupal 7 in January 2025. While the project's version for Drupal 7 will surely keep providing support for security issues and website breaking bug fixes for Drupal 7, we should try to minimize the open issues for Drupal 7 in the queue as much as possible. A big thanks around for the report and all the efforts in here. Feel free to re-open if you can provide a fix or found an additional related problem which increases the issue priority.