Skip to content

Commit

Permalink
change profile avatar title from fullname to username (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored and wachterjohannes committed Mar 6, 2017
1 parent b63f2e8 commit b459530
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Controller/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
28 changes: 28 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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;
```

0 comments on commit b459530

Please sign in to comment.