By nejko15 on
Hi!
I'm making a web application that would insert node into my Drupal database.
So far I figured that I have to insert records to 'NODE' table and 'NODE_REVISIONS' table.
But if I do that, only users that are logged in can see the created node.
What am I missing?
Thanks.
Comments
If you check the node table
If you check the node table you see that you also need to set the status = 1 for it to be published, else it is unpulished and thus hidden.
I'd also make sure you set the 'uid' to the admin (usually uid = 1) and also the 'created' field to time().
I have set the status to 1,
I have set the status to 1, that's why I don't understand why it doesn't show up.
You should not directly write
You should not directly write to those tables, it is better to use node_save().
Yes. When you write directly
Yes. When you write directly to the tables, you bypass all the APIs, which ends up in unexpected consequences in the future.
Contact me to contract me for D7 -> D10/11 migrations.
Well I can't do that since
Well I can't do that since I'm developing a separated application that must create story node.
This means I can't use the API :(
I can't. I'm developing a
I can't. I'm developing a separated application, that means that I can't use the API, doesn't it?
_
you can bootstrap drupal to use the api, but you're probably better off using xmlrpc or the services module to create a proper interface.
In any case, writing directly to the db is definitely not recommended and really just asking for trouble.