Re: Weird Node Save Problem

Vijaya chandran <[email protected]>
Newsgroups gmane.comp.php.drupal.support
Message-ID <CAHOab=KotV0oRVAv2ADwFQMY1RZik445Er==VZOuj9C0joJo6g@mail.gmail.com>
It looks like the placement of node creating code is wrong. Say for
example, if we add any code in a form definition, it might get called more
than once when we try to render the form using drupal_get_form().


To solve this problem, just add a debug statement (drupal_set_message)
above node creation code and see how many times control comes  there. if it
is more than once, then our assumption is correct and probably you want to
move your code to somewhere after all these processing done (and executed
once). Worst case, you can check for the presence of nid and discard the
insert.






On Thu, Jun 26, 2014 at 3:48 PM, Nancy Wichmann <[email protected]>
wrote:

>  I have some code that is programmatically creating a node and turning
> over to the node form. So far it looks good and my code steps aside and
> lets Core do its stuff.
>
> So, the node_insert code gets called with a good node, complete with field
> data and a group. But then node_insert is invoked a second time with a node
> having the same ID, but missing group and most field data. This part makes
> no sense to me, and I can't track down why it's happening.
>
> Has anyone seen anything like this, and perhaps fixed it?
>
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>

-- 
[ Drupal support list | http://lists.drupal.org/ ]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.