Archive | Drupal RSS feed for this section

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);
    }
    ?>