[support] wrong node data

Earnie Boyd earnie at users.sourceforge.net
Tue Jul 22 13:08:03 UTC 2008


Quoting John Horning <john at rivul.com>:

>      Did my script call "node_save"?  No.  I don't know how to hook
> into the other Drupal modules.  I wrote my own queries to insert into
> and update the tables, partly based on what I learned here:
> http://drupal.org/node/133705.
>

Wow!!  My jaw is dropped to the floor.  The user that wrote that asks 
for as much trouble as I believe you are in and then is spreading the 
trouble around.  The proper way to import data into a node is to build 
a node object and pass it to node_save[1].  If you create a batch 
script to do a job then you need to bootstrap Drupal similar to the way 
cron.php, install.php or update.php does.

The problem with the pointed to documentation is that there may be 
other enabled modules that want to add its pieces to the data.  You 
have no idea the tables that might be created to control the visual or 
control data if you add modules to your system.

> I'm sure that for those of you who know the proper way of doing this,
> my method is pretty crude, but it seemed to work - at least on most
> nodes.  But something is apparently out of sync.
>

I saw the follow-up post that you think you found the answer of 
clearing a cache now and then.  I don't think that will keep resolving 
your issue but more power to you.

> Basically what I am trying to do is import users and company
> profiles.  I used the Import User module for the users, but need
> something for the company profiles.  What would you suggest at this
> point?

Obviously your using CCK already.  I don't know the whole story; are 
the company profiles a 1 to 1 relationship to the user?  If so, what 
about a profile field instead of CCK?

[1] http://api.drupal.org/api/function/node_save

Earnie -- http://for-my-kids.com/
-- http://give-me-an-offer.com/



More information about the support mailing list