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.
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).
I went to /portal_setup and exported 'user schema' (which gives you a userschema.xml file)
I added the following to the userschema.xml file
<field type="zope.schema.Bool" users:forms="In User Profile"
I tar/zipped the file (on OS X / Linux this would be tar -zcvf myuserschema.tar userschema.xml
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:
- Add a new dexterity content type
- Add the fields you need to it (TTW, in the dexterity editor)
- Copy the fields (from there) to the user schema
- 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.