Im trying to figure out how to make a views block that gives me the top 5 products sales visible to anonymous users. This views need a filter 'orders status completed' (at least as i see the way it should work) and unless I give anonymous users the 'View any Order order' permission (which has security implications) they dont get the expected results. So if anyone knows a way via Views UI or programatically to get this one working i'll be gratefull for your thoughts.

Comments

Try the following,
There is an option in views to not take into account permissions when running the query (dunno if it is on the query level or display level though)

Edit your view > Right column "Advanced" > Query settings : check "Disable Query Rewritting"
--> Disabling SQL rewriting will disable node_access checks as well as other modules that implement hook_query_alter().

It worked for me.

thanks for the tip liupascal :)

Status:Active» Closed (fixed)

Anytime :-)

Category:support» bug
Status:Closed (fixed)» Needs review

Disabling Query Rewriting worked for me too but I don't think we should close the case, maybe moving it to a different category? Reason is everything worked ok with query rewriting enabled before update.

Category:bug» support
Status:Needs review» Closed (fixed)

There are other open issues dealing with this stuff in relation to Views, so I don't think we need to reopen / recategorize this one. Another issue pointed out that something has changed inside Views itself, so it will most likely be a documentation issue for Commerce.

Good point rszrama I'll keep you posted

subscribing

Hi rszrama. Can I enquire why this one is closed? So far as I know the sql rewrite/related products type issue is ongoing?

But if the issue has been resolved or the discussion still going on is there a link you could place in here for us? This ticket is referenced from lots of other tickets, for example, but I can't see any that have a better fix than disabling sql rewriting (with that security issue - whatever that exactly is too).

It would be great to know where this issue is being followed through and where/when a proper fix might materialise.

Thanks.

Colin

Status:Closed (fixed)» Closed (duplicate)

Many thanks.

I banged my head on the keyboard about this one for a bit. Your instructions worked.

Thanks, liupascal.

Thanks liupascal,
Your idea works for me when i use Drupal Commerce + quicktabs + Views altogether.

thanks a lot..u made my day... :)

Buenas, en mi caso, despues de varias pruebas. Agregue que el usuario anonimo puede ver cualquier producto de cualquier tipo y así funcionó.

Si solo pongo el tipo de producto involucrado en la consulta, no funciona. Idem para los demás roles que tengo creados.

Saludos.

thanks liupascal perfecto #1

Thanks!!! This worked for me as well. Is anyone worried about the warning message.

WARNING: Disabling SQL rewriting means that node access security is disabled. This may allow users to see data they should not be able to see if your view is misconfigured. Please use this option only if you understand and accept this security risk.

Issue summary:View changes

my english is baaad