Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal Views - Custom / Modded SQL

I am having an issue with the "Profile Checkboxes" module which stores custom profile fields comma separated.

The issue is if I create a view to filter by a value. The SQL result ends up being something like this:

...AND (profile_values_profile_interests.value in ('Business and Investment'))...

Which will not return any data since the value is stored like this:

"Business and Investment, Case Law, Labor Law, Tax Law"

I just need to adjust the SQL so that it is making sure the field contains the selected value

Is there anything I can do to adjust this?

like image 570
kilrizzy Avatar asked Feb 13 '26 11:02

kilrizzy


1 Answers

For a 'quick hack' solution, you could try implementing hook_views_query_alter(&$view, &$query) in a custom module, check $view->name (and eventually also $view->current_display) to ensure you are dealing with the right view/display, and then manipulate $query as needed.


EDIT: Looks like the underlying problem has been addressed by the module maintainer in the meantime - see John's answer ...

like image 154
Henrik Opel Avatar answered Feb 14 '26 23:02

Henrik Opel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!