Skip to content

Files

Latest commit

 Cannot retrieve latest commit at this time.

History

History
20 lines (15 loc) · 707 Bytes

user-profile-form.md

File metadata and controls

20 lines (15 loc) · 707 Bytes

User Profile Form

If you want to create a form that is able to edit a user’s own profile, you can do so with the following code:

<form method="post" accept-charset="UTF-8">
    {{ csrfInput() }}
    <input type="hidden" name="action" value="users/save-user">
    {{ redirectInput('users/'~currentUser.username) }}
    <input type="hidden" name="userId" value="{{ currentUser.id }}">

    <label for="location">Location</label>
    <input type="text" id="location" name="fields[location]" value="{{ currentUser.location }}">

    <label for="bio">Bio</label>
    <textarea id="bio" name="fields[bio]">{{ currentUser.bio }}</textarea>

    <input type="submit" value="Save Profile">
</form>