Programmatically a create content form I want to implement the create content form programmatically. In hook_menu() I have the following code.

$items['create/content/video'] = array(
  'title' =&gt; 'Create Video',
  'page callback' =&gt; 'create_content_video',
  'access arguments' =&gt; array('create video'),
  'type' =&gt; MENU_LOCAL_TASK,
  'weight' =&gt; 1
);


In hook_init(), I have the following code.

if (arg(0)=='node' &amp;&amp; arg(1)=='add') {
  drupal_goto('create/content/'.arg(2));
}


In hook_theme(), I have the following code.

'video_node_form' =&gt; array(
  'arguments' =&gt; array(
    'form' =&gt; NULL,
  ),
  'template' =&gt; 'my_theme_video_form',
  'render element' =&gt; 'form',
),


In the page callback, I have the following code.

function create_content_video() {
  module_load_include('inc', 'node', 'node.pages');
  return node_add('video');
}


In the template file, I render form element correctly.
My problem is with the the AJAX uploader in the form. Without, I use the upload button to upload the file, and the node is correctly saved; when I use the AJAX uploader, it returns an error.


  Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'node_form' not found or invalid function name in drupal_retrieve_form() (line 795 of /var/www/mysite/includes/form.inc).
  Notice: Undefined index: #node in comment_form_node_form_alter() (line 1193 of /var/www/mysite/modules/comment/comment.module).
  Notice: Trying to get property of non-object in comment_form_node_form_alter() (line 1210 of /var/www/mysite/modules/comment/comment.module).
  Notice: Undefined index: #node in menu_form_node_form_alter() (line 629 of /var/www/mysite/modules/menu/menu.module).
  Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 629 of /var/www/mysite/modules/menu/menu.module).
  Notice: Undefined index: #node in menu_form_node_form_alter() (line 630 of /var/www/mysite/modules/menu/menu.module).
  Notice: Trying to get property of non-object in menu_form_node_form_alter() (line 630 of /var/www/mysite/modules/menu/menu.module).
  Notice: Undefined index: #node in translation_form_node_form_alter() (line 135 of /var/www/mysite/modules/translation/translation.module).
  Notice: Trying to get property of non-object in translation_form_node_form_alter() (line 135 of /var/www/mysite/modules/translation/translation.module).
  Notice: Undefined index: type in xmlsitemap_node_form_node_form_alter() (line 136 of /var/www/mysite/sites/all/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module).
  Notice: Undefined index: nid in xmlsitemap_node_form_node_form_alter() (line 136 of /var/www/mysite/sites/all/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module).
  Notice: Undefined index: field_news_attachment in file_ajax_upload() (line 276 of /var/www/mysite/modules/file/file.module).
  Notice: Undefined index: #suffix in file_ajax_upload() (line 285 of /var/www/mysite/modules/file/file.module).  


When I create content without this method, it works fine.
I am using Drupal 7.14.
I agree with Clive, that this seems like a great deal of trouble, but what you should be doing generally, is calling field_attach_form(), and more specifically for nodes, node_form(), which calls the former. The arguments it expects are

You can see an example on the first here: Is displaying a working Field Widget Form on its own possible?