Discovered as part of an upgrade to 2.x that the permission situation had changed in a way that broke when using a private number field with Bio (ie with user registration fields.)

The field in question worked with 1.x but upgrading to 2.x, the field disappeared and became a hidden field.
No combo of access permissions (that made sense and were also secure) would allow the anonymous user access to the field to create the new user's private field.

The fix was pretty simple, and a big thank you for the ability to fix this via a hook (change the specifics in the below IF statement to match your own situation)

function customsite_private_number_access($op, $node, $field, $user){
  if ($op == "edit" && $node->type == 'biotype' && $field['field_name'] == 'field_privatenumber' && $user->uid == 0){
    return TRUE;
  }
  return FALSE;  
}

Comments

john.money’s picture

Status: Active » Closed (works as designed)

Sounds like perfect use case for the hook private_number_access()... nice!

I'm going to mark this by design unless you think that the permissions (particularly view own private number) are not working the way it should. Allowing anonymous users to view own private number would effectively allow any user to view the number, so I think your use of the hook sounds about right.

mattrweaver’s picture

I'm having this problem with D5 version. Where does that snippet above go? In the php validation, or in the .module file?