• I wish to use this hook in my plugin to get data from the user given with a custom profile field in the edit page.
    I've taken a look at @psychobunny nodebb-plugin-cash plugin in order to get an idea of how it works since it's the only plugin around here doing this. (but actually not really).
    I've tried to console.log(data) on this hook and console.log('In the hook') to see when it gets fired and the answer is never 😞
    I've successfully created an api page that displays data (but I have none for now) based on user uid.
    I just want to be able to create the input and then treat the data.

    Help would be lovely.

  • Plugin & Theme Dev

    According to the docs it gets called once a user gets created to allow you to modify what gets into the DB.

    I can't see where nodebb-plugin-cash adds an input to the profile edit-page.

    The only I know about is that nodebb-plugin-shoutbox uses custom user-settings (settings-page) you may try your luck with these hooks, even so they don't seem to be listed in docs (pinging @Developers because of this (I don't even know if they get pinged with this mention o_O )):
    filter:user.settings
    filter:user.getSettings
    action:user.saveSettings

    I guess the @Developers are going to add appropriate hooks for the user-info (if they didn't do yet, also undocumented) since there is such a request now. 😄


  • @frissdiegurke Thanks a bunch I'll take a look at the settings even if I prefer to have it in the edit options.
    If this hook gets fired only when a user register, that means already registered users can't have the new field. That's a problem because a plugin can be activated after your forum is created.

    And yes nodebb-plugin-cash don't add an input to the user profile but a field (inside the data object) so basically If in your template you create a new input with data.currency as value you can retrieve the user money (not modify it though since the record is only place on posting).

    @Developers is there a way to add custom user fields after user profile creation, if there's not such a thing that would be great 😄

  • Plugin & Theme Dev

    for the case your plugin gets activated after user-creations you'd have to use the hook action:plugin.activate (take care to compare the id you'll get with your plugins id since this fires for each plugin).
    The following is the way I'd go within, maybe there is a more simple (or better performance) way:
    Get somehow all user-ids (personally I don't know how, maybe this would help) and use the function setUserField of the user-module to set each users field-value.

Suggested Topics

  • 2
  • 1
  • 4
  • 1
  • 4
| |