Closed (duplicate)
Project:
Node Comments
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Nov 2007 at 01:20 UTC
Updated:
27 May 2009 at 21:47 UTC
Here's just a little something to get us started:
/**
* Implementation of hook_init()
*/
function example_init() {
$results = db_query('SELECT * FROM {comments}');
while ($result = db_fetch_object($results)) {
$node = (object) array(
'type' => 'comment',
'title' => $result->subject,
'teaser' => $result->subject,
'body' => $result->comment,
'uid' => $result->uid,
'status' => 1,
'created' => $result->timestamp,
'changed' => $result->timestamp,
'comment_target_nid' => $result->nid,
'comment_target_cid' => $result->pid,
'comment' => 0,
'promote' => 0,
'moderate' => 0,
'sticky' => 0,
'thread' => $result->thread,
'name' => $result->name,
'mail' => $result->mail,
'homepage' => $result->homepage,
);
node_save($node);
// update hostname
db_query("UPDATE {node_comments} SET hostname = '%s' WHERE cid = '%d' LIMIT 1;", $result->hostname, $node->nid);
}
}
Comments
Comment #1
quicksketchThis will be fixed in the 2.x version of the module which works comment module. See #472886: Convert comments to nodecomments and viceversa when the type is changed.