nodetype) && $node->nodetype) { $types = node_get_types(); drupal_set_message(t('The type of the post %title has been changed from %old to %new.', array('%title' => $node->title, '%old' => $types[$node->type], '%new' => $types[$node->nodetype]))); $node->type = $node->nodetype; } break; } } /** * Implementation of hook_form_alter(). */ function nodetype_form_alter($form_id, &$form) { if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id && isset($form['#node']->nid) && user_access('change node types')) { $types = node_get_types(); foreach ($types as $type => $info) { if ($form['type']['#value'] == $type) { $current_type = $types[$type]; unset($types[$type]); } else { $types[$type] = $info; } } $selected = '<'. t('leave as is: @type', array('@type' => $current_type)) .'>'; $form['nodetype'] = array( '#type' => 'select', '#title' => t('Content type'), '#description' => t('Select a new content type that this post will be changed to. Only do that if you know what you are doing.'), '#options' => array(0 => $selected) + $types, '#default_value' => $selected, '#weight' => 10, ); } }