+ /**
+ * Build the canonical profile URI+URL of the requested user or group
+ */
+ function targetProfile()
+ {
+ if ($this->nickname) {
+ $user = User::getKV('nickname', $this->nickname);
+ if ($user) {
+ return common_local_url('userbyid', array('id' => $user->id));
+ } else {
+ // TRANS: Client error.
+ $this->clientError(_m('No such user.'));
+ }
+ } else if ($this->group) {
+ $group = Local_group::getKV('nickname', $this->group);
+ if ($group instanceof Local_group) {
+ return common_local_url('groupbyid', array('id' => $group->group_id));
+ } else {
+ // TRANS: Client error.
+ $this->clientError(_m('No such group.'));
+ }
+ } else if ($this->peopletag && $this->tagger) {
+ $user = User::getKV('nickname', $this->tagger);
+ if (empty($user)) {
+ // TRANS: Client error.
+ $this->clientError(_m('No such user.'));
+ }
+
+ $peopletag = Profile_list::getByTaggerAndTag($user->id, $this->peopletag);
+ if ($peopletag) {
+ return common_local_url('profiletagbyid',
+ array('tagger_id' => $user->id, 'id' => $peopletag->id));
+ }
+ // TRANS: Client error.
+ $this->clientError(_m('No such list.'));
+ } else {
+ // TRANS: Client error.
+ $this->clientError(_m('No local user or group nickname provided.'));
+ }