+ $newitem = item_store($arr);
+
+ // If the newly created item is the top item then change the parent settings of the thread
+ if ($newitem AND ($arr["uri"] == $first_id)) {
+ logger('complete_conversation: changing parents to parent '.$newitem.' old parent: '.$parent["id"].' new uri: '.$arr["uri"]);
+ $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s' WHERE `parent` = %d",
+ intval($newitem),
+ dbesc($arr["uri"]),
+ intval($parent["id"]));
+ logger('complete_conversation: done changing parents to parent '.$newitem);
+ }