- // fallback so that parent always gets set to non-zero.
-
- if(! $parent)
- $parent = $post_id;
-
- logger("Pre Update Parent", LOGGER_DEBUG);
- $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `plink` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1
- WHERE `id` = %d",
- intval($parent),
- dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
- dbesc($a->get_baseurl().'/display/'.urlencode($datarray['guid'])),
- dbesc(datetime_convert()),
- intval($post_id)
- );
- logger("Pre Update Parent", LOGGER_DEBUG);
-
- // photo comments turn the corresponding item visible to the profile wall
- // This way we don't see every picture in your new photo album posted to your wall at once.
- // They will show up as people comment on them.
-
- //if(! $parent_item['visible']) {
- // logger("Pre Update Visible", LOGGER_DEBUG);
- // $r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d",
- // intval($parent_item['id'])
- // );
- // logger("Post Update Visible", LOGGER_DEBUG);
- //update_thread($parent_item['id']);
- //}
-
- // update the commented timestamp on the parent
-
- logger("Pre Update Commented", LOGGER_DEBUG);
- q("UPDATE `item` SET `visible` = 1, `commented` = '%s', `changed` = '%s' WHERE `id` = %d",
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- intval($parent)
- );
- logger("Post Update Commented", LOGGER_DEBUG);
- if ($post_id != $parent)
- update_thread($parent, true);
-