views:

488

answers:

2

I'm trying to hide "Revision information" from my users who do not understand what that is in relation to this content type. I've read numerous posts online that suggest anything from changing a template to setting style="display: none". I'd prefer to actually remove the field from access so that injection techniques aren't still viable. I've done this by creating a hook_form_alter that sets $form['revision_information']['#access'] = false;. I've verified with Firebug that the method is indeed called, yet the form elements prevail. Any thoughts? Thanks in advance! Drupal rocks!

function recipe_form_recipe_node_form_alter(&$form, $form_state){
    if (isset($form['revision_information'])) {
        $form['revision_information']['#access'] = FALSE;
        firep(print_r($form['revision_information'],true));
        $form_state['rebuild'] = true;
    }
}
+1  A: 

Quoting marcvangend

Note that you can also hide the revision information with the correct settings; it will only show if the "Create new revision" option is checked, or if the current user has the "administer nodes" permission

This would probably be the easiest option.

Note: wiki answer as it is not my own

Jeremy French
A: 

/* below code added by tejas tank , [email protected] to disable the revision block from everywhere

*/ function phptemplate_node_form($form) { $form['revision_information']['#access'] = FALSE; return theme_node_form($form); }

kumar

related questions