Hook Request Thread
-
3:43:19 AM dove: Hi. Can filter:scripts.get hook be used for external js from other website? I tried including local file and it works, but external scripts doesn't seem to work, maybe I need to set some params in function etc. to load it, but not sure how
10:06:40 AM You: hey dove, it won't work because scripts.get adds those scripts to the minifier and serves the compiled js file
You: I think maybe adding some sort of check to see if http(s) is part of the string could be straightforward to do -
It's not really a request, more like a question regarding filter:scripts.get.
I only want to include a script if an admin page is rendering. Is there any simple way to figure it out?
-
On my way out, but...
$.getScript()
, perhaps?Actually, now that I think about it, perhaps it might work best if you did something like this:
require(['plugins/nodebb-plugin-yourplugin/exportedScript.js'], function(myScript) { });
Not sure if that's possible though hm...
-
Well I could add a script which gets a second script if the location is something admin something, but it might be an overkill.
Are scripts loaded in scripts.get not supposed to be loaded in admin pages?
-
ajaxify.go, with a data argument on which page etc.
I was also thinking of a hook in the composer.js, since we want to replace the current username mention autofill with our own: http://i.imgur.com/a5FnTOJ.png, but we could also create a pull request to use our version instead, if you'd like? We would need some help on properly implementing it though. -
I'm looking for a hook to add custom fields to a profile page the user can edit themselves.
Also not sure how to include scripts in the admin panel (as scripts.get doesn't do it).
-
@julian I have an idea for it, will try it out soon.
Edit:
It works! Now I can almost completely implement autocomplete from within the plugin. Maybe you can help me out on a database function that can do a like search on the users? Our way is currently very ugly because we don't know a lot from mongo and redis (especially redis)
https://github.com/BitBangersCode/NodeBB/blob/master/src/database/mongo.js#L789
https://github.com/BitBangersCode/NodeBB/blob/master/src/database/redis.js#L409 -
filter:topic.get or filter:topic.parse
I would like to make a thread prefix plugin. I've added the topic.get hook, but I don't really need the whole topic data to do what I want, so I thought I'd look for some input from you guys. If you want that hook anyway, I'd be happy to submit a pull request.
-
yes please do, the more hooks the better
-
@BarveyHirdman said:
Also not sure how to include scripts in the admin panel (as scripts.get doesn't do it).
Also, this.
-
Hi guys,
We're looking to possibly add a hook at the point where a user confirms their email address ('action:email.confirmed'?) so that we can update external user data stores. We'd also need to hook into User profile updates too.
Any plans to include this already? Happy to PR when we eventually get round to implementing this.
As a side note: are there any guidelines/rules-of-thumb regarding where you're happy for hooks to be fired?
Cheers
-
Makes sense to me. If you need it in your plugin feel free to submit a PR and I'll gladly merge it in
-
Can I have a filter hook that can process the raw HTTP request from users? I'm wondering if I can use this to do something with the request headers before NodeBB processing everything.(sorry for my bad English...)