Hi all,

I have created my own module, where in i have a user input form and on submit of that form i need to invoke the node_save() function. basically i want to save my content as a node.
i have written following code in my _submit() function

                $node 			= (object)$node;
		$node->type 	= 'webpage'; // new content type that i have created
		$node->uid 	= $uid;
		$node->title 	= $pageName; // the variables have actual title and description
		$node->body 	= $pageBody;
		$node->created 	= time();
		$node->teaser_include 	= 1;
		$node->format 	= 1;
		$node->name 	= $user->name;
		$node->status 	= 1;

when i click on submit i can find my content in node, node_revision, workflow tables. but when i tried the url ?q=node/% (new nid from node table), it takes lot of time and ends with memory execution and/or allowed memory size error.

Could you please correct me if any.
I am using Drupal 6.20 and Workflow module.

thanks in advance.
- paresh.

Comments

kendre_paresh’s picture

I also tried to call node_form_submit($form, $form_state);

my code is

global $user;
		$uid = $user->uid;
		
		$form_state['values']['type'] = 'webpage';
		$form_state['values']['uid'] = $uid;
		$form_state['values']['title'] = $pageName;
		$form_state['values']['body'] = $pageBody;
		$form_state['values']['created'] = time();
		$form_state['values']['teaser_include'] = 1;
		$form_state['values']['format'] = 1;
		$form_state['values']['name'] = $user->name;
		$form_state['values']['status'] = 1;

         node = node_form_submit($form, $form_state);
		

when i tried this code it says Fatal error: Allowed memory size.....

Please advice.
May be ia have missed few parameters while creating node object and/or $form_state array