Up,
Can anyone help me, please?
Landa
Posts
-
Redirection to route in plugin -
Redirection to route in pluginI'm up to date, in fact I wrote your commit in my nodebb core yesterday.
2- Now I rewrite the code and I have This
[...] if(topicTitle.indexOf('+hd') >= 0) { //Contiene la etiqueta +HD if (userid <= 1 || tagsTitle.postCount == 0 ) { //Redireccionar callback({ status: 302, path: '/topicerror' }, postContent); } } [...]
But console give me the same error, ''error: [plugins] filter:topic.get, undefined''
-
Redirection to route in pluginWell, Now I have this code:
plugin.filterTopicGetMethod = function (postContent, callback) { if(awesomeCondition == true ) { //Do a redirection callback({ status: 302, path: '/topicerror' }); } callback(null, postContent) };
And the console give me this error:
-
Redirection to route in pluginThanks for your colaboration, I'm going to try this
-
Redirection to route in pluginThe GitHub project
-
Redirection to route in pluginI have a plugin that executes a
"filter:topic.get"
I need to doing a redirection to custom server route
(localhost:4567/topicerror)
when a "if clause" is true.I need that
plugin.filterTopicGetMethod = function (postContent, callback) { if(awesomeCondition == true ) { //Do a redirection } callback(null, postContent) };
What is the way for doing this?
Thanks
-
What is the problem in this library.js?Thanks, problem solved, it was the nodebb version. Now I have 0.6.1
-
What is the problem in this library.js?I have this
var tagsTitle = {}; tagsTitle.init = function(params, callback) { var app = params.app; var controllers = params.controllers; callback(); }; module.exports = tagsTitle;
But the console give me this error:
"Type error: Object is not a function at Object.tagsTitle.init"
What is the problem?
Thanks for the help
-
Do an action when users go to topicsThanks, I have just solved the error.
But the code doesn't work for now. How can I do execute a function when user go to topic?
Thanks
-
Do an action when users go to topicsHello guys. First I need apologize for my bad expression because in this moment I'm learning English and my control of the English language is very poor.
My problem is the next, I'm developing a plugin that allows users to write special tags in title (For example, "+nsfw" or "+private". This tags grant some features to post. What hook do I need use?
In this moment I have that, but it doesn't work.
Plugin.json
{ "id": "nodebb-plugin-tagstitle" , "name": "Special Tags in Title for NodeBB" , "description": "This plugin allows users create new topics with special restrictions with special tags, for example, +hd, +prv, +nsfw..." , "url": "https://github.com/rbbau/nodebb-plugin-tags-title" , "library": "./library.js" ,"hooks": [ { "hook": "filter:category.topics.get", "method": "goPage" }, ] }
Library.js
Topics = module.parent.require('./topics'), User = module.parent.require('./user'), var TagsTitle = {}; TagsTitle.goPage = function(postData) { //Conseguimos el título del post en minúsculas var topicTitle = function() { var topicTitle = postData; var topicTitleLower = topicTitle.toLowerCase(); return topicTitleLower; }; alert(postData); //Analizamos si existe el título o no para aplicar medidas if(topicTitle == null) { //Don't do anything console.log('Título sin etiquetas'); } else { console.log('Título con etiquetas'); if(topicTitle.includes('+hd') == true) { //The topic titles contains +HD } else if(topicTitle.includes('+prv') == true) { //The topic titles contains +prv } else if(topicTitle.includes('+18') == true) { //The topic titles contains +18 } else if(topicTitle.includes('+nsfw') == true) { //The topic titles contains +nsfw } } } module.exports = TagsTitle;