Newly created node type is always disabled I have created a new node type using a custom module on Drupal 7. However when I check the content type under the structure menu item it isn't listed. Looking in the node_type table, I see that it is listed as disabled. My question is how do I get the content type to be enabled?

Here is my content type creation function located in mymodule.install file:

// define the node type
  $type = array(
    'type' =&gt; $machine_name,
    'name' =&gt; $t($parameters['name']),
    'base' =&gt; 'room_reservations',
    'module' =&gt; 'room_reservations',
    'description' =&gt; $t($parameters['description']),
    'has_title' =&gt; TRUE,
    'title_label' =&gt; $t($parameters['title_label']),
    'custom' =&gt; FALSE,
    'locked' =&gt; TRUE,
    'disabled' =&gt; FALSE,
  );

// set other node defaults not declared above
  $content_type = node_type_set_defaults($type);

// add the body field
  node_add_body_field($content_type, $t($parameters['body_label']));

// save the content type
  node_type_save($content_type);


I believe this is correct but it obviously doesn't work. Any ideas
Drupal base install uses this configuration to create the basic page content type. Try to modify the custom value just like the example underneath:



$type = array(
    'type' =&gt; 'page',
    'name' =&gt; st('Basic page'),
    'base' =&gt; 'node_content',
    'description' =&gt; st("Use &lt;em&gt;basic pages&lt;/em&gt; for your static content, such as an 'About us' page."),
    'custom' =&gt; true,
    'locked' =&gt; true,
    'modified' =&gt; true,
    'disabled' =&gt; false,
);


Edit

I've just checked the code of some Drupal core modules how they manage the creation of content types within code.

The Blog module defines the content type within the HOOK_node_info (just like you did). This to notify Drupal about the new type. The HOOK_install only add fields to the content type. The module also implement the HOOK_form for the content creation form and HOOK_view for the rendering.

// blog.install
function blog_install() {
  // Ensure the blog node type is available.
  node_types_rebuild();
  $types = node_type_get_types();
  node_add_body_field($types['blog']);
}

// blog.module
function blog_node_info() {
  return array(
    'blog' =&gt; array(
      'name' =&gt; t('Blog entry'),
      'base' =&gt; 'blog',
      'description' =&gt; t('Use for multi-user blogs. Every user gets a personal blog.'),
    )
  );
}


}