Updating user information in frontend not working

I couldn’t find any solutions in the forum so I have to reach out.

On the website I’m building I have an ‘Edit Profile’ page where the user can update some (blueprint defined) user information. I feel like I’ve set up everything correctly but for some reason the values are not updating.

Here’s my controller:


return function ($page, $kirby, $site) {
    $user = $kirby->user();
    $error = null;
    $success = false;

    if ($kirby->request()->is('POST') && get('updateProfile')) {
        $data = [
            'country'  => get($user->country()),
            'website'  => get($user->website()),
            'shortBio' => get($user->shortBio()),
            'longBio'  => get($user->longBio())

        try {
            if ($user) {
                $user = $user->update($data);
                error_log('Update Success: User profile updated.');
                $success = true;
            } else {
                error_log('Update Error: User not found.');
                $error = 'User not found.';
        } catch (Exception $e) {
            $error = $e->getMessage();
            error_log('Update Error: ' . $error);
            error_log('Exception caught: ' . $e->getMessage());

    return [
        'user' => $user,
        'error' => $error,
        'success' => $success

And the form:

<form method="post" action="<?= $page->url() ?>"> 
    <div class="form-group">
        <label for="country">Country</label>
        <input type="text" id="country" name="country" value="<?= $user->country() ?>" class="form-control">
    <div class="form-group">
        <label for="website">Website</label>
        <input type="text" id="website" name="website" value="<?= $user->website() ?>" class="form-control">
    <div class="form-group">
        <label for="shortBio">Short Bio</label>
        <textarea id="shortBio" name="shortBio" class="form-control"><?= $user->shortBio() ?></textarea>
    <div class="form-group">
        <label for="longBio">Long Bio</label>
        <textarea id="longBio" name="longBio" class="form-control"><?= $user->longBio() ?></textarea>
    <button type="submit" name="updateProfile" class="btn btn-primary">Update Profile</button>

The current information is displayed correctly on the page, but when I make changes and press ‘Update Profile’ it just resets everything.

I’ve also set the following permissions:

    panel: false
    user: true

Thankful for any help!

Do you have a frontend login?

I do, yes.

Oh, wait, you need to fetch the form data, instead you try to use get() on user data, which doesn’t make sense.

  $data = [
            'country'  => get('country'),
           // etc.

Ahhh of course. Thank you Sonja!