@yariplus said in Noob Plugin question: Alterin error message on filter hook.:
Yep, you can use this function here the same way.
https://github.com/jarey/nodebb-plugin-tagstitle/blob/master/library.js#L17
Just declare it at the global scope so that your hook can see it.
Thank you very much @yariplus ; I achieved what i needed thanks to your help.
I was able to see my custom page with my custom messages like you pointed out.
Then, because i only wanted to change the message displayed on the 403 error regarding the logic on my plugin i was able to change it to using another method; only if it could help anyone else, i just imported the helpers module and called the function notAllowed with my custom message:
var helpers = require.main.require('./src/controllers/helpers');
// filter:topic.build
tagsTitle.topicBuild = function (data, callback) {
if (data.templateData.privileges.errorMessage) {
helpers.notAllowed(data.req,data.res, data.templateData.privileges.errorMessage);
}else{
callback(null, data);
}
};
Thanks again. I learned a lot of basic stuff just trying your suggestions.
Kind regards.