views:

27

answers:

2

I am using Drupal with Views and the extended profiles module activated. To enable users to check multiple areas of interest I also added a module called Profile Checkboxes. It adds the ability to use a free-form list but turns it into either check boxes or radio buttons.

This module works very cleanly and did not present errors. But if a user check multiple interests then those are stored in the profile_values table as a comma seperated value.

So if the user likes lets say cars, trucks and bikes. That is stored in one field of the database as:

+-----+-----+---------------------+
| fid | uid | value               |
+-----+-----+---------------------+ 
| 12  | 32  | cars, trucks, bikes |
+-----+-----+---------------------+

I want to be able to have views parse this correctly for me so that I can create filters that only shows users who have entered an interest. The options it gives me is to validate "if ant of" the values in the list is chose, I selected all the values in the list. But it only shows the users who have check one of the values. I hope it makes sense.

Do I need to code this in a custom tpl-file or can this be done with Views?

+1  A: 

You can do it with views, but in this case it will probably be a lot simpler to do it without views, unless you know the views API very well.

googletorp
I am not very proficient with the Views API - at all. But open to learn, I really like the things I'm learning in Drupal and want to build my knowledge of how to correctly take action. Would be kind and give me a hint as to where to start and think concerning the Views API?
WmasterJ
A: 

Simple (and not so correct way) is using "Contain" filter for this "value" field in Views, so it will query like: value like '%trucks%'
Other way (but not so good): removing unfiltered datas in hooks of views after it get data and trying output: See .\sites\all\modules\views\docs\docs.php file about hooks.

p.s. Views + CCK + Content Profile, i think, will better.

Nikit
Thanks,yea im new to hooks and not sure how to implement what your are saying could you elaborate?
WmasterJ

related questions