[nodebb-plugin-blog-comments] Blog Commenting Engine (Ghost, Wordpress widget)

  • @AOKP said:

    @Peter-Zoltan-Keresztes try to insert it right after the share section.


    After a sleepless night where I have reinstalled everything. New VPS, new blog, new nodebb and I am back at square 1 where out of 15 posts only on 3 I was able to enable the comments. On rest I am getting in the logs the 31/12 08:10 [6749] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me. It seam to me that nodebb cannot read the Origin header from most of the blog posts.

  • @Peter-Zoltan-Keresztes had the same in my logs though and it worked as I showed you yesterday.

  • Not sure what can I do. Right now I am using your exact same configs for node and ghost in nginx.

  • This post is deleted!

  • The latest updates fixed all the issues I had on enabling comments on most of the ghost blog posts.

  • Just a heads up for anyone else using this with Wordpress. After the latest update the categoryID variable in comments.php of your theme isn't optional. If it isn't defined publishing doesn't work.

  • Currently, I can't change the category id to another category. It's always posting to category id 1

  • @Hưng-Thành-Nguyễn are you using Wordpress or Ghost?

  • @overlawled
    Hi, I'm using wordpress

  • Plugin & Theme Dev

    I did a integration between forum.mysensors.org and my new open hardware sharing site https://www.openhardware.io using parts of the blog-comments plugin to allow commenting on each project.

    From the forum side: http://forum.mysensors.org/category/30/openhardware-io
    And from openhardware: https://www.openhardware.io/view/4/EasyNewbie-PCB-for-MySensors#tab-comments

    But as we have to keep title/tags in forum in-sync with the open-hardware-site I had to create a new endpoint which besides creating, also updates the post each time someone published changes. The publishing/update request is sent from our backend.

    Here is the interesting part of the code:

    Comments.publishProject = function(req, res, callback) {
    		var markdown = req.body.markdown,
    			title = req.body.title,
    			url = req.body.url,
    			commentID = req.body.id,
    			tags = req.body.tags,
    			uid = xxx;
                   if (req.body.token !== "XXXXXXXXXXXXXX") 
                          return res.json({error: "Unknown token"});
    		Comments.getTopicIDByCommentID(commentID, function(err, tid) {	
    			if (err || !tid) {
    				var hostUrls = (meta.config['blog-comments:url'] || '').split(','),
    					position = 0;
    				hostUrls.forEach(function(hostUrl, i) {
    					hostUrl = hostUrl.trim();
    					if (hostUrl[hostUrl.length - 1] === '/') {
    						hostUrl = hostUrl.substring(0, hostUrl.length - 1);
    					if (hostUrl === req.get('origin')) {
    						position = i;
    				var cid = meta.config['blog-comments:cid'].toString() || '';
    				cid = parseInt(cid.split(',')[position], 10) || parseInt(cid.split(',')[0], 10) || 1;
    					uid: uid,
    					title: title,
    					content: markdown,
    					tags: tags,
    					req: req,
    					cid: cid
    				}, function(err, result) {
    					if (!err && result && result.postData && result.postData.tid) {
    						posts.setPostField(result.postData.pid, 'blog-comments:url', url, function(err) {
    							if (err) {
    								return res.json({error: "Unable to post topic", result: result});		
    							db.setObjectField('blog-comments', commentID, result.postData.tid);
    							res.redirect((req.header('Referer') || '/') + '#tabs-comments');
    					} else {
    						res.json({error: "Unable to post topic", result: result});
    			} else {
    				topics.getMainPost(tid, uid, function(err, post) {
    					if (err)
    						return res.json({ok:false});
    					var payload = {
    						title: title,
    						uid: uid,
    						pid: post.pid,
    						content: markdown,
    						tags: tags,
    						options: { tags: tags }
    					posts.edit(payload, function(err, returnData) {
    						if (err)
    							return res.json({ok:false});
    						//errorHandler.handle(err, res, returnData);

  • Just wanted to point out that there are compatibility issues with the ns-plugin-ns-points plugin. The following error is thrown when accessing any of the posts on Ghost

    error: TypeError: Cannot read property 'uid' of undefined
    at nodebbpath/node_modules/nodebb-plugin-ns-points/app/filters.js:68:36

    It worked once I disabled the points plugin.

  • @overlawled said:

    Just a heads up for anyone else using this with Wordpress. After the latest update the categoryID variable in comments.php of your theme isn't optional. If it isn't defined publishing doesn't work.

    @overlawled @Hưng-Thành-Nguyễn Could you try to set var categoryID = 0; or var categoryID = null;? Any falsy value should work.

  • I have tried to use the plugin on multiple ghost platforms and it only works with the first blog entry. Anything special needs to be done?

  • Is anyone still using this plugin successfully on WordPress? Just having issues on my end, configured everything as noted in the readme, but am not even getting the "Publish Post to NodeBB" button to show in WordPress. @psychobunny @julian

  • Made a little progress by deactivating the recommended WordPress JSON API plugin and installing/activating Jetpack's JSON plugin. Also uninstalled then reinstalled the NodeBB Blog Comments plugin.

    Now I'm seeing the "Publish Article to NodeBB" button, but when I hit it, I get the following error:

    Internal error.
    Oops! Looks like something went wrong!
    Unexpected end of input

    Any thoughts on where I should be looking for the missing } or whatever it could be?

  • I've checked the syntax in several of the files, such as library.js, wordpress.js, and everything looks fine there. Still not sure where this error is originating. @psychobunny

  • @julian @psychobunny If anyone could even point me in the direction of any freelance NodeBB devs who would have experience with this plugin, I'd really appreciate it. Trying to get this working by this evening to meet a deadline. Thanks!

  • @psychobunny Has no one else experienced this error?

    Internal error.

    Oops! Looks like something went wrong!


    Unexpected end of input

  • Admin

    What version of Wordpress, JSON API and Jetpack did you try using? I'll install them and see if I can figure out what's going on

  • @psychobunny Thank you so much for the response.

    WordPress: v4.4.1
    JSON API by Dan Phiffer: v1.1.1
    Jetpack (JSON API) : v3.9.1

    Also, didn't know if the path in the following line could be a possible issue for my install, as the wordpress.js file in my setup is actually located in /node_modules/nodebb-plugin-blog-comments/public/lib/wordpress.js (I tried switching this out just in case, but no luck. just thought I'd mention it).

    nbb.src = nodeBBURL + '/plugins/nodebb-plugin-blog-comments/lib/wordpress.js';

    Once again, truly appreciate your help on this.

Suggested Topics

| |