By kirilius on
How can I hide/disable some fields from the forms that users submit to create pages/stories/images/etc?
I am asking about the fields that are displayed by Drupal by default.
For example I want to hide the Log Message field, the "promoted" and "published" checkboxes, etc. How can I hide/disable a whole group of fields?
Can I do this for non-admins only?
Thank you!
Comments
...
These particular fields are not displayed for non-admin users. (only for users who have the "administer nodes" permission. And the "log" is probably displayed for those who have the "create revisions" permission, if such exists.)
You can easily hide fields using CSS: find the CLASS, or the ID, attribute (HTML speak) of the field, and add
.xx { display: none }to your stylesheet.You can also build a small module implementing hook_form_alter and in it attach
'#access' => FALSEfor undesirable fields.These particular fields are
To clarify, the "Log Message" field appears on the content creation forms for users to who have "administer nodes" OR for content types which have "create new revision" checked in admin->content-types. That latter detail was what had me confused for a bit, since I had some custom content types on whose creation forms ALL users were seeing the Log Message field, not just admin users.
Override theme function
Another way to hide 'Log message:' field is override the theme function: http://drupal.org/node/77246#comment-1043489
---
How to contribute to Drupal.