From 08900b730bd39c00e399696472d904c1d5e4ef0b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 24 Nov 2017 18:23:53 -0800 Subject: this may fix pubstream comments/likes --- include/items.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 654cc5de3..042deed1b 100755 --- a/include/items.php +++ b/include/items.php @@ -1749,6 +1749,22 @@ function item_store($arr, $allow_exec = false, $deliver = true) { intval($arr['uid']) ); + // perhaps the system channel owns the post and it's a pubstream item + + if(! $r) { + $s = q("select channel_id from channel where channel_system = 1 limit 1"); + if($s) { + $r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d ORDER BY id ASC LIMIT 1", + dbesc($arr['parent_mid']), + intval($s[0]['channel_id']) + ); + } + if($r) { + $arr['uid'] = $r[0]['uid']; + $arr['aid'] = 0; + } + } + if($r) { // in case item_store was killed before the parent's parent attribute got set, -- cgit v1.2.3