- if (($item['gravity'] == ItemModel::GRAVITY_PARENT) && !empty($forum_contact) && ($private_forum || $only_to_forum)) {
- // we tagged a forum in a top level post. Now we change the post
- $item['private'] = $private_forum ? ItemModel::PRIVATE : ItemModel::UNLISTED;
+ if (($item['gravity'] == ItemModel::GRAVITY_PARENT) && !empty($group_contact) && ($private_group || $only_to_group)) {
+ // we tagged a group in a top level post. Now we change the post
+ $item['private'] = $private_group ? ItemModel::PRIVATE : ItemModel::UNLISTED;
+
+ if ($only_to_group) {
+ $cdata = Contact::getPublicAndUserContactID($group_contact['id'], $item['uid']);
+ if (!empty($cdata['user'])) {
+ $item['owner-id'] = $cdata['user'];
+ unset($item['owner-link']);
+ unset($item['owner-name']);
+ unset($item['owner-avatar']);
+ }