# Bootbox is now deprecated

**URL:** https://meta.discourse.org/t/bootbox-is-now-deprecated/244902
**Category:** Development
**Created:** [November 8, 2022, 7:50pm UTC](https://meta.discourse.org/t/bootbox-is-now-deprecated/244902 "2022-11-08T19:50:23Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [December 13, 2022, 9:55pm UTC](https://meta.discourse.org/t/bootbox-is-now-deprecated/244902/7 "2022-12-13T21:55:33Z")

</div>

Hi Tim,  
Here’s the alternative, note that the contents here needs to go in an initializer JS file in a component. You can see a simple example of a full component structure [here](https://github.com/discourse/discourse-default-composer-category).

```js
import { withPluginApi } from "discourse/lib/plugin-api";
import { getOwner } from "discourse-common/lib/get-owner";
import { schedule } from "@ember/runloop";
import { htmlSafe } from "@ember/template";

export default {
  name: "tester-initializer",

  initialize() {
    withPluginApi("0.8", (api) => {
      const currentUser = api.getCurrentUser();

      if (currentUser) {
        const userGroups = currentUser.groups.map((group) => group.name);
        let showPopup = false;

        switch (true) {
          case userGroups.includes("admins"):
            showPopup = true;
            break;
        }

        if (!showPopup) {
          return;
        }

        const alertHeading = "Oh no!";
        const alertBody =
          'Your account is currently restricted and you no longer have access to valuable resources. <a href="https://meta.discourse.org">Click here</a> for more information.';

        schedule("afterRender", () => {
          // delay needed so that the dialog service is loaded
          const dialog = getOwner(this).lookup("service:dialog");
          dialog.alert({
            message: htmlSafe(alertBody),
            title: alertHeading,
          });
        });
      }
    });
  },
};

```

Hope this helps.

---

_[View the full topic](https://meta.discourse.org/t/bootbox-is-now-deprecated/244902)._
