]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / classes / Profile.php
index 8e12dfc6ee5cbad32427996db1e0dc37fc6186d6..9c334fd923be614f04f1e41e419c09639e6b62ce 100644 (file)
@@ -1426,19 +1426,21 @@ class Profile extends Managed_DataObject
         if ($this->isGroup()) {
             // FIXME: Get rid of this event, it fills no real purpose, data should be in Profile->profileurl (replaces User_group->mainpage)
             if (Event::handle('StartUserGroupHomeUrl', array($this->getGroup(), &$url))) {
-                $url = $this->isLocal()
+                $url = $this->getGroup()->isLocal()
                         ? common_local_url('showgroup', array('nickname' => $this->getNickname()))
                         : $this->profileurl;
             }
             Event::handle('EndUserGroupHomeUrl', array($this->getGroup(), $url));
+        } elseif ($this->isLocal()) {
+            $url = common_local_url('showstream', array('nickname' => $this->getNickname()));
         } else {
             $url = $this->profileurl;
         }
-        if (empty($this->profileurl) ||
-                !filter_var($this->profileurl, FILTER_VALIDATE_URL)) {
-            throw new InvalidUrlException($this->profileurl);
+        if (empty($url) ||
+                !filter_var($url, FILTER_VALIDATE_URL)) {
+            throw new InvalidUrlException($url);
         }
-        return $this->profileurl;
+        return $url;
     }
 
     public function getNickname()
@@ -1553,6 +1555,11 @@ class Profile extends Managed_DataObject
             $user = User::getKV('uri', $uri);
             if ($user instanceof User) {
                 $profile = $user->getProfile();
+            } else {
+                $group = User_group::getKV('uri', $uri);
+                if ($group instanceof User_group) {
+                    $profile = $group->getProfile();
+                }
             }
             Event::handle('EndGetProfileFromURI', array($uri, $profile));
         }