Hi,

When I've i18n enable, this one use db_rewrite_sql to add the language negociations conditions. Because of this, the autocomplete on subqueue for another language than current one, doens't work.

Here you can find a Patch that doesn't use db_rewrite_sql and check the rights with node_access instead.

Comments

stijndm’s picture

Status: Active » Needs work

I have two problems with this solution:

1. There's a node_load

2. Say there are 20 results, you don't have access to the first 10, but you do have access to the next 10 you won't get any results because the query is limited to the first 10 which are the filtered based on node_access

We have to either prevent locale/i18n from doing anything with the query, or we have to leverage node access by ourselves on the query level.

stijndm’s picture

Looking at the i18n code we could achieve this simply by adding i18n_selection_mode('off') before the query. For good measure you could do i18n_selection_mode('reset') after the query, but since it's an autocomplete I don't think this is necessary.

Will try and implement it soon.

yvmarques’s picture

Status: Needs work » Needs review
StatusFileSize
new876 bytes

Hello,

You right, I didn't think about this. I check the code from i18n too and instead of use i18n_selection_mode, I suggest to add view in args.

What do you think, patch attached ?

Regards,

stijndm’s picture

I think I still prefer the i18n_selection_mode() solution since it was specifically made as part of the API to programmatically override the selection mode:

Allows several modes for query rewriting and to change them programatically.

The view argument is targeted at views, if something in the views api changes, or this arg isn't required anymore... the autocomplete might break. I think the i18n_selection_mode() method is less likely to change.

stijndm’s picture

Status: Needs review » Fixed

Commited to dev release

Automatically closed -- issue fixed for 2 weeks with no activity.