-
- $parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
- if (DBA::isResult($parent)) {
- $a->profile['profile_uid'] = $parent['uid'];
- }
-
- $is_remote_contact = Contact::isFollower(remote_user(), $a->profile['profile_uid']);
-
- if ($is_remote_contact) {
- $cdata = Contact::getPublicAndUserContacID(remote_user(), $a->profile['profile_uid']);
- if (!empty($cdata['user'])) {
- $groups = Group::getIdsByContactId($cdata['user']);
+ $remote_cid = null;
+ $is_remote_contact = false;
+ $item_uid = local_user();
+
+ if (isset($item_parent_uri)) {
+ $parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
+ if (DBA::isResult($parent)) {
+ $a->profile['uid'] = defaults($a->profile, 'uid', $parent['uid']);
+ $a->profile['profile_uid'] = defaults($a->profile, 'profile_uid', $parent['uid']);
+ $is_remote_contact = Contact::isFollower(remote_user(), $a->profile['profile_uid']);
+
+ if ($is_remote_contact) {
+ $cdata = Contact::getPublicAndUserContacID(remote_user(), $a->profile['profile_uid']);
+ if (!empty($cdata['user'])) {
+ $groups = Group::getIdsByContactId($cdata['user']);
+ $remote_cid = $cdata['user'];
+ $item_uid = $parent['uid'];
+ }
+ }