Node type filter problem
leon1638 - April 8, 2008 - 22:04
| Project: | Node Quick Find |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
When using more than one node type in the filter results do not appear.

#1
/**
* Autocomplete callback
*
* @param mixed $delta
* Provides the unqiue ID for the block provided by this module
* @param string $string
* The string to lookup
*/
function node_quick_find_autocomplete($delta = 0, $string = '') {
$settings = variable_get('node_quick_find_' . $delta, array());
$matches = array();
if ($string) {
$string = strtolower($string);
if (empty($settings['node_types'])) {
$result = db_query("SELECT title FROM {node} WHERE title LIKE '%s%%' LIMIT 10", $string);
}
else {
$place_holders = substr(str_repeat(",'%s'", count($settings['node_types'])), 1);
$arr = array_merge($settings['node_types'], array($string));
$result = db_query("SELECT title FROM {node} WHERE type IN ($place_holders) AND title LIKE '%s%%' LIMIT 10", $arr);
}
while ($node = db_fetch_object($result)) {
$matches[$node->title] = check_plain($node->title);
}
}
print drupal_to_js($matches);
exit();
}
#2
I was wondering why it did not work with more then one node type.....
#3
Thanks Steven - I'll get this committed at some point (rather busy right now).