Closed (works as designed)
Project:
Drupal core
Version:
7.x-dev
Component:
node system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Feb 2007 at 15:42 UTC
Updated:
13 Sep 2017 at 17:41 UTC
Jump to comment: Most recent
Comments
Comment #1
RobRoy commentedIMO this should be a content types option so I'm setting to 6.x-dev, but for now you can create a module called remove_log_field.module with this:
Comment #2
Gabriel R. commentedHello RobRoy,
I created the .module as you suggested but it didn't work.
Ay other suggestion would be appreciated.
Comment #3
Anonymous (not verified) commentedSubscribing to post
Comment #4
RobRoy commented@Gabriel, is this in Drupal 5?
Comment #5
Gabriel R. commentedI m using Drupal 5.1 with no alteration of the core.
The module created as described above doesn't even appear on the modules list.
Thanks.
Comment #6
RobRoy commentedSorry, should have been more explcit. You'll need a .info file as well: http://drupal.org/node/101009.
Comment #7
zach harkey commentedIf you don't feel like creating and enabling a whole module for this, it's pretty easy to override the node form at the template level by adding the following function to your template.tpl.php:
Comment #8
Gabriel R. commentedThe template change worked great.
Thanks for your help guys!
Comment #9
RobRoy commentedComment #10
(not verified) commentedComment #11
skassam commentedAny idea how to override the same field on node edit also?
TIA,
Shinan
Comment #12
bsobolewska commentedI have tried to place the code within the template.php (is it the same as template.tpl.php?) but I got the following error:
Fatal error: Cannot redeclare phptemplate_node_form() (previously declared in D:\wamp\www\portal\themes\zen\template.php:7) in D:\wamp\www\portal\themes\zen\template.php on line 518
Where the code around line 518 is:
// Add Form Start
function phptemplate_node_form($form) {
if ($form['form_id']['#value'] == 'ugevent_node_form') {
return _phptemplate_callback('event_add', array('form' => $form));
}
if ($form['form_id']['#value'] == 'qanda_node_form') {
return _phptemplate_callback('qanda_add', array('form' => $form));
}
}
// Add Form End
Then I thought that maybe template.php is indeed not the same as template.tpl.php so created one in the same folder themes\zen but nothing happened (no error and no result).
I must say I always get the same sort of error whenever trying to override the existing functions.
What am I doing wrong?
greetings,
Bogumila
Comment #13
Anonymous (not verified) commentedThe easiest way may possibly be a hook_form_alter implementation in a module. For the $form_id matching node/create you simply set the '#type' to 'hidden' for the log message fields.
Comment #14
jefftrnr commentedIt looks like it works a bit differently in Drupal 6. It uses the same theme override function, but different keys in the $form array. I set it to a "hidden" type.
Does this look wrong to anyone? It seems to work. I put it in my template.php file.
Comment #15
Mac Clemmens commentedThanks - that did the trick for me!
I updated code just a bit to still be visible for people with the "edit post" permission:
Comment #16
chris_huh commentedI tried that (version 6.8) and it doesn't do anything. Is there something i might have done wrong?
Comment #17
chris_huh commentedActually it works now. i think it just needed a bit of time to go through.
Comment #18
jim0203 commented@Digital Deployment:
Your code:
Is cool, but I don't seem to have the "administer posts" privilege available in my (pretty standard) D6 installation. I've therefore changed the code to:
Which links the ability to see the "Revision information" drop-down in the node creation form to the "view revisions" permission.
Using this technique you can pick a permission at will; it would be pretty simple to write a module which just added a new permission (or permissions) so you could specifically turn off the "Revision information" section of the node creation form.
On that note, could someone verify how easy it would be to write a module that allowed users to customize what sections of the node creation form were visible? I'm guessing it's just a matter of transcribing this function for each area of the node creation form and then adding the appropriate permissions to the permissions array.
Comment #19
damien tournoud commentedThis is *ugly*.
The good place to do this is in a hook_form_alter() implementation, *NOT* in the theme system. It works only by chance (because the log field is not mandatory).
Comment #20
zach harkey commentedWhatever. The 'good' place to do this is through the core user interface. Specifically, in the main workflow settings for each content type.
Just like the upload module lets you enable/disable attachments, any module that adds optional fields to the node admin form should provide a way to disable the feature on a per content type basis.
Comment #21
raintonr commentedRe: #1
The D6 version of this is:
Comment #22
francewhoaAnother option is hiding 'Revision information' using CSS. To do so add the following style anywhere in your theme stylesheet file.
Note that this will hide all collapsible fieldsets. Not just 'Revision information' fieldset.
Comment #23
broonSince I was writing my own node modules for defining content types I stumbled upon this, too. But opposing to include this in the MYMODULE_form function, I'd prefer the hook_form_alter implementation. Additionaly, I want the fields still be usable and just hide them from certain users. Fusing RobRoys (#1) and Onopocs (#22) proposals I came up with the following function to be included in my node modules:
Note: There are two possible ways included to hide it from certain users. You may either restrict display by user ID (deactivated above) or by role of user (active way in above snippet). Just replace MYMODULE by your modules name and USER ROLE NAME by the name of the role which is allowed to see revision information and such collapsible fieldsets.
And don't forget to define the 'hideme' class in your templates css.
Comment #24
lias commentedThank you very much for this code, worked great in 5.x Amadeu theme!
Comment #25
misanthropisht commentedGood work.
In my case I wanted to know if my user had one of a number of possible roles so I changed the IF condition to
Comment #26
ginc commentedSubscribing
Comment #27
phayes commentedNote that after implementing this, I had an issue with the position of my 'save' and 'preview' buttons. Because the hook is modifying the array, it's shuffling the order - so any form element that doesn't have weight set explicitly is going to be misplaced. The fix is to add '#weight' to the elements:
Comment #28
flamingvan commentedI've created a module to do this: http://drupal.org/project/removelogmessage
Comment #29
jayson commentedThank you for the module, works like a charm!
Comment #30
flamingvan commentedOh cool I'm glad it worked for you!
Comment #31
albertski commentedThis worked for me!! :)
Comment #32
albertski commentedThis worked for me!! :) Thanks raintonr
#21
Posted by raintonr on March 26, 2009 at 4:38am
Re: #1
The D6 version of this is:
Comment #33
bnadem commented[quote=flamingvan]
I've created a module to do this: http://drupal.org/project/removelogmessage
[/quote]
Hi, Many thanks for the great work, but I had an issue using it ! (http://drupal.org/node/1203394)
Any suggestions please !
Comment #34
bnadem commentedHi, Many thanks for the great work, but I had an issue using it ! (http://drupal.org/node/1203394)
Any suggestions please !
Comment #35
giorgio79 commentedThis "Revision information" field does not make any sense on node creation. It should be removed from node create forms in core, not in contrib modules.
Comment #36
marcoBauli commentedagree with giorgio79. Has no sense on node creation form as a "new" node is not a "revision".
Comment #37
Anonymous (not verified) commentedThe revision field is fine for a new node as it is the initial revision. One could add notes for why the node was created. If you don't like it you can use a hook_form_alter in custom module to hide it.
Comment #38
SeanBannister commentedAlso the Jammer module allows you to remove it.
Comment #39
aaronbaumanThat's Jammer module.
Comment #40
jetwodru commentedYes, the Log Message is really CONFUSING, I don't see the purpose of it on a Node/Create but Node/Edit, it's better to have it configurable whether to show as per content type. Thanks
Comment #41
drupalfan81 commentedSweet! Wish I came across this thread earlier...would have saved a lot of headache.
@Jim0203 in #18...you're the man! This worked perfectly for me. I was trying to do this by roles and using a IF statement to check if the user was in a given role. It worked, but my save/preview/delete buttons would go to the top of the page for some strange reason. So I used your method, which is basically the same thing, just in a slightly different way.
@phayes in #27, wish I saw this earlier as well, I couldn't figure out what was going on and didn't know this would fix it. Well, I went with Jim's method and it didn't move the buttons around, so I just settled with his method. But good to know this could have fixed my issue if using my code for basing it on the roles.
Great thread...got things working the way I want them to now.
Comment #42
chsrikiran commentedFor D7 - to allow roles with 'View content revisions' permission can see this Revision Information field:
function CUSTOM_form_alter(&$form, &$form_state, $form_id) {
$form['revision_information']['#access'] = user_access('view revisions');
}