return ($this->fullname) ? $this->fullname : $this->nickname;
}
+ /**
+ * Takes the currently scoped profile into account to give a name
+ * to list in notice streams. Preferences may differ between profiles.
+ */
+ function getStreamName()
+ {
+ $user = common_current_user();
+ if ($user instanceof User && $user->streamNicknames()) {
+ return $this->nickname;
+ }
+
+ return $this->getBestName();
+ }
+
/**
* Gets the full name (if filled) with nickname as a parenthetical, or the nickname alone
* if no fullname is provided.
$this->out->elementStart('a', $attrs);
$this->showAvatar();
$this->out->text(' ');
- $user = common_current_user();
- if (!empty($user) && $user->streamNicknames()) {
- $this->out->element('span',array('class' => 'fn'),
- $this->profile->nickname);
- } else {
- $this->out->element('span',array('class' => 'fn'),
- $this->profile->getBestName());
- }
+ $this->out->element('span',array('class' => 'fn'), $this->profile->getStreamName());
$this->out->elementEnd('a');
$this->out->elementEnd('span');
$attentions = $this->getReplyProfiles();
- $user = common_current_user();
-
- $streamNicknames = !empty($user) && $user->streamNicknames();
-
foreach ($attentions as $attn) {
$class = $attn->isGroup() ? 'group' : 'account';
$pa[] = array('href' => $attn->profileurl,
'title' => $attn->nickname,
'class' => "addressee {$class}",
- 'text' => ($streamNicknames) ? $attn->nickname : $attn->getBestName());
+ 'text' => $attn->getStreamName());
}
return $pa;