Paying for a plugin

General Discussion
  • Plugin & Theme Dev

    that doesn't seem too hard,

    @psychobunny can we add a filter.hook to augment the div.topic-buttons, if that's possible, then your plugin is just a matter of some minimal javascript/css work, assuming your server-side service is up and running, but ... even that would require editing the template.

    if not, it's doable by injecting a script tag, in the footer for example, via a plugin, but that will happen after-the-fact, make the ajax for each user and inject the button after the ajax.success happens
    .. that would also need to listen to for the infinite posts-load, which may also require a plugin.hook or, see if there any events that triggers, along with adding it for NEW posts, I am sure there is a socket event that happens, just not sure which one yet.

    The last and the most ugly thing I can think of, and don't try this at home, is to disable sanitizeHTML, and augment each post with a script tag, LOL -- , have it fetch the data, and maybe use localStorage is the user is the same, no seriously, dont do that.

    I think I could help, how urgent is this?


    I guess bottom line you have these options, I think:

    • Editing the template: hacky, will break with a NodeBB upgrade
    • inject a script in the footer, less hacky, probably your best option, it would still require some DOM selectors to be in there, but I think it's fair to assume so.
  • #4

    @psychobunny can we add a filter.hook to augment the div.topic-buttons

    I like this one most. A lot of other plugins could use this eventually

    p.s. this can go into the core, so it won't break future upgrades 🙂

  • Plugin & Theme Dev

    @psychobunny but it would still require template change, no?

    EDIT: I take that back, well, yea, .. would you do that just like the one?, accept an array of "elements" to append to the div.topic-buttons, I like that,

    We should also remember to pass the postData into the filter function, so plugins can use these data, just like @theepiphany's case, looking up user external data.

  • #6

    yeah but that template change will be added to the core 🙂

    it could be something like {topics.custom_topic_buttons} or something, and added similar to how the Cash MOD adds custom profile info to each topic row:


    and then your plugin would use that hook to add the new button

  • Plugin & Theme Dev

    yup that's exactly what I was thinking, awesome.

    @theepiphany keep in mind that in your case, the post-show will be delayed until the yourservice.php request call comes back, so you should try to minimize your request's latency.

  • #8

    We should also remember to pass the postData into the filter function, so plugins can use these data, just like @theepiphany's case, looking up user external data.

    yeah I think the custom_profile_info one sends the uid and pid in if I'm not mistaken

  • #9

    @bentael Right. In my case it calls out to an external API and takes some time to load anyway so I have it display an animated loading GIF until its ready to be displayed anyway.

  • Plugin & Theme Dev

    @theepiphany, so what NodeBB_Data does the "button" require, uid? (userId), username ? if that doesn't require ajax, then showing the button is quick, then when the button is clicked, .. you can .. maybe trigger a modal or a popup, with a spinner that loads the content, onButtonClick, rather than onPostShow, am i right?

    seems pretty straight forward, I can probably help you next week if you want, not this one.

  • #11

    @bentael It would take the data from a custom field that the user can edit in their profile.

  • Plugin & Theme Dev

    @theepiphany got it -- still doable. buzz me if you still require help.

Suggested Topics

  • 0 Votes
    3 Posts

  • 0 Votes
    3 Posts

  • 0 Votes
    3 Posts

  • 1 Votes
    5 Posts

  • -1 Votes
    4 Posts

| | | |