<p>Not particularly.</p>

<p>UserSessionService has <a href="http://buildwithcraft.com/classreference/services/UserSessionService#setNotice-detail" rel="nofollow">setNotice()</a> and <a href="http://buildwithcraft.com/classreference/services/UserSessionService#setError-detail" rel="nofollow">setErrors()</a>, which are just wrappers for Yii's <a href="http://www.yiiframework.com/doc/api/1.1/CWebUser#setFlash-detail" rel="nofollow">setFlash()</a> where we pass in an <code>'error'</code> or <code>'notice'</code> for the key.</p>

<p>Yii will take than and prepend the <code>FLASH_KEY_PREFIX</code> const which we set to <code>Craft.UserSessionService.flash.</code>.</p>

<p>So an error's key will end up being <code>Craft.UserSessionService.flash.error</code> and a notice will be <code>Craft.UserSessionService.flash.notice</code>.</p>

CC BY-SA 3.0
2014-11-17T21:37:32.457Z
So with this I would be able to do something like this `craft.session.getFlash('notice', 'Your settings have been saved')`? Only with the limitation that only one notice can be stored at a time.
Hasco
CC BY-SA 3.0
2014-11-17T21:50:03.357Z
Sounds pretty solid to me.
Brad Bell
CC BY-SA 3.0
2014-11-17T21:32:37.153Z
2014-11-17T21:32:37.153Z
Brad Bell
<p>Does Craft have any default keys for flash messages like logging in or updating a profile?</p>

CC BY-SA 3.0
2014-11-17T21:30:04.720Z
Do you mean for the backend, to display messages in Crafts native alert message format?
naboovalley
CC BY-SA 3.0
2014-11-17T21:31:58.020Z
For the frontend, so you can do something like `{% set message = craft.session.getFlash('login') %}` for example.
Hasco
<users><user-profile><session><login>
Does Craft have any default keys for flash messages?
# Does Craft have any default keys for flash messages?

(Asked by: username_0 on 2014-11-17)

Does Craft have any default keys for flash messages like logging in or updating a profile?

**Tags:** users, user-profile, session, login

> **Comments:**
> **username_1**: Do you mean for the backend, to display messages in Crafts native alert message format?  
> **username_0**: For the frontend, so you can do something like `{% set message = craft.session.getFlash('login') %}` for example.  

---

## 1 answers

### Answer by username_2 on 2014-11-17. Score: 2 | Accepted answer

Not particularly.

UserSessionService has [setNotice()](http://buildwithcraft.com/classreference/services/UserSessionService#setNotice-detail) and [setErrors()](http://buildwithcraft.com/classreference/services/UserSessionService#setError-detail), which are just wrappers for Yii's [setFlash()](http://www.yiiframework.com/doc/api/1.1/CWebUser#setFlash-detail) where we pass in an `'error'` or `'notice'` for the key.

Yii will take than and prepend the `FLASH_KEY_PREFIX` const which we set to `Craft.UserSessionService.flash.`.

So an error's key will end up being `Craft.UserSessionService.flash.error` and a notice will be `Craft.UserSessionService.flash.notice`.

> **Comments:**
> **username_0**: So with this I would be able to do something like this `craft.session.getFlash('notice', 'Your settings have been saved')`? Only with the limitation that only one notice can be stored at a time.  
> **username_2**: Sounds pretty solid to me.  

---

