slight rearrangement of getting profile URIs

This commit is contained in:
Evan Prodromou 2010-02-21 22:52:27 -05:00
parent 232b5efa7e
commit a745d38d6d

View File

@ -841,28 +841,22 @@ class Profile extends Memcached_DataObject
{ {
$uri = null; $uri = null;
// give plugins a chance to set the URI
if (Event::handle('StartGetProfileUri', array($this, &$uri))) {
// check for a local user first // check for a local user first
$user = User::staticGet('id', $this->id); $user = User::staticGet('id', $this->id);
if (!empty($user)) { if (!empty($user)) {
$uri = common_local_url( $uri = $user->uri;
'userbyid',
array('id' => $user->id)
);
} else { } else {
// give plugins a chance to set the URI
if (Event::handle('StartGetProfileUri', array($this, &$uri))) {
// return OMB profile if any // return OMB profile if any
$remote = Remote_profile::staticGet('id', $this->id); $remote = Remote_profile::staticGet('id', $this->id);
if (!empty($remote)) { if (!empty($remote)) {
$uri = $remote->uri; $uri = $remote->uri;
} }
Event::handle('EndGetProfileUri', array($this, &$uri));
} }
Event::handle('EndGetProfileUri', array($this, &$uri));
} }
return $uri; return $uri;