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
Description

When using more than one node type in the filter results do not appear.

#1

leon1638 - April 9, 2008 - 17:11
Status:active» needs review

/**
* 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

tsavino - April 14, 2008 - 13:15

I was wondering why it did not work with more then one node type.....

#3

nicholasThompson - May 25, 2008 - 20:23

Thanks Steven - I'll get this committed at some point (rather busy right now).

 
 

Drupal is a registered trademark of Dries Buytaert.