I was scratching my head for a bit on this one but eventually I found this before db_query in database.inc:

 *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
 *   in '') and %%.

Then I modified the following lines in the site_user_list.module

      if (isset($module_search_restrictions['where'])) {
        $sql_options['where'][] = '(' . $module_search_restrictions['where'] . ')';
      }

to:

      if (isset($module_search_restrictions['where'])) {
      	$module_search_restrictions['where'] = str_replace("%f", "%%f", $module_search_restrictions['where']);
      	$module_search_restrictions['where'] = str_replace("%s", "%%s", $module_search_restrictions['where']);
      	$module_search_restrictions['where'] = str_replace("%d", "%%d", $module_search_restrictions['where']);
      	$module_search_restrictions['where'] = str_replace("%b", "%%b", $module_search_restrictions['where']);
        $sql_options['where'][] = '(' . $module_search_restrictions['where'] . ')';
      }

Looks good now, tell me if anything needs adjustment.

Comments

pukku’s picture

Assigned: Unassigned » pukku

Hi! Wouldn't it make more sense to just replace every instance of '%' with '%%'? At least, if you're trying to do what I think you're trying to do, which is to let searches include '%' characters?

foysavas’s picture

Status: Needs review » Closed (fixed)

Ha! Yep, that works too.

( I hope this bug report can serve as a bit of lost documentation for others. See Also: http://drupal.org/node/100846 )