<p>Yes, you will need to build a custom module that's built for the admin panel. A starter on doing so can be found here:</p>
<p><a href="https://craftcms.com/docs/4.x/extend/" rel="nofollow noreferrer">https://craftcms.com/docs/4.x/extend/</a></p>
<p>I think what you'll want is to trigger some code on the LOGIN event, but only if that user is has access to the CP. A quick search in Craft's Events lookup (located here: <a href="https://craftcms.com/docs/4.x/extend/events.html#event-code-generator" rel="nofollow noreferrer">https://craftcms.com/docs/4.x/extend/events.html#event-code-generator</a>) reveals this might be the event you want (feel free to dig / try others):</p>
<p>craft\elements\conditions\users\LastLoginDateConditionRule::EVENT_AFTER_VALIDATE</p>
<p>Events Guide:
<a href="https://craftcms.com/docs/4.x/extend/events.html" rel="nofollow noreferrer">https://craftcms.com/docs/4.x/extend/events.html</a></p>
<p>You would write this in modules/Module.php (a pre-setup file in Craft CMS where you can code this) or your own custom equivalent.</p>

CC BY-SA 4.0
2023-09-21T01:27:38.417Z
You may want to code your own popup and NOT use the flash messaging, as its a bit reserved for particular use cases in the CP. Per this conversation: https://github.com/craftcms/cms/issues/6218
cherrykoda
CC BY-SA 4.0
2023-09-21T01:23:21.427Z
2023-09-21T01:23:21.427Z
cherrykoda
<p>Is there a way to create a pop-up for when someone visits the site on the backend of Craft?</p>

CC BY-SA 4.0
2023-09-20T02:36:03.713Z
To be clear, someone logs into the Craft control panel, and you want a pop-up/modal to display in the control panel?
Brad Bell
<templating>
Can you create a pop-up in Craft?
# Can you create a pop-up in Craft?

(Asked by: username_0 on 2023-09-19)

Is there a way to create a pop-up for when someone visits the site on the backend of Craft?

**Tags:** templating
> **Comments:**
> **username_1**: To be clear, someone logs into the Craft control panel, and you want a pop-up/modal to display in the control panel?  

---

## 1 answers

### Answer by username_2 on 2023-09-21. Score: 1

Yes, you will need to build a custom module that's built for the admin panel. A starter on doing so can be found here:

<https://craftcms.com/docs/4.x/extend/>

I think what you'll want is to trigger some code on the LOGIN event, but only if that user is has access to the CP. A quick search in Craft's Events lookup (located here: <https://craftcms.com/docs/4.x/extend/events.html#event-code-generator>) reveals this might be the event you want (feel free to dig / try others):

craft\elements\conditions\users\LastLoginDateConditionRule::EVENT\_AFTER\_VALIDATE

Events Guide:
<https://craftcms.com/docs/4.x/extend/events.html>

You would write this in modules/Module.php (a pre-setup file in Craft CMS where you can code this) or your own custom equivalent.

> **Comments:**
> **username_2**: You may want to code your own popup and NOT use the flash messaging, as its a bit reserved for particular use cases in the CP. Per this conversation: https://github.com/craftcms/cms/issues/6218  

---

