Does your Drupal views combine filter appears to be case sensitive?

Standaard

It seems to be an issue with MySQL wich is possible to ignore by adding the following code. Just create a module and add a hook_views_query_alter in your module:

function yourmodulename_views_query_alter(&$view, &$query) {
  // Find all combine fields and make them case insensitive.
  foreach ($query->where as $group_key => $group) {
    foreach ($group['conditions'] as $key => $condition) {

          if (is_string($condition[‘field’]) && (preg_match(‘/:views_combine/’, $condition[‘field’]))) {

            $query->where[$group_key][‘conditions’][$key][‘field’] = $condition[‘field’] . ‘ COLLATE utf8_general_ci’;
        }
    }
  }
}

More info can be found on:

https://drupal.org/comment/7998079#comment-7998079

Advertenties