Hi,
I'm trying to implement db_rewrite_sql() on all my sql queries that list nodes in the faq module so as to properly support i18n localization. It all works correctly when viewing the FAQ page and nodes but the list of nodes which appears on the faq weighting settings page is not correct. The problem is the query is not being rewritten with the left join on the i18n table. However, when I copy the query to a different function it is rewritten. The query is being run in faq_weight_settings_form() in the 2nd part of a multi-part form. The call is below:
$result = db_query(db_rewrite_sql("SELECT n.nid, n.title, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {faq_weights} w ON n.nid = w.nid AND w.tid = %d WHERE n.type='faq' AND n.status = 1 ORDER BY weight ASC, n.sticky DESC, n.created DESC", "n", "nid"), $category);
I'm wondering if it's not being rewritten because it's in a form function? If anyone wants to try it out for themselves, just checkout HEAD from CVS for the faq module.
All help is appreciated!
Cheers,
Stella
Comments
Comment #1
jose reyero commentedHI Sheila, I've just seen the email in the dev list. I understand this is i18n module related so moving this issue to that module.
The thing is i18n module doesn't rewrite queries for some paths, mostly administrator related, for the admin to have access to all content, and also has some other conditions for some known paths.
So, can you tell me the path of that page with the settings form?
Comment #2
stella commentedHi Jose,
The path is admin/settings/faq/weight I need the sql which displays the list of nodes in the form to be rewritten so it supports internationalisation. Let me know if you need any more info.
Cheers,
Stella
Comment #3
jose reyero commentedI've restricted the path for which language was not applied to admin/content paths, so it should be ok now
Comment #4
stella commentedYep, that works perfectly. Thanks!
Comment #5
(not verified) commented