<p>These are flash messages which are typically triggered by controllers when saving or performing an action.</p>
<pre class="lang-php prettyprint-override"><code>Craft::$app-&gt;getSession()-&gt;setFlash();
Craft::$app-&gt;getSession()-&gt;setError();
</code></pre>
<p><a href="https://docs.craftcms.com/api/v3/craft-web-session.html#public-methods" rel="nofollow noreferrer">https://docs.craftcms.com/api/v3/craft-web-session.html#public-methods</a></p>
<p>Or in Craft CMS 3.5+ when used in a Controller action, you don't need to call the session service and can simply do.</p>
<pre class="lang-php prettyprint-override"><code>$this-&gt;setSuccessFlash()
$this-&gt;setFailFlash()
</code></pre>
<p>In Twig this component is also available using:</p>
<pre><code>{% do craft.app.session.setFlash() %}
{% do craft.app.session.setError() %}
</code></pre>

CC BY-SA 4.0
2022-07-19T22:08:26.000Z
Maybe I didn't ask my question clearly enough, sorry… What I'm trying to find out is what flash messages are sent by a form using `users/save-user` by default. Do I need to find the related controller and dig through the code or is it documented somewhere? I'm more of a frontend person, so I'm not super clear on where to find that controller… But I'll try to dig in the code. Thanks!
Yann
CC BY-SA 4.0
2022-07-20T19:35:47.647Z
@Vann Ah right, easiest way to find that would be the code. The controller can be found: https://github.com/craftcms/cms/blob/develop/src/controllers/UsersController.php, if for Craft CMS 4, change develop to v3 in the URL for Craft CMS 3, then look for the actionSaveUser function, then where there are setFailFlash() and setSuccessFlash(), those are the flash messages being displayed at various stages and conditions.
James White
CC BY-SA 4.0
2022-07-19T07:03:54.743Z
2022-07-20T19:36:35.500Z
2022-07-20T19:36:35.500Z
James White
<p>I'm trying to customize my user profile twig template UX to be a little more user friendly, but I can't figure out where to find what the built-in default errors/notices flash messages for the <code>users/save-user</code> form…</p>
<p>Any pointer in the right direction most appreciated!</p>

<craft3>
Where can I find documentation on built-in flash message for `users/save-user`?
# Where can I find documentation on built-in flash message for `users/save-user`?

(Asked by: username_0 on 2022-07-19)

I'm trying to customize my user profile twig template UX to be a little more user friendly, but I can't figure out where to find what the built-in default errors/notices flash messages for the `users/save-user` form…

Any pointer in the right direction most appreciated!

**Tags:** craft3

---

## 1 answers

### Answer by username_1 on 2022-07-19. Score: 1

These are flash messages which are typically triggered by controllers when saving or performing an action.
Craft::$app->getSession()->setFlash();
Craft::$app->getSession()->setError();

https://docs.craftcms.com/api/v3/craft-web-session.html#public-methods
Or in Craft CMS 3.5+ when used in a Controller action, you don't need to call the session service and can simply do.
$this->setSuccessFlash()
$this->setFailFlash()

In Twig this component is also available using:
{% do craft.app.session.setFlash() %}
{% do craft.app.session.setError() %}

> **Comments:**
> **username_0**: Maybe I didn't ask my question clearly enough, sorry… What I'm trying to find out is what flash messages are sent by a form using `users/save-user` by default. Do I need to find the related controller and dig through the code or is it documented somewhere? I'm more of a frontend person, so I'm not super clear on where to find that controller… But I'll try to dig in the code. Thanks!  
> **username_1**: @Vann Ah right, easiest way to find that would be the code. The controller can be found: https://github.com/craftcms/cms/blob/develop/src/controllers/UsersController.php, if for Craft CMS 4, change develop to v3 in the URL for Craft CMS 3, then look for the actionSaveUser function, then where there are setFailFlash() and setSuccessFlash(), those are the flash messages being displayed at various stages and conditions.  

---

