How to send alerts to users after user creation?

  • @bentael hey I am trying to use app.alert inside my plugins function but it throws an error "ReferenceError: app is not defined". Whereas it working perfectly fine inside my plugins template file. I am trying to add a notification to the user when he has created his account. I am using plugin hook available action:user.create. The plugin is getting fired when new user is registered but the app.alert is not working.
    Is there a way to use global app object inside my plugins file?

  • GNU/Linux Admin

    Hi @vatsal, I just forked your post 🙂

    The app object is only available client-side, so when you are on the server side listening for the action:user.create hook, you'll have to use the socket library to emit a message to a user instead:'user/' + uid).emit('event:alert', {
      title: 'test',
      message: 'something'

    ^ Untested, by the way

  • @julian thanks for your quick response. BTW, is there no way to use global app variable inside my plugin module? I was just curious.

  • GNU/Linux Admin

    No, in your plugin's library.js (or whatever you named it), you're on the server-side, which is completely separate* from the client-side.

    * For all intents and purposes, anyway

  • @julian I want to know how we can use client side hooks. I want to check some condition from user data and show a notification when every time he is logged in. The hook "action:connected" is not triggering if used like other "non" client side hooks.

  • This post is deleted!

  • @julian it's just that I want to show the logged in users a notification about confirming their email. For which I am using "email:confirmed" hash key . Not able to show the notification to the user after logged in state as there is no hook currently which can be executed just after someone is logged in.

    Any help with this regard would be highly appreciated, thanks.

    P.S.: I think this could be also a feature for upcoming release of NodeBB.

  • GNU/Linux Admin

    Would a server-side hook be all that you need?


    julianlam created this issue in NodeBB/NodeBB

    closed action:user.loggedIn hook #2112

Suggested Topics

  • 5
  • 4
  • 1
  • 3
  • 1
| | |

© 2014 – 2022 NodeBB, Inc. — Made in Canada.