Skip to content

Commit e303b6c

Browse files
committed
Update username if a new one is passed on save.
1 parent d9189d4 commit e303b6c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

server/actions/patterns/save.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ function savePattern($userProfile) {
149149
$result->name = $name;
150150
}
151151

152+
// If we have a new username, save it back to the profile
153+
if ($userProfile->username != $author) {
154+
$this->db->execute("UPDATE users SET username=? WHERE id=?", [
155+
["s", $author],
156+
["s", $userProfile->userId]
157+
]);
158+
}
159+
152160
$json = (object)createPatternNode($result);
153161
// If this item was previously cached, delete it (patterns/load) will re-cache if needed.
154162
\core\Cache::DeleteItem(\core\Cache::PatternKey($patternId));

0 commit comments

Comments
 (0)