2

I would like to hide certain CCK fields on the edit form of the user's content profile. Showing them without editing is done by a custom page. The problem is that if the user edits his content profile node all fields are displayed.

Already tried these:

  • field permissions module
  • content permissions module
  • profile permissions module

but no one worked as expected..

do you have any suggestions what to do?

  • Are you using content profile module ? If so content permission module should work as expected, it gives you the option to allow view and/or edit on each CCK field per role. – tostinni Aug 10 '11 at 14:00
  • yes, I'm using content profile module. if you say so I'll give content permission module a second try.. – jabal Aug 10 '11 at 14:07
  • thanks tostinni, it works now, I don't know what did I wrong last time. Please add your help as an answer so that I can accept it. – jabal Aug 10 '11 at 14:18
1

I'm not familiar with content profile and it suprises me that there's not an option to hide edit fields. But if you are comfortable with a little coding, a common way would be to create a small module that implements hook_form_alter() along these lines:

/**
 * Implements hook_form_FORM_ID_alter()
 *
 * @todo Double-check the form name is profile_node_form.
 */
function mymodule_form_profile_node_form_alter(&$form, &$form_state) {
  // Hide the my_field field on the edit form.
  $form['my_field']['#access'] = FALSE;
}
2

Content permission can be quite tedious, because once it's installed you have to configure every single CCK field's permission both for view and edit. While you're connected as the admin you will always see everything but you have to test this with a normal user.

However if you just want to hide your field you can do this in several ways.

0

You can try http://drupal.org/project/computed_field Although this requires some php, but it has no field on the node edit form...

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.