Username VS email and the users field

Kirby 2 used to save the username in the page content when you had a field of type “user”. As stated in the migration guide, I replaced the field by the new “users” field. However this one seems to save the user email and not the username in the content.

All the existing fields in the panel are blank because it doesn’t seems to be able to match the username with an existing user. Did I miss something or do I have to replace all usernames by emails in my existing content?

Afaik all user names are replaced by email addresses in K3, so you probably have to update those.

Since the user name will no longer be unique (or not even stored anymore for new users) as Kirby now uses the email address, yes, you would have to update your files.

There‘s a cookbook recipe for the user migration.

Thanks Flo, but that unfortunately doesn’t help with replacing references to users throughout the content. Maybe we should write a little script for that goes through all files and replace usernames with their email addresses…

I’m on it right now!


We have a first version:
Would you be so kind and test if it works for you? Please make sure to have a complete backup of your site before running the script. There could be an error and we don’t want that your data gets lost.

1 Like

Amazing, thank you very much for coming up with that script so quickly. It looks like it worked perfectly :100:

1 Like

@distantnative It looks like there is a bug which might not be related to the script but to Kirby in general.

Running the script removes the “title” when updating pages. It seems to happen only on the primary language though, translations of the page still have their title. Any idea what’s going on?

Let me know if I should open an issue in the Github repo.

One thing I realized last night is that when you update pages in the Panel and your blueprint still contains a title field, the title is removed.

Wondering if this is a bug or by design; if by design, we need a warning in the migration guide.

Wonder why this happens when running the script, though.

Indeed, the problem doesn’t occur once I remove the title field from the blueprint. Thanks!

I added a warning in the main migration guide for the time being.