• Anyone out there interested? I wanted to tackle it myself but these next few weeks are proving to be busier than I hoped, and having never worked with node or nodebb before this forum it might just be easier to have someone else do it for me.

    Essentially I have a php page that when you query it like: example.php?name=blah, it returns content. I want that content being displayed in a mouseover tooltip which would be displayed in a button beside the users name on each post. Right now I have this working fine on a website using qTip (http://qtip2.com/), and I'm not sure if it would be as easy as taking that code an implementing it to work inside of nodeBB or not.

    example.jpg

    As an example, the above text "example" would be a custom profile that the user can edit, and that would trigger the qtip upon mouseover. The user can also select the color of the button from some presets (if possible).

    If this is something you think would be reasonably affordable and you can do it, feel free to reply here then fire me a message. I'll give more details there on whats needed in terms of specifics, and show you my working example.

    Thanks!

  • Admin

    If anybody in the community is interested in doing this then feel free to jump in - would love to build an ecosystem of supply and demand for custom nodebb plugins, etc. 🙂

    if you get no bites, send us an email at sales [at] nodebb.org and we can talk 🙂

  • 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 on.post.load, 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?

    EDIT:

    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.
  • Admin

    @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 header.build 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.

  • Admin

    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:

    https://github.com/psychobunny/nodebb-plugin-cash/blob/master/plugin.json

    filter:posts.custom_profile_info

    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.

  • Admin

    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


  • @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.


  • @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

| |