From b459530e65c6cc20e3c73255dc4e5a074b7f76dc Mon Sep 17 00:00:00 2001 From: L91 Date: Mon, 6 Mar 2017 16:06:47 +0100 Subject: [PATCH] change profile avatar title from fullname to username (#53) --- Controller/ProfileController.php | 2 +- UPGRADE.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 UPGRADE.md diff --git a/Controller/ProfileController.php b/Controller/ProfileController.php index 79b190c2..5f2c7cb6 100644 --- a/Controller/ProfileController.php +++ b/Controller/ProfileController.php @@ -113,7 +113,7 @@ protected function saveAvatar(Form $form, User $user, $locale) [ 'id' => (null !== $avatar ? $avatar->getId() : null), 'locale' => $locale, - 'title' => $user->getFullName(), + 'title' => $user->getUsername(), 'collection' => $collection, ], $user->getId() diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 00000000..770bbf89 --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,28 @@ +# Upgrade + +## 0.2.0 + +### Avatar title will use username instead of fullname + +If you want this also for old uploaded profile images the username as +media title run the following sql statement. Attention this will +overwrite all manual changed media titles of contact images. + +```sql +UPDATE me_file_version_meta AS fvm +INNER JOIN me_file_versions AS fv ON + fvm.idFileVersions = fv.id +INNER JOIN me_files AS f ON + fv.idFiles = f.id +INNER JOIN me_media AS m ON + f.idMedia = m.id +INNER JOIN me_collections AS co ON + m.idCollections = co.id +INNER JOIN co_contacts AS c ON + m.id = c.avatar +INNER JOIN se_users AS u ON + u.idContacts = c.id +SET fvm.title = u.username +WHERE co.collection_key = 'sulu_contact.contact' AND u.id IS NOT NULL; +``` +