0

I have a content type with some fields created using cck module in Drupal 6 . I want user just fill in some of them in create content page and doesn't see others which will fill later by admin.

How can I do it in drupal 6 ? Is it possible ?

0

If they are fields that the user is not permitted to use then there is a module included with CCK called content_permissions.

If you install that then you can set role based permissions for each field on the permissions page.

If it is not an issue of access control, but you just want to hide some fields that once, you can implement hook_form_alter() in a custom module to do it.

It would go along the lines of this:

/**
 * Implementation of hook_form_alter(),
 */
function MODULENAME_form_alter(&$form, &$form_state, $form_id) {
  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {
    $node = $form['#node'];
    // Only for page content and only when adding a new node.
    if ($node->type == 'page' && empty($node->nid)) {
      // Hide the name field by restricting access.
      $form['field_name']['#access'] = FALSE;
    }
  }
}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.