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

Comments

Anonymous’s picture

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();
}

tsavino’s picture

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

nicholasthompson’s picture

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

nicholasthompson’s picture

Status: Needs review » Closed (fixed)

This is fixed in D6... D5 is no longer supported.