After diving into the bowels of the drupal code I found the spot which did the creating and it seemed to be doing something quite reasonable with the new node ID.
With just a small amount of convincing I managed to get it to do what I wanted.
diff -ru vanilla/drupal-7.12/modules/node/node.module web/drupal/modules/node/node.module
--- vanilla/drupal-7.12/modules/node/node.module 2012-02-02 09:03:14.000000000 +1100
+++ web/drupal/modules/node/node.module 2012-05-28 16:37:36.827171000 +1000
@@ -1095,6 +1095,12 @@
if ($node->is_new) {
// For new nodes, save new records for both the node itself and the node
// revision.
+if(isset($node->request_nid))
+{
+ echo "Requested save new node with nid {$node->request_nid}\n";
+ $node->nid = $node->request_nid;
+ //print_r($node);
+}
drupal_write_record('node', $node);
_node_save_revision($node, $user->uid);
$op = 'insert';
Creating a node can now be done like this:
$node = new stdClass();
$node->type = ...;
node_object_prepare($node);
// fill in node details here...$node->request_nid = $my_nid;
node_save($node);
That seems quite trivial now. I don't know why so many people say it can't be done.
Great post! Thanks a lot for sharing with us.
ReplyDeleteKevin Right
Very useful information Viki
ReplyDeleteYour site has a lot of useful information for myself. I visit regularly. Hope to have more quality items.
ReplyDeleteshell shockers unblocked
-Things are very open and intensely clear explanation of issues. was truly information. Your website is very beneficial.
ReplyDeletegmail login
Manga Panda is a popular Web site for Manga. You will also find a series of the latest manga comics on this web site. These latest manga are alphabetically arranged.
ReplyDeleteThere's 1000 free English translation comic series available at Mangapanda. Popular Manga, Manga List, and Latest Releases tabs are available on the Manga Panda website. The most popular web site on Manga.
Yeeey! another great post. https://www.mobiledetailokc.com/
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI haven't tried doing it yet but I guess I have to try. Thanks!
ReplyDeletehttps://www.seo-tampa.org
We have formally relaunched YesPornPlease with a large number of recordings, channels for pornography adoring network. In the event that you love free full-length HD pornography recordings, that YesPornPlease can offer, at that point this cylinder site is for you. Snap and appreciate most sultry XXX videos for nothing!
ReplyDelete