We just started using NodeBB for our community https://www.mbatious.com/
NodeBB is rocking with an amazing user experience.
We just started using NodeBB for our community https://www.mbatious.com/
NodeBB is rocking with an amazing user experience.
@pitaj Thank you. Issue was with the condition. I have used condition as shown below which solved the problem.
post.posts[0].tid === 1090
@creatxr @julian Just tried this code, but, 'csrf_token' value is false. uid value is -1.
Tried the same query from a web browser, this time there is a csrf_token token returned and uid value is 0.
Why is this difference? How to avoid this in the python code?
@pitaj Thank you. Issue was with the condition. I have used condition as shown below which solved the problem.
post.posts[0].tid === 1090
Thank you all for the suggestions. I tried @PitaJ `s solution. This is what I have done:
In library.js in my custom theme, I added:
benchpress.registerHelper('isTaskList', function (post) {
return post.tid === 1090;
});
In lib/persona.js in my custom theme, in the $(document).ready event, i added:
templates.registerHelper('isTaskList', function (post) {
return post.tid === 1090;
});
And then in the templates/partials/topic/post.tpl, I have used:
<!-- IF function.isTaskList -->
as the condition
The condition is working as expected when the page is initially loaded for the posts that are loaded/displayed initially, however when I scroll down and when the further posts are getting loaded/displayed at the bottom of the page, the condition is not taking into effect. Could you please advise if something is missing?
@julian Thank you for replying. I am thinking of a small hack in that case. Let me know if this will work. What if I create a custom route and use a modified version of the original topic.tpl as its template?
var controllers = require('./lib/controllers'),
plugin = {};
plugin.init = function(params, callback) {
var router = params.router;
var middleware = params.middleware;
// Define the function that renders the custom route.
function render(req, res, next) {
// Get data object corresponding to the specific topic. The topic ID is fixed.
var data;
// This is the path to your template without the .tpl, relative to the templates directory in plugin.json
var template = 'my-custom-page'
// Send the page to the user.
res.render(template, data);
}
// This actually creates the routes, you need two routes for every page.
// The first parameter is the actual path to your page.
router.get('/my-custom-page', middleware.buildHeader, render);
router.get('/api/my-custom-page', render);
callback();
};
module.exports = plugin;
'data' needs to be filled with information about a specific topic. If this is possible, then how can I get the data object corresponding to a particular topic in the render function? Is there some function that can take a topic id as input and just return 'data'?
Is it possible to have a custom template for a particular topic (identified by a topic id)? Something like topic_tid.tpl somewhere in a plugin or theme? My intention is to be able to theme a specific topic and leave the remaining use the default topic template.
This app helps a lot. It works well with OneSignal notifications as well. But one doubt. When sending notification from OneSignal, when user clicks on the notification in mobile, can they be redirected to a page in the app?
@yariplus Thank you. This helps a lot.
Can it be achieved with some code changes in writeapi plugin? Could you help me with some starting point in code to achieve this?
Hi,
I tried to user Write API`s chat route /api/v1/users/<uid>/chats in order to chat with user using a bot. However every time when I am sending a message, it is creating a new chatroom. The POST operation onto /api/v1/users/<uid>/chats is creating a chat room & returning its id.
{"code":"ok","payload":{"content":"<p>Hello</p>\n","timestamp":1498844643722,"fromuid":18,"roomId":8,"messageId":133,"fromUser":{"username":"mbatious","userslug":"mbatious","picture":"/uploads/profile/18-profileimg.png","status":"offline","uid":18,"icon:text":"M","icon:bgColor":"#f44336"},"self":1,"timestampISO":"2017-06-30T17:44:03.722Z","newSet":true,"cleanedContent":"Hello\n","mid":133}}
However I am not finding a way use this roomId in further messages. The only parameters accepted in /api/v1/users/<uid>/chats API are message, timestamp & quiet. How to continue chat in a previously created room?
I tried to use the code mentioned in this topic, but am getting an error in console. Webpage where I added the code is: https://www.mbatious.com/recent
Error:
_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded. Make sure to configure the tracker via _paq.push before loading piwik.js. Alternatively, you can create a tracker via Piwik.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order. ["setCustomUrl", "https://www.mbatious.com/recent"]
Can anybody help me come out of this?