Prevent users editing node titles
Is it possible 开发者_开发知识库to prevent a user from editing the title of a node on the node edit screen?
One of the things I really detest about Drupal is the rigidity of the title & body field in each node.
Two ways you can do this:
1) Write a hook_form_alter function to set #access to FALSE. This is really quick if you're familiar with writing modules, but if not, you'll probably prefer:
2) Use Automatic Nodetitles to hide the title field completely, create a standard text CCK field to replace it, and then use Content Permissions (which comes with CCK) to restrict access to the new field.
(Also, while the title field is indeed a pain to hide, you can hide the body field just by setting the label to blank.)
Expanding on the tip of hiding the body field, if you use CCK and turn on Content Permissions, you can set field-level permissions, and have a "body" field that shows / is editable however you set role permissions.
If anyone is still interested in drupal7, you can use [title module][1]
[1]: https://www.drupal.org/project/title and turn title to a text field, you then can use [field_permissions module][1]
[1]: https://www.drupal.org/project/field_permissions and set it up however you like by creating a custom permission. The combination of these two module is really flexible.
精彩评论