diff --git a/src/applications/people/config/PhabricatorUserConfigOptions.php b/src/applications/people/config/PhabricatorUserConfigOptions.php --- a/src/applications/people/config/PhabricatorUserConfigOptions.php +++ b/src/applications/people/config/PhabricatorUserConfigOptions.php @@ -43,6 +43,9 @@ pht('Make real names required'), pht('Make real names optional'), )), + $this->newOption('user.default-avatar', 'string', '') + ->setDescription(pht('Default File to use as user avatar.')) + ->addExample('F4', 'Use {{{F4}}} as default avatar'), ); } diff --git a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php --- a/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfilePictureController.php @@ -98,8 +98,6 @@ $form = id(new PHUIFormLayoutView()) ->setUser($viewer); - $default_image = PhabricatorFile::loadBuiltin($viewer, 'profile.png'); - $images = array(); $current = $user->getProfileImagePHID(); @@ -157,7 +155,7 @@ } $images[PhabricatorPHIDConstants::PHID_VOID] = array( - 'uri' => $default_image->getBestURI(), + 'uri' => PhabricatorUser::getDefaultProfileImageURI(), 'tip' => pht('Default Picture'), ); diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -654,6 +654,14 @@ } public static function getDefaultProfileImageURI() { + $defaultAvatar = PhabricatorEnv::getEnvConfig('user.default-avatar'); + if (0 === strncmp($defaultAvatar, 'F', 1)) { + $file = id(new PhabricatorFile()) + ->loadOneWhere('id = %s', substr($defaultAvatar, 1)); + if ($file) { + return $file->getBestURI(); + } + } return celerity_get_resource_uri('/rsrc/image/avatar.png'); }