public function title()
{
static $ban_list;
// If not already built in a previous call, build an array of lowercase banned usernames
if (empty($ban_list)) {
$ban_list = array();
// FIXME: Retrieve $bans (former $pun_bans)
$bans = array();
foreach ($bans as $cur_ban) {
$ban_list[] = strtolower($cur_ban['username']);
}
}
// If the user has a custom title
if ($this->title != '') {
return $this->title;
} elseif (in_array(strtolower($this->username), $ban_list)) {
// If the user is banned
return trans('Banned');
} elseif ($this->group->g_user_title != '') {
// If the user group has a default user title
return $this->group->g_user_title;
} elseif ($this->guest()) {
// If the user is a guest
return trans('Guest');
} else {
// If nothing else helps, we assign the default
return trans('Member');
}
}