Disable extra fields in CCK for Drupal

There are times when you want to allow the Super Admin to edit those extra fields but not the editors/contributors of your site so this is one way to do it:

PHP:
    < ?php
    /**
    * Change the node form
    */
    function phptemplate_node_form($form) {
      // echo "<div style='direction:ltr;'>"; dprint_r ($form); echo '';
     
      // Hide 'Log message' text area
      $form['log']['#access'] = FALSE;
     
      // Hide the author collapsable box
      $form['author']['#access'] = FALSE;
     
      // Hide the publishing options collapsable box
      $form['options']['#access'] = FALSE;
     
      // Open the file attachments collapsible block in a full state
      $form['attachments']['#collapsed'] = FALSE;
     
      return drupal_render($form);
    }
    ?>

2 Responses to “Disable extra fields in CCK for Drupal”

  1. helmut

    this is exactly what i was looking for.. but where do i put this code?

    Reply
  2. George Calderon

    Thanks for the tip. This worked great!

    I would just add that you paste the code in the template.php file that belongs to the theme the developer is using.

    Reply

Leave a Reply