Creating a custom content type in drupal - drupal

i tried to create a custom content type in drupal but unnecessary features like Title, Menu settings, and Revision Information, URL aliases come with it which i don't really want ..coz it doesn't mean anything to the user..
how can i hide all those things, just preserving the fields(say only 3 fields from CCK) that i want only for this custom content type??
thanks..

You can automatically generate titles using the auto_nodetitle module, which also enables you to remove the title field from the node submission form.
As others have mentioned above, most of the other form elements don't appear to non-admin users anyway.

With auto_nodetitle module, you can hide it, not remove it. Then, simply assign a title like "your-content-type-nid", so it will be different for each node (nid will be different).
That would be a better title than an empty one.

You will need to do a combination of things to do what you want. One of those is to add the module auto_nodetitle suggested by others. You can hide the "Body" by removing the "Body field label" from the edit screen for your custom content type. Lastly is that you will have to do the right settings for your CCK fields.
If you have CCK fields you want them to be able to edit and others you do not want them to edit, you will need to enable the Content Permissions module in the CCK section of the modules admin page. Once you've done that, you can go to the role permissions page and set what roles have access to which fields. While permissions can potentially hide CCK fields from the user, you can also control what fields are in the teaser, node, and RSS views via the "Display fields" section of your content type editing screens.

Menu settings, revision info and URL alias type info is admin stuff. If you create a new user that doesn't have admin permissions, I'm pretty sure they won't see it.

Can try some thing like below using hook_form_alter.
function my_module_form_alter(&$form, $form_state, $form_id) {
if($form_id='company_node_form'){
$form['menu']['#prefix'] ='<div style="display:none">';
$form['menu']['#suffix'] ='</div>';
$form['revision_information']['#prefix'] ='<div style="display:none">';
$form['revision_information']['#suffix'] ='</div>';
$form['author']['#prefix'] ='<div style="display:none">';
$form['author']['#suffix'] ='</div>';
$form['options']['#prefix'] ='<div style="display:none">';
$form['options']['#suffix'] ='</div>';
}
}

You might want to try the NodeFormCols module. It does several handy things, among them is to add a Manage Form button which allows you to hide most fields in an input form.

Related

Wordpress Custom Content Types

After long research, no answer or hints about this question seems to be available.
I want to have multiple image custom content types. But how to add them with jQuery? I want an option that add dynamically multiple image custom content types when you are in the user interface to add new content.
You have the custom content type in front of you: My
You want add a new one
You give it a description, and want to add an image
Here comes my question: You add an image and you click a button to add another image input field (in the backend)
I hope you can help me with this.
Edit: To be more specific, where, in which file do I implement the jQuery functionality to dynamically add more image upload fields. I have no clue where to implement it.
Are you referring to the back-end user (using wp-admin) or a front-end user (using your actual wordpress ite)?
You can use gravity forms ( http://www.gravityforms.com/ ) in combination with this plugin http://wordpress.org/extend/plugins/gravity-forms-custom-post-types/ to create a front-end form that will allow a user to create a new taxonomy term as well as submit an image.
On the backend there is a great plugin to create duplicate fields which would allow you to do what you're describing as "You add an image and you click a button to add another image input field (in the backend)"...It's called magic fields http://magicfields.org/
What about http://podsframework.org/ its nice framework for handaling custom content type.

How to customize content type forms depending on the access

Is there a way to customize a edit page form in Drupal depending on the menu link ? (or by passing additional parameters to the edit page url ?
i.e. I have a children "Add new product" item in both menu items "Catalog1" and "Catalog2".
I want to hide 2 different CCK fields in the product content type depending on which menu item has been clicked.
Or eventually can I pass parameters with the url ? and use these parameters in hook_form API to decide which CCK field to hide ?
Thanks
You probably want http://drupal.org/project/prepopulate.
Hiding the fields, however, is a different thing. You will need to create your own module that uses hook_form_alter to change the type of tields from text/input/select to hidden.
You can try http://drupal.org/project/conditional_fields to hide the CCK fields too.
I've actually solved by passing an additional php parameter from the menu item "Add Product" stating which catalog it should belong to.

Novice to Drupal: How to add custom form fields to Profile in Drupal

Thank you in advance. I am new to Drupal, and I am presently working on Drupal Profile Module. I have couple of questions..
1.Can I add a Custom form field to the Profile module, such that I want a check box field combined with text box. So that when the check box is clicked the text entered in the text box has to be displayed in the Profile page?
2.Can I create sub Category of within a category for better display of data? (something similar to ABOUT YOU is main category and General Info, education, profession are sub categories. Each sub category has Form fields like text boxes, check boxes etc.)
Please help.
1. Yes, perfectly possible. You can go the quick and easy way, using Drupal core's profile module. Enable that and under "Administer » users » Profiles" configure, add and remove fields you want during registration and/or user-editing actions. After that, you can use the value of a checkbox in your theme to display a text. Copy user.tpl.php from /modules/user/user.tpl.php if it is not already in your theme.
<em>... HTML ...</em>
<?php if ($user->name_of_checkbox_field) : ?>
<p>Lorem Ipsum</p>
<?php endif ?>
If you need more power, then core profile.module won't suffice. Instead, use node_profile. This is both complex and powerfull, so evaluate this option carefully, don't just install it on a production environment.
2. No. Not possible with configuration. Both profiles and node_profiles offer fieldsets only unnested. You can, however, add markup or elements in any form in Drupal trough a custom module that implements hook_form_alter(). Or you can change the outputted HTML trough the theme. Be carefull not to change too much functionality in the theme layer: e.g. don't remove form-fields in your theme: that will break at some point.

Prevent users editing node titles

Is it possible to prevent a user from editing the title of a node on the node edit screen?
One of the things I really detest about Drupal is the rigidity of the title & body field in each node.
Two ways you can do this:
1) Write a hook_form_alter function to set #access to FALSE. This is really quick if you're familiar with writing modules, but if not, you'll probably prefer:
2) Use Automatic Nodetitles to hide the title field completely, create a standard text CCK field to replace it, and then use Content Permissions (which comes with CCK) to restrict access to the new field.
(Also, while the title field is indeed a pain to hide, you can hide the body field just by setting the label to blank.)
Expanding on the tip of hiding the body field, if you use CCK and turn on Content Permissions, you can set field-level permissions, and have a "body" field that shows / is editable however you set role permissions.
If anyone is still interested in drupal7, you can use [title module][1]
[1]: https://www.drupal.org/project/title and turn title to a text field, you then can use [field_permissions module][1]
[1]: https://www.drupal.org/project/field_permissions and set it up however you like by creating a custom permission. The combination of these two module is really flexible.

drupal edit attachment field of a node

I have a content type named Properties, users can create the content types
I have file cck field in the content type (properties), now I want to add the attachments to the or edit the attachments field only in a block or panel for the particular property.
Not showing all the fields when user try to edit the content type.
I have heard that this is possible in panels using contexts.
Thanks in advance
Not sure I understand what you want here, but it sounds like you want to change the visibility/editability of fields based on role and display.
To change the visibility and/or editibility based on role, use something like this
http://drupal.org/project/field_permissions
To change it based on display, use the "display fields" tab on the content type edit form.
I think this is what you are looking for
http://drupal.org/project/editablefields

Resources