# האם יש דרך להאזין לאירוע כניסת משתמש באמצעות רכיב Theme

**URL:** <https://meta.discourse.org/t/is-there-any-way-to-listen-user-login-event-using-theme-component/170976>\
**Category:** Development\
**Created:** [23 בנובמבר,‏ 2020,‏ 4:30am UTC](https://meta.discourse.org/t/is-there-any-way-to-listen-user-login-event-using-theme-component/170976 "2020-11-23T04:30:14Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Saurabh\_Khandelwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saurabh_khandelwal/32/156332_2.png) [@Saurabh\_Khandelwal](https://meta.discourse.org/u/Saurabh_Khandelwal)\
**Post date:** [25 בנובמבר,‏ 2020,‏ 11:16am UTC](https://meta.discourse.org/t/is-there-any-way-to-listen-user-login-event-using-theme-component/170976/11 "2020-11-25T11:16:03Z")

</div>

> [@Johani](#):
>
> Those properties don’t have setters; even if they did, your changes would only temporarily apply in the first window. Once the user visits the second tab, the data will be based on what’s stored in the database. Themes don’t have access to the backend; they can only change the frontend.

Hi, @Johani

Can we create a widget as shown below and call bootbox() within it.  
And after calling bootbox can we call “skipNewUserTips()” method. Which is also used by Discourse in the **header-notifications widget.**

```
<script type="text/discourse-plugin" version="0.8">
 const { h } = require('virtual-dom');
 const { ajax } = require("discourse/lib/ajax").default;
 const DiscourseURL = require("discourse/lib/url");
 const { userPath } = require("discourse/lib/url");

api.createWidget("welcome-popup", {
  tagName: "div.welcome-popup",
  html(attrs) {
      let user = this.currentUser;
      if (!user) return;
      if (
        !user.get("read_first_notification") &&
        !user.get("enforcedSecondFactor")
      ) {
          const title = `<div class="first-login-bootbox-title">You're a member. Welcome aboard!</div>`;
          const body = `<div class="first-login-bootbox-body">Now you can: </br> <ol class="user-suggestions"><li><a href="/new-topic" target="_blank" >Ask a question or start a discussion</a></li> <li><a href="/my/preferences/tags" target="_blank">Set up your notification settings</a></li></ol></div>`;
          bootbox.alert({
                        title: title,
                        message: body
                    });
            this.skipNewUserTips();        
      }
      return null;
  },

  skipNewUserTips() {

    ajax(userPath(this.currentUser.username_lower), {
      type: "PUT",
      data: {
        skip_new_user_tips: true,
      },
    }).then(() => {
      this.currentUser.set("skip_new_user_tips", true);
    });
  },
});
</script>

<script
  type="text/x-handlebars"
  data-template-name="/connectors/below-site-header/welcome-popup"
>
  {{mount-widget widget="welcome-popup"}}
</script> 

```

Discourse code for the header-notifications widget:  
[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/app/widgets/header.js#L101](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/app/widgets/header.js#L101)

Will it create any issue?

---

_[View the full topic](https://meta.discourse.org/t/is-there-any-way-to-listen-user-login-event-using-theme-component/170976)._
