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


  • @psychobunny

    <?php
    if ( post_password_required() )
        return;
    ?>
    <span id="nodebb-comments-count"></span> Comments
    <a id="nodebb/comments"></a>
    <script type="text/javascript">
    var nodeBBURL = '//community.domain.com',
        articleID = '<?php echo the_ID(); ?>',
        categoryID = 5; // OPTIONAL. Forces a Category ID in NodeBB.
                         //  Omit it to fallback to specified IDs in the admin panel.
    
    (function() {
    var nbb = document.createElement('script'); nbb.type = 'text/javascript'; nbb.async = true;
    nbb.src = nodeBBURL + '/plugins/nodebb-plugin-blog-comments/lib/wordpress.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(nbb);
    })();
    </script>
    <noscript>Please enable JavaScript to view comments</noscript>
    

    Thank you so much again for your help. It's much appreciated.

  • Admin

    Your problem with the original JSON API was that the publish button didn't show up right?

    Could you reactivate that and then move the code above this line

    <?php
    if ( post_password_required() )
        return;
    ?>
    

    See this I'm willing to bet its false, and so the code below would never show up


  • @psychobunny I actually reactivated the original JSON API (and deactivated Jetpack's) prior to your last post, and the publish button was still showing. Don't know what I had done to screw it up the first time, but even without moving the code, it does show. (Still outputs the error, though).

    Moved all of the contents in comments.php above the code you mentioned, and still getting the same "Unexpected end of input" error. 😕


  • @psychobunny may be another silly thing to ask, but thought I'd give every piece of information I can, however irrelevant it may seem, just in case.

    I'm logged in as admin on both Wordpress and NodeBB, both accounts have the same name, etc. Didn't know if there were any stringent requirements with respect to these accounts needing to be identical in some way in order for the publishing to be authorized by NodeBB.


  • @psychobunny trying to think of any additional info I could provide regarding my setup or the error itself. Please let me know if I have yet to elaborate on some piece of info that could help in pinpointing the error.

  • Admin

    I doubt that's the issue, but I'm finally getting a chance to work on this in about an hour. Will let you know


  • @psychobunny thanks. Just thought I'd mention those points in case it brought something to light. And again, much appreciated.

  • Admin

    By any chance, is this a subfolder install (for WP?) ex. http://domain.com/wordpress


  • @psychobunny nope, it's not.

  • Admin

    Okay, updated to 0.5.0

    • Fixed a bug with wordpress subfolder installs (please re-copy the code in the readme into your comments.php file)
    • Fixed for the latest version of JSON API (I'm not exactly sure when they changed the structure, but this version should work on 1.1.1 or higher)

    Hope it works for you 🙂


  • @psychobunny you're the man. Thank you SO much. 😀 Working perfectly.

    One final question: at the risk of continuing to show my newbie card, could I please ask where the following line needs to be added for WordPress posts to display NodeBB author info?

    Published by <span id="nodebb-comments-author"></span> in <span id="nodebb-comments-category"></span>
    

    I'm assuming it would just need to be inserted once into a PHP file in the WordPress install?

  • Admin

    You can put it anywhere in the theme that you like. Most probably in single.php. If you want it below the header maybe somewhere below get_header(); ?>, or if near the bottom somewhere above <?php get_sidebar( 'content-bottom' ); ?> (might not exist depending on your theme, but I think you'll figure it out)


  • @psychobunny thank you for the clarification. Just wanted to make sure it was only needed in one place without any additional setup or configuration. Once again, thank you for taking the time to look at this!


  • @psychobunny is there any reason why WordPress 4.4.2 would cause issues with this fix? I've used it successfully on two sites running 4.4.1, and tried a third running 4.4.2 and getting the original error message (strangely, some of the time it doesn't load the "unexpected end of input" error message but rather

    {"error":"Unable to post topic"}
    

  • Nevermind - still wasn't able to figure out what was causing the error to still be present on this particular install, but I decided to do a clean install of NodeBB and it's working perfectly just like the other setups. Thanks again!


  • @psychobunny After confirming that the new setup worked perfectly with the plugin, I configured the WordPress install and tried publishing the series of posts I had lined up. Again, I got this as a response:

    {"error":"Unable to post topic"}
    

    After rocking back and forth in the corner for a minute or so, I figured out what the issue was this time around. 🙂 I didn't realize that the plugin carried over the tags from the WP post, and every post I was trying to publish over to NodeBB had >5 tags, which led to NodeBB rejecting the new topic. I simply increased the default max # of tags allowed in the NodeBB ACP, and voila - problem solved.

    Thought I'd post this in case it can save anyone else a bit of time in the future!

  • Admin

    Ah. Good catch. There are a few other gotchas ex. if the title was too short. Happy to get some PRs on this otherwise I'll do a better error page next time I update this


  • hmm it was working for some time now again I am back to the same situation where when I try to enable on a blog post I get {"error":"Unable to post topic"} and in the nodebb logs all I see it's 6/2 13:31 [20304] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: https://z0z0.me


  • aparently the increasing the number of comments worked for me too.


  • @psychobunny Quick question - in what file would I be able to change the source image for the default avatar shown (before a user is logged in/registered)? Having a hard time locating it. Thanks again!

Suggested Topics

| |