diff --git a/include/class.user.php b/include/class.user.php index ad599b5d07d817fa5b094edfd1561260b144afcd..e0042c1a2ea19f7e68462f397de29f426fde4eaf 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -215,7 +215,11 @@ class User extends UserModel { } function getName() { - return new PersonsName($this->name); + if (!$this->name) + list($name) = explode('@', $this->getDefaultEmailAddress(), 2); + else + $name = $this->name; + return new PersonsName($name); } function getUpdateDate() { diff --git a/include/staff/users.inc.php b/include/staff/users.inc.php index 97e5862fdceff9ed155cfd43f0727c0168cb2c93..e02c9dbc8cd90fb1500265770e282fb1ee93e7ce 100644 --- a/include/staff/users.inc.php +++ b/include/staff/users.inc.php @@ -115,7 +115,12 @@ else if($res && db_num_rows($res)): $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null; while ($row = db_fetch_array($res)) { - $name = new PersonsName($row['name']); + // Default to email address mailbox if no name specified + if (!$row['name']) + list($name) = explode('@', $row['email']); + else + $name = new PersonsName($row['name']); + // Account status if ($row['account_id']) $status = new UserAccountStatus($row['status']);