I'm working on this site: http://backdrop-projects.simplo.site/ and it has a node for every Backdrop CMS contrib project. 

I would like to allow community members to login and edit certain fields on nodes. I've enabled the field permissions and restricted access for most fields that I do not want edited by anyone. However, I'm not seeing a way to set permissions on editing the node title. 

In theory, only a site manager should be able to change the title of the node. 

Do I need another contrib module or how can I disable the editing of node titles by some roles?

Accepted answer

I seem to have found a solution in an existing contrib module. It is Display Suites. 

I've been told on numerous occasions that Display Suites is mostly ready for use, despite the fact that there is no official release yet. With Display Suites you are able to easily hide fields on the node edit form. I've done some brief testing and it seems to be working without generating any errors. 

This is not an ideal solution, because as far as I can tell, I am not able to hide the title field based upon role. It seems that I hide it for everyone. In my use case, this is probably fine since nodes are generated by feeds and I don't expect to ever change their titles. 

If I do need to change their titles as admin, I'll simply need to reveal the field long enough to edit it. 

NOTE: You do need to enable the Display Suites Forms sub-module for this feature.

Comments

I think I've had this problem or something like it before and the best solution that I was able to come up with was the following:

1) Create a new "title" field and call it something different. Example: Name

2) Use a module like https://backdropcms.org/project/auto_nodetitle or https://backdropcms.org/project/auto_entitylabel to HIDE the title field and automatically generate titles based upon tokens or even the new NAME field. 

Then I can use the field permissions module to allow the new node NAMES at node creation, but to disable them for other roles. The real titles will auto-generated and never visible or editible. 

This seems like a bit of a hack, but I think it gets me what I'm looking for.

I believe https://github.com/backdrop-contrib/title may do something similar, but instead of duplicate fields, it just converts the node title into an actual field. This may allow Field Permissions to work properly, but I haven't tested.

@BWPanda - Thanks very much for the suggestion (Title). I do remember seeing this module before. However, there is no release for this module and when I tested it, it generated serious errors. In my opinion, it is not ready for use.

I seem to have found a solution in an existing contrib module. It is Display Suites. 

I've been told on numerous occasions that Display Suites is mostly ready for use, despite the fact that there is no official release yet. With Display Suites you are able to easily hide fields on the node edit form. I've done some brief testing and it seems to be working without generating any errors. 

This is not an ideal solution, because as far as I can tell, I am not able to hide the title field based upon role. It seems that I hide it for everyone. In my use case, this is probably fine since nodes are generated by feeds and I don't expect to ever change their titles. 

If I do need to change their titles as admin, I'll simply need to reveal the field long enough to edit it. 

NOTE: You do need to enable the Display Suites Forms sub-module for this feature.

If you are up to creating a small custom module, I would implement hook_form_FORM-ID_alter() (for example for Page nodes hook_form_page_node_form_alter(&$form, &$form_id)) and simply set the title's #access key to false when the logged in user has a specific role.

I would probably also assign a generic title to the node (like "Empty" or "Dummy") so that the saved node actually has a title (though not required from the database point of view, it's a bit confusing not to see a title when viewing a node).

As in:

function testing_stuff_form_page_node_form_alter(&$form, &$form_state) {
  global $user;
  if (!user_has_role('a_role')) {
    $form['title']['#access'] = FALSE;
    if (empty($form['#node']->title) {
      $form['title']['#default_value'] = 'Empty';
    } 
  }
}
 

[EDIT: changed my example code slightly to respect previously set title for a node that's being edited.]

@argiepiano - Display Suites is working for now, but I think I would be interested in trying to do this in a custom module. Your sample code looks like it will get me most of the way.

To clarify, my nodes have titles and it's not really that I need to hide the title. What I need is to hide or disable the ability to edit the node title. My current solution is to simply hide the node title field on edit forms, but show it on the node view page. 

I can use the field permissions module to disable edit capability for all other fields, just not for the title.