diff options
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php index 1f90a1d05..d48a04da5 100755 --- a/include/items.php +++ b/include/items.php @@ -3697,3 +3697,32 @@ function store_diaspora_retract_sig($item, $user, $baseurl) { return; } + +function fetch_post_tags($items) { + + $tag_finder = array(); + if(count($items)) + foreach($items as $item) + if(! in_array($item['item_id'],$tag_finder)) + $tag_finder[] = $item['item_id']; + $tag_finder_str = implode(', ', $tag_finder); + + $tags = q("select * from term where oid in ( %s ) and otype = %d", + dbesc($tag_finder_str), + intval(TERM_OBJ_POST) + ); + + for($x = 0; $x < count($items); $x ++) { + if(count($tags)) { + foreach($tags as $t) { + if($t['oid'] == $items[$x]['item_id']) { + if(! is_array($items[$x]['term'])) + $items[$x]['term'] = array(); + $items[$x]['term'][] = $t; + } + } + } + } + + return $items; +} |