Sim
Sim

Reputation: 813

How to filter by User Profile custom field in Drupal Views?

I have a set of records which 1 column called "Site" (I used CCK for this)

I want some user to access Site A data while others just access Site B

I enabled Profile module, add a custom field called Site, then for user 1, I set the value of that Site field to A, and for user 2, I set it to B

However, I don't know how to specify the Filters in Drupal Views to compare that "Site" field in CCK object with the "Site" field in the Profile of current logged in Users

Anyway to do this or any other equivalent way to restrict access to data based on custom fields in User Profile ?

Thanks

Upvotes: 1

Views: 1583

Answers (1)

bkildow
bkildow

Reputation: 5153

You might want to check out the content profile module: http://drupal.org/project/content_profile. It allows you to create a new content type to extend the user profile. With this, content profiles are essentially nodes and will give you more flexibility within views.

Also, I'm not sure I completely understand your problem. You state:

I want some user to access Site A data while others just access Site B

This sounds like you need to set up different roles to assign users and use one of Drupal's access control modules like content access:

http://drupal.org/project/content_access
http://more.zites.net/content_access_for_drupal_6

Upvotes: 1

Related Questions