I needed to use set_relation_n_n but include a where clause. There are a couple of posts that actually state to pass the where clause as the 8th parameter in the set_relation_n_n() function.
Its included in the set_relation_n_n function in grocery_crud.php:-
$this->relation_n_n[$field_name] = (object)array( 'field_name' => $field_name, 'relation_table' => $relation_table, 'selection_table' => $selection_table, 'primary_key_alias_to_this_table' => $primary_key_alias_to_this_table, 'primary_key_alias_to_selection_table' => $primary_key_alias_to_selection_table , 'title_field_selection_table' => $title_field_selection_table , 'priority_field_relation_table' => $priority_field_relation_table, 'where_clause' => $where_clause );
BUT... its missing in the function relation_n_n_queries() in grocery_crud_model.php.
So I added it below.
grocery_crud_model.php line 123 for function relation_n_n_queries($select):
$select .= ", (SELECT GROUP_CONCAT(DISTINCT $field) FROM $selection_table " ."LEFT JOIN $relation_table ON $relation_table.$primary_key_alias_to_selection_table = $selection_table.$primary_key_selection_table " ."WHERE $relation_table.$primary_key_alias_to_this_table = `{$this->table_name}`.$this_table_primary_key AND $where_clause GROUP BY $relation_table.$primary_key_alias_to_this_table) AS $field_name";
Can you check, confirm, and add it in, so I dont have to keep a modified version of grocery_crud?
I am using version 1.3.3, I upgraded earlier today.
Thanks