'hidden' member field

I have added some 'Member fields' TTW, and I want to add one more (Bool), which should be not visible for the users (but visible for the admin).

Security is not 'super important', but is there a way to do this TTW.

I can do it with CSS, but a permission based solution would be better…

According to https://github.com/plone/plone.app.users, profile fields are extended via plone.schemaeditor and it can be set via plone.supermodel xml format. Permissions are set in xml via the sample code below. I think it is worth a try.

<field type="zope.schema.TextLine"
        name="one"
        security:read-permission="zope2.View"
        security:write-permission="cmf.ModifyPortalContent">
    <title>One</title>
</field>

You can also try form:omitted: https://github.com/plone/plone.autoform/blob/master/plone/autoform/supermodel.txt#L53

Thanks for your help.
This is what I did (in case someone else needs to do this one day…)

My site was live, so I wanted to do this TTW (through the web).

  1. I went to /portal_setup and exported 'user schema' (which gives you a userschema.xml file)

  2. I added the following to the userschema.xml file

     <field type="zope.schema.Bool" users:forms="In User Profile"
     name="myfield"
     security:read-permission="cmf.ModifyPortalContent"
     security:write-permission="cmf.ModifyPortalContent">
     <title>My title</title>
     </field>
    
  3. I tar/zipped the file (on OS X / Linux this would be tar -zcvf myuserschema.tar userschema.xml

  4. In /portal_setup/manage_tarballImport I chose 'myuserschema.tar' and imported it.

PS: In fact, I made a copy/paste of the site ( myzope:8080/manage_main ) and tested it on that first…

For the record I tested the trick but without the ZMI, by using edit as Xml in the Fields management of the Plone Control Panel. It worked but only half the time; now you see it, now you don't. After a few minutes of bewilderment i restarted both Zeo clients and everything was working fine, seems not is perfect in Plone Xml editor, but nice trick indeed @h2o ! Actually if there is only one field hidden in a tab the tab itself is not displayed, so it seems to work really well.

Cool! I may have a need for this in the future.

Slightly related: Reordering fields with the UI is sometimes not working (both with members, dexterity content types and collective.easyform, then you can use the same approach (or for dexterity/easyform TTW: edit the xml-schema TTW)

I have a local setup on my PC, I changed the xml and added a new field as mentioned in the link, but that change is not getting reflected, my newly added field is not visible on the Member Fields page,

I even rebuild using the following command, but of no help.

bin/buildout -c develop.cfg

I tested my suggestion on a fresh Plone 5.1 setup, and it works 'perfectly'. I did not even have to restart.
Maybe you have a typo in your field?

I would do the following:

  1. Add a new dexterity content type
  2. Add the fields you need to it (TTW, in the dexterity editor)
  3. Copy the fields (from there) to the user schema
  4. import it in Plone

(make sure you tar the new userschema.xml (not the old one).

I added security:write-permission and form:omitted to a userschema.xml field but neither work for me. Does anyone have this working on plone 5.2.4 py3 site?

My site does not exist anymore, so I am not sure where I have the code. That said: Do you see the 'omitted' when you export the user schema xml (from the site you added it), and did you restart (I remember I had to restart before it worked)

Hi @espenmn , yes I did restart. When I export the userschema the permissions and omitted params are missing. I changed the title to test and that is exported correctly.

I looked for my code, but (sorry) can't find it.

This is an open issue Read/write permissions · Issue #91 · plone/plone.app.users · GitHub

Thanks for logging it @fulv and for the workaround @1letter !

Just double checking... is there a TTW way to update userschema.xml?

I dont think that is possible. I would try: download it, edit it, 'tar' it and upload it (in portal/setup).

UPDATE: You might have to restart, too

Isnt' this what you are looking for?

@pigeonflight @espenmn

In my case, it should show 'depending on permissions'

I just discovered a workaround if it is enough to hide the field. This will likely not work via the schema editor UI since the "users:forms" field is required. But if you use a userschema.xml you can hide a custom field by setting an empty "users:forms" attribute. For example:

   <field name="some_field"
          form:after="another_field"
          type="zope.schema.TextLine" 
          users:forms="">

   </field>

The field will not appear in the registration and profile form for the user. However, all fields will be rendered for an admin account looking at a user's profile.