Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I have a node which I 'send to all affiliates'.
This node shows up in a view on the domain the node was published as expected (this is the primairy domain).
Yet, I use the same view on all other sub domains and here the node isn't listed in the view, eventhough 'send to all affiliates' was checked.
But when I individually check all the subdomains to publish the node to in the node/edit form the node IS listed in the view.
If I'm not mistaken this was working correctly before updating to rc9.
Has anything changed?
Cheers
Comment | File | Size | Author |
---|---|---|---|
#8 | domain_views-fixes-available-on-current-domain-577008-6058712.patch | 822 bytes | scotthorn |
Comments
Comment #1
Bartezz CreditAttribution: Bartezz commentedPossibly related to: http://drupal.org/node/301662
But is there a fix for this, it's a pain to check 40-some affiliates each time you publish a node ;)
Besides I thought I had it working with previous versions!
Cheers
Comment #2
Bartezz CreditAttribution: Bartezz commentedWell I reverted to rc8 and that didn't fix it :(
The weird thing is, if I don't check any affiliates but do check 'send to all affiliates' I won't get the nodes to show up in my view with 'Domain Access: Available on current domain True', yet if I call the node by pasting it's path after the affiliate's domain I do have access to it. The access is dropped as soon as I uncheck 'send to all affiliates'.
Would be nice to have it fixed :)
Cheers
Comment #3
Bartezz CreditAttribution: Bartezz commentedBeen digging a bit in domain_views_handler_filter_domain_access_current_all.inc.
And what I found is that somehow $table.realm = 'domain_site' messes stuff up.
I've altered the inc on line #22 to
which basically changes the query to
To me that reads; a published node of the content type nieuwsbericht where the value of the realm column within the domain access table equals 'domain_site'.
Well that's all true for my node #17 yet it will not show in my view on any other than the affiliates that are explicitly checked eventhough I check "send to all affiliates" :'(
This is the whole query
Reckon this is the baddy; LEFT JOIN sgz_domain_access domain_access ON node.nid = domain_access.nid AND domain_access.realm = 'domain_id'
Which is hardcoded in domain_views.views.inc on line #120
Don't know how to fix though!
Cheers
Comment #4
agentrickardYes. This is a bug, and a nice description of what is happening here -> #561282: Views are filtered out even if filter is not set
Comment #5
Bartezz CreditAttribution: Bartezz commentedHi Agentrickard,
The issue you are refering to seems not very active. Could you please please help me on this one?
I've really given it a shot but just can't seem to fix it... grrrrr need more SQL knowledge!!!!
Anyway, I have created my primary domain and filled it with content (confident of this bug being fixed by now).
Now I have to create numerous subdomains which should all be showing all the news content of the primary domain (send to all affiliates).
Unless this bug is fixed, I have to go into every one of the hundreds of news nodes and check all of the dozens of new subdomains individually to get the news to be published on these subdomains...
And will have to do so every time a new subdomain is created :(
Almost begging here!
Cheers,
Bartezz
Comment #6
seren10pity CreditAttribution: seren10pity commentedHi,
same problem here.
I think that the problem in the query comes from here :
LEFT JOIN sgz_domain_access domain_access ON node.nid = domain_access.nid<strong> AND domain_access.realm = 'domain_id'</strong>
It causes searching only on domain_access table rows that have realm = 'domain_id', when the where clause ask for rows that have realm = domain_site.
Tee problem is in Left join ON clause, not WHERE.
I choose to tweak (bad way) the domain_views module, removing every reference to "$table.realm" when associated with 'domain_id'.
Now, my view is working: filter "Domain Access: Available on current domain True" returns only nodes that have the right domain id, or the "All affiliates" setting enabled.
However, you shouldn't do the same unless know exactly what you're doing, because I don't know if what I did won't break other functionnalities ofthe module.
If someone can solve this neatly, I would be eternally grateful to him ;)
Thanks !
Comment #7
agentrickardSteps to reproduce, please. An exported View would help. This is a long-dead issue and I have no context for it.
Comment #8
scotthorn CreditAttribution: scotthorn commentedI encountered the same problem, and made a patch that I think solves it. I'm not totally familiar with all this module has to offer, though, so it could have unintended consequences. Here are steps to reproduce:
1) Create a Drupal install with more than one domain (I'll call the first two A & B).
2) Add a node with "Published to All Domains" checked and only domain A checked below it.
3) Create a node view page and add the "available on current domain" filter.
4) Look at the page on both domain A and domain B.
Like seren10pity mentioned, the view is joining against the domain_access table with the nid column, but also makes realm="domain_id". Nodes that are published to all domains get "domain_site" in that column and are being automatically excluded.
Comment #9
agentrickardThanks @scotthorn.
Comment #10
agentrickardProper status for the patch.
Comment #11
Mac_Weber CreditAttribution: Mac_Weber commentedIt seems to be working fine for value =
TRUE
.It is not working for value =
FALSE
because the view must useDisable SQL rewriting
. Disabling SQL rewriting also disables the changes the patch makes.Is it possible to override the access restrictions imposed by Domain and list the content from other domains in case value =
FALSE
?Comment #12
agentrickardContextually, no, I don't think so.
Comment #13
Mac_Weber CreditAttribution: Mac_Weber commented@agentrickard maybe in case of
FALSE
we could disable Domain module callinghook_query_TAG_alter()
. I did some tests disabling it, but the results in case of value =FALSE
still need to be reworked to return the correct list.I am not sure how to disable Domain module calling
hook_query_TAG_alter()
by depending of the value on this view filter. On my tests I did it on a custom module by usinghook_module_implements_alter()
. It was just for testing, of course.If it is not possible to disable the hook call, how about undoing the changes made by
domain_query_node_access_alter()
? - this ishook_query_TAG_alter()
Comment #14
agentrickardLook at the logic in domain_admin_filter(). domain_query_node_access_alter() only runs for very specific users under very specific conditions. Essentially, it only runs for user 1 and users who can "bypass content access." It is meant to help users with debugging/previewing.
And even then, it only runs if you enable the feature, which I added because the fact that some users/roles ignore node access rules was very confusing to some people.
If we wanted to disable it for a single query -- which I don't -- we would remove the static $return call in that function and set $conf['domain_force_admin'] = FALSE in the query method of the handler.
Comment #15
alexanderpas CreditAttribution: alexanderpas commentedA pragmatic solution might be to split the "published to current domain" and the "published on all domains" as 2 separate conditions.
This'll allow for more advanced options such as "published to current domain" AND NOT "published on all domains", or only those "published on all domains".
Comment #16
fredeee CreditAttribution: fredeee commentedHi
recently started using drupal 7.22 and DV 7.x-1.5.
just confirm have this issue using views.
when value set = true content/nodes do not display in views for users when have been flagged 'Send to all affiliates' in content settings.
as soon as check/flag individual domains in 'publish to' content/node displays ok to user.
have not tried applying the patch above at this point.
cheers
Comment #17
alexanderpas CreditAttribution: alexanderpas commentedPossibly Related: #1276694: Filter 'Domain Access: Available on current domain' - 'All Affiliates' issue
Comment #18
bibo CreditAttribution: bibo commentedIn my opinion #1276694: Filter 'Domain Access: Available on current domain' - 'All Affiliates' issue is definitely a duplicate of this (long standing!) issue. This one is almost 5 years old, while that one is "only" closer to 3 years.
I think this issue might still be the one that should be set as duplicate, because this patch, #19 is more complete and probably addresses more issues.