X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fpluser.php;h=3e4418a93a88bd7124a9c2aa734986f1d233938b;hb=d95208679c7ec4092e9e6156cd8eadd3fe15b9c0;hp=03abb2a3bebf0af43183020ec1d8db31e2bdb160;hpb=643ae90bb09f55e0b0853bf5a554829a3042495e;p=platal.git diff --git a/classes/pluser.php b/classes/pluser.php index 03abb2a..3e4418a 100644 --- a/classes/pluser.php +++ b/classes/pluser.php @@ -61,9 +61,11 @@ abstract class PlUser protected $hruid = null; // User main email aliases (forlife is the for-life email address, bestalias - // is user-chosen preferred email address). + // is user-chosen preferred email address, email might be any email available + // for the user). protected $forlife = null; protected $bestalias = null; + protected $email = null; // Display name is user-chosen name to display (eg. in "Welcome // !"), while full name is the official full name. @@ -135,11 +137,17 @@ abstract class PlUser public function bestEmail() { - return $this->bestalias; + if (!empty($this->bestalias)) { + return $this->bestalias; + } + return $this->email; } public function forlifeEmail() { - return $this->forlife; + if (!empty($this->forlife)) { + return $this->forlife; + } + return $this->email; } public function displayName() @@ -192,6 +200,15 @@ abstract class PlUser return property_exists($this, $name) || isset($this->data[$name]); } + public function __unset($name) + { + if (property_exists($this, $name)) { + $this->$name = null; + } else { + unset($this->data[$name]); + } + } + /** * Fills the object properties using the @p associative array; the intended * user case is to fill the object using SQL obtained arrays.