public function FirstName() { if (StakeLeader::IsLoggedIn()) { return $this->FirstName; } $formal = false; $callings = $this->Callings(); $merited = array("Bishop", "Bishopric 1st Counselor", "Bishopric 2nd Counselor", "High Counselor"); // First check for calling foreach ($callings as $c) { if ($c->Name == "Bishop") { return "Bishop"; } // Bishop gets own title if (in_array($c->Name, $merited)) { $formal = true; break; } } // Now check age if not already decided if (!$formal) { $secondsPerYear = 31557600; $formal = floor(abs(strtotime(now()) - strtotime($this->Birthday)) / $secondsPerYear) > 30; } return $formal ? Gender::RenderLDS($this->Gender) : $this->FirstName; }