[support] make title not editable

Hummel, Tracey S - (thummel) thummel at email.arizona.edu
Mon Aug 20 23:17:07 UTC 2012


I'm not sure this is the best way to accomplish this but it did work for me:

Create a custom module:

<?php
function modulename_theme() {
  return array(
    'page_node_form' => array(ls
         'arguments' => array('form' => NULL),
         'template' => 'notitle',
         'render element' => 'form',
    ),  );
}
?>

It the module's folder, create a template file whose names matches the "template" variable above [notitle.tpl.php] and contains:

<?php
global $user;
  if (in_array('support staff', array_values($user->roles))) {
    print  '<div style="display:none">';
    drupal_render($form['title']);
    print '</div>';
  }
?>
<?php print drupal_render($form['body']); ?>
<?php print drupal_render_children($form); ?>


Now anyone in the "support staff" role can not view/edit the title.

Tracey

--------------------
Tracey Hummel
Web Application Developer
University of Arizona
Social & Behavioral Sciences Technical Services
University Services Building, 888 N. Euclid, Room 302
PO Box 210158, Tucson AZ  85721-0158
520-626-3223
tracey at arizona.edu
http://tshummel.com
________________________________
From: Hummel, Tracey S - (thummel)
Sent: Monday, August 20, 2012 3:11 PM
To: support at drupal.org
Subject: make title not editable

In Drupal 7, I'm using the Node Clone module to create copies of nodes that get assigned to different users.  I'd like the user who gets ownership of the cloned node to be able to edit anything except the Title.

Is there any way to make the title field not editable by the owner of the node?

I tried creating a new CCK Title field and then used Auto Node Title to populate the default title field with this new CCK field.  I then used Field Permissions to only allow specific roles to update that CCK field.

It works great except when the node is cloned, any special characters in the CCK Title field get character encoded.

Original node title:
Conjunctions "et", "mais" and "ou"

Cloned node title:
Conjunctions &quot;et&quot;, &quot;mais&quot; and &quot;ou&quot;

Any ideas?

Thank you,
Tracey

--------------------
Tracey Hummel
Web Application Developer
University of Arizona
Social & Behavioral Sciences Technical Services
University Services Building, 888 N. Euclid, Room 302
PO Box 210158, Tucson AZ  85721-0158
520-626-3223
tracey at arizona.edu
http://tshummel.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120820/b68ee453/attachment.html 


More information about the support mailing list