# Update current logged in user

{% hint style="info" %}
This article explains how to setup a custom form where a logged in user can edit their user data, and where (optionally) logged out users can register a new account. If you are just looking for a way to register new users please read the [Registration form](/features/advanced/custom-registration-form-for-wordpress.md) article.
{% endhint %}

### Updating current logged in user

Let's assume you have a single form where you want your users to be able to edit their data, and (optionally) if the user is logged out, you want them to be able to register a new account.

To do this, first edit your form and navigate to **Form Settings > Register & Login**. From the **Actions** option choose **Update current logged in user**. You should now see all settings that relate to updating a logged in user (as shown in the image below).

{% hint style="warning" %}
In case you enable the option to **Register new user if user is not logged in** you will want to make sure you first configure all the settings as per the [Registration form](/features/advanced/custom-registration-form-for-wordpress.md) article.
{% endhint %}

Now whenever a logged in user submits the form their data would be updated. And when a logged out user tries to submits the form a new account would be created instead.

### Leave the "User role" setting empty

{% hint style="danger" %}
**Important:** in most cases you will want to leave the `User role` option empty when updating existing users, this will make sure that the current user role is left untouched. Always double check these type of settings because they can potentially have a big impact if setup incorrectly.
{% endhint %}

<div align="left"><figure><img src="/files/tKemw0tB6e4qK52NGAyy" alt="Updating a currently logged in user or register a new one if logged out via a custom WordPress form."><figcaption><p>Updating a currently logged in user or register a new one if logged out via a custom WordPress form.</p></figcaption></figure></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.super-forms.com/features/advanced/update-current-logged-in-user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
