Active
Project:
Content Construction Kit (CCK)
Version:
6.x-2.9
Component:
nodereference.module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
6 Oct 2012 at 17:54 UTC
Updated:
6 Oct 2012 at 17:54 UTC
I'm using the following code so that I can search by a field when using node reference. However when I go to save I get the error
this post can't be referenced
function flat_view_views_query_alter(&$view, &$query) {
if ($view->name == 'ref_flats') {
// Remove the original title constraint
unset($query->where[0]['clauses'][1]);
// Duplicate the argument (keyword to search for), so
// it is passed to both the title and the other field
$query->where[0]['args'][] = $query->where[0]['args'][1];
// Add the custom where clause
$view->query->add_where(0, "(node.title LIKE '%%%s%%' OR node_data_field_flat_code.field_flat_code_value LIKE '%%%s%%')");
}
}