Hi,

Firstly: thanks for this module, it's very helpful for a project I am working on!

The project I am working on has social network aspects to it, so I need this to control which fields are visible for others, and which aren't. This module currently shows a checkbox next to a field for the user to toggle visibility. I actually need an option form element (select), as the user should be able to set the privacy setting gradually: 'not visible', 'visible for friends', 'visible for friends of friends', etc.

Currently, the record in the table is set using an integer, 1 or 0. I actually need it to be in a range [0..n]. For this, I needed to adjust the hook_exit to save the value of $privacy_state, rather than just 1 or 0, and alter the hook_field_access to adjust the gradual permissions. Turning the checkbox into a select could be done with a form_alter.

I will check to see to create a patch, for now I just wanted to let you know that this might be a nice feature :-)

Comments

boonep’s picture

I'm looking for the same feature. May make a fork of this module for my own purposes. I'll post any updates here.

obsidiandesign’s picture

With multiple-level granularity, would this module become a replacement in D7 for the following two modules (I only ask because I'm the creator of one of the two and wonder if my time would be better spent helping in this issue rather than trying to bring my own module up to D7):

http://drupal.org/project/cck_field_privacy and
http://drupal.org/project/cck_private_fields

are two modules for D5/D6 dealing with field-level permissions set by the user.

boobaa’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Component: Code » Miscellaneous

I like the idea, and though I have never used any of the aforementioned modules myself yet and only skimmed their project page fast, it seems that the functionality cck_fields_privacy could be added to this module. Anyway, I haven't seen the actual code itself yet, so I don't know how difficult it would be. Patches welcome, as always, though. :)

memoo’s picture

Looking for the same feature. @ Martijn and boonep; if possible, share your patches please

caschbre’s picture

I've actually been considering creating a new module that would offer functionality similar to what's being talked about here. It sounds like if this module is going to build it then there's no reason for a duplicate / similar module. At a high level, here's what I was thinking...

From an administration perspective...
- a site builder can create 'schemes'. Basically these can be nothing but the values (all users, authenticated, members-only, etc.) that show up in a drop-down.
- these 'schemes' then appear as permissions ('can view ') which can be assigned to roles.

From a user perspective...
- for each field the user can (multi)select one or more schemes that the field applies to.

Then when it comes to rendering the field, the viewing user's role is compared against the field's scheme / permissions.

I think an advantage for having 'schemes' like this is a step to providing an API for modules like user relationships to create schemes and hook into the function that determines if a field can be viewed.

Ghostthinker’s picture

@cashbre I had the same idea and tried get in touch with some people but it seems to everybody is busy. I created exactly what you
described in #5

https://drupal.org/sandbox/Ghostthinker/1691678

http://drupalcode.org/sandbox/Ghostthinker/1691678.git/blob/HEAD:/user_f...

Just note: The code is not yet cleaned, the naming (user_field_access) is stupid and the api demo is sexist.... :)

caschbre’s picture

Great work @Ghostthinker! I'll check it out!

warmth’s picture

I think this can be done by adding User Relationships support to this module as has been requested here: #1827042: User Relationships integration (I suppose #6 is all about this based on its sandbox page description).

Update 1: I just tried #6 and I got this error:
Notice: Undefined index: user_field_access en user_field_access_field_access() (línea 343 de /home/WEBSITE/www/SUBFOLDER/sites/all/modules/user_field_access/user_field_access.module). Reported: #1878104: Error after installing

Update 2: I have my Drupal installation in a subfolder (i.e. www.WEBSITE.com/SUBFOLDER) and the images are not found. Reported: #1878112: Image paths wrong acquired

Update 3: The select box is not properly placed when using Display Suite to place fields in 2 columns. Reported: #1878174: Wrong position of the select box when using DS

Update 4: Arrows won't show. Reported: #1878182: Arrows won't show

Update 5: I think that a module like this can't ignore the presence and settings of one like Field Permissions because if they are not synced they can interfere with each other. Suggested: #1878188: Field permissions integration

Update 6: Issue when the privacy select is set between Address Field and Avatar Selection. Reported: #1878206: Address Field & Avatar Selection issues

warmth’s picture

Any changes of merging User Field Access with User Field Privacy and fixing the bugs?

Just found a new funny bug: #1930750: With permission set to "Friends" field won't show on your own profile