Needs work
Project:
User Field Privacy
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Feature request
Assigned:
Reporter:
Created:
2 Jun 2014 at 17:33 UTC
Updated:
20 Feb 2015 at 00:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dpalmer commentedPatch
Comment #2
dpalmer commentedComment #3
dpalmer commentedComment #4
dpalmer commentedComment #5
dpalmer commentedComment #6
erwangel commentedExcellent! Exactly what I was looking for. And it works !
Here are some suggestions for improvement :
1) Default value is set by _user_field_privacy_value which looks for it in the database or returns nothing. If user doesn't set one in all fields, there is an sql error while validating the settings page.
My (dirty) changes in user_field_privacy_settings_form():
2) User roles are hardcoded in user_field_privacy_settings_form() and user_field_privacy_field_access(). This way only the two core values are processed (1 = anonymous/public and 2=authenticated, 0=private)
$privacy = array(0 => t('Private'), 2 => t($member_role->name), 1 => t('Public'));a) admin cannot set the privacy settings to a given user. There is no "Edit Privacy Settings" tab/button and if you try to access to [site.com]/users/[user_id]/edit/privacy as admin you get an "access denied / not authorized to access this page"
b) if you have more than the core roles, they will not appear in the settings choice
Possible solution: request the available roles in the database and rebuild the above line according to dbquery results
Comment #7
dpalmer commentedThanks erwangel, I will implement those fixes and a few others this weekend.
Comment #8
erwangel commentedCool!
Comment #9
dpalmer commentedpatch
Comment #10
dpalmer commentedI apologize for the delay, I have been busy transitioning my employment.
Anyways, here is a patch with the suggested changes and improvements. Please test.
Comment #11
apmsooner commentedCan't get that patch to apply cleanly.
Fails at line 106 for me.
Comment #12
apmsooner commentedSorry for previous post. I didn't initially apply the patch against dev branch. I tried that and it applied cleanly. The revised interface is a great improvement! Not sure about the "authenticated user" option however as my existing users might not know what exactly that means but... i can live with it.
Comment #13
apmsooner commentedFound some issues:
1. Need an "Access User Field Privacy Settings for all users" permission. Otherwise, only the user can edit their privacy settings.Looks like there is a permission "Access private fields" but its set under the field permissions module. Maybe thats the issue i'm seeing and in line with https://www.drupal.org/node/15594602. If no fields are set for privacy settings, the tab on edit user profile still shows and this error appears on page load:
Notice: Undefined variable: user_field_privacy in user_field_privacy_settings_form()3. If a field is set for privacy settings, no other user other than administrator can view the field regardless of the setting. If set to public, it should be public to all users... it currently isn't obeying the default value on install. It appears however to set when the user edits their privacy settings though and saves so i think the issue is there is no value being set initially in the database perhaps which means null means hide.
Comment #14
apmsooner commentedTried the patch in #1.... still get access denied to other users privacy settings as admin.