A client requested to make a view downloadable and this module does the trick, even considering exposed filters. Many thanks for that.

However, I am stuck at a weird issue. It works perfectly fine for logged in users while anonymous user do get a CSV file, but it only contains the header row, thus the field labels. Anonymous can use the original view and the exposed filters alright and the data export display has the exact same parameters (except for the pager). Both views access is set to permission "view published content".

Since there are no dedicated permissions for Views Data Export module, I do not know what is happening or where to start. What could possibly be the cause for this behaviour?

Website is running on Drupal 7.50, export itself works and downloads file for anonymous users without any (error) message in watchdog. Downloaded file only contains the single header row (also checked with plain text editor).

Comments

Paul Broon created an issue. See original summary.

broon’s picture

Title: Data export is empty for anonymous users » Data export is almost empty for anonymous users - contains only header row
broon’s picture

I tried with all other export formats and it was always the same: authenticated users got a full export while anonymous got empty results (e.g. XML <nodes></nodes>) or just header lines (CSV).

Now, if I disable SQL rewriting under Query settings in the advanced settings of the export view, it actually does work, anonymous users can download the full view's content. I am not sure why this helps. Of course, the warning which comes up when disabling the SQL rewriting states

Disabling SQL rewriting will disable node_access checks as well as other modules that implement hook_query_alter().

But anonymous user can fully view the original view (which the export display is attached to) as well as the full node display of any content in that view. So, there shouldn't be any node access problem in the first place.

Due to this (for me) odd behaviour, I will leave the bug report open (otherwise I would have set it to works as designed). I don't fully understand what's causing this behaviour and where the apparent node access restriction is coming from.

audiomason’s picture

I just encountered this issue, as well. In my case, certain fields are excluded from the export for anonymous users. In particular, the URL alias for unpublished nodes is excluded.