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 "et", "mais" and "ou"
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@arizona.edu http://tshummel.com
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@arizona.edu http://tshummel.com ________________________________ From: Hummel, Tracey S - (thummel) Sent: Monday, August 20, 2012 3:11 PM To: support@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 "et", "mais" and "ou"
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@arizona.edu http://tshummel.com
On Aug 20, 2012, at 4:17 PM, "Hummel, Tracey S - (thummel)" thummel@email.arizona.edu wrote:
Now anyone in the "support staff" role can not view/edit the title.
No, that just means that they can't see the form field, but there is nothing preventing them from posting such data and the form would gladly accept such data.
A better approach would be to use the #access property from hook_form_alter(). __________________ Michael Prasuhn 503.512.0822 office http://mikeyp.net
I was thinking of the "#disabled" attribute.
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Michael Prasuhn
No, that just means that they can't see the form field, but there is nothing preventing them from posting such data and the form would gladly accept such data.
A better approach would be to use the #access property from hook_form_alter().
There's also AutoNodeTitle. I'd link to it, but either my internet is tired, or D.O is sleepy. It allows you to hide the title field and use tokens to create a title.
Joel
From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Ms. Nancy Wichmann Sent: Monday, August 20, 2012 8:23 PM To: support@drupal.org Subject: Re: [support] make title not editable
I was thinking of the "#disabled" attribute.
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
________________________________________ From: Michael Prasuhn
No, that just means that they can't see the form field, but there is nothing preventing them from posting such data and the form would gladly accept such data.
A better approach would be to use the #access property from hook_form_alter().
I'm not familiar with the node clone module, honestly, but would a combination of hook_form_alter (to disable the field) and hook_node_presave (to act as a 'catch-all' to either override the title or insert your own custom title) work?
I don't know if node_clone.module injects some way to determine if the new node is a clone or such, unfortunately.
Regards, Todd
On Aug 20, 2012, at 6:11 PM, "Hummel, Tracey S - (thummel)" thummel@email.arizona.edu wrote:
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 "et", "mais" and "ou"
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@arizona.edu http://tshummel.com -- [ Drupal support list | http://lists.drupal.org/ ]