Pulldown parent list should use db_rewrite_sql
sergiocaridad - July 16, 2008 - 10:21
| Project: | Node Hierarchy |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The pulldown list of parents shown in node edit page should use db_rewrite_sql in the selection of possible parent nodes, so other modules may filter the results.
For instance, the i18n module could filter out parents from other languages, so in the list only nodes in the same language would be shown.
This happens in the function _nodehierarchy_get_parent_pulldown_items
<?php
function _nodehierarchy_get_parent_pulldown_items( $parent_id, $types, $child_node = null, $depth = 0 ) {
$out = array();
//Note the order of the tables. Switched "{node} n" to the last place so the rewrite would work ok.
$query = "SELECT * FROM {nodehierarchy} h, {node} n WHERE h.nid = n.nid AND h.parent = %d AND n.type IN (". implode( ",", $types ) .") ORDER BY n.title ASC";
// Added db_rewrite_sql so other modules may filter the query further
$result = db_query(db_rewrite_sql($query),$parent_id);
// ... rest of the function ...
?>
#1
Thanks for the heads-up, I'll get that taken care of as soon as I can
Ronan
#2
I've made that change in 5.x dev, thanks again
#3
Automatically closed -- issue fixed for two weeks with no activity.