Skip to:
Content
Pages
Categories
Search
Top
Bottom

Threaded Replies not working

Viewing 22 replies - 1 through 22 (of 22 total)

  • mrapino
    Participant

    @mrapino

    I am having the same issue. Can anyone chime in that knows what might be happening here? It doesn’t seems like it is working on these support forums either.

    Thanks!


    mrapino
    Participant

    @mrapino

    Hello … I opened the Chrome dev console, and hitting the reply link gives me a JavaScript error:

    reply.js:18 Uncaught TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.
        at Object.moveForm (reply.js:18)
        at HTMLAnchorElement.onclick ((index):242)​

    Is this a known bug?


    dwinnbrown2
    Participant

    @dwinnbrown2

    Interesting, I’ve not even managed to get that far on my site. It could be however that there’s another js error earlier up on the page…


    mrapino
    Participant

    @mrapino

    Actually, I spoke too soon, but maybe you have a similar issue.

    My threaded replies are not working due to a plugin conflict.

    I discovered this by disabling plugins one by one, and testing threaded replies after each disable.

    My conflict is with Toolset Layouts.

    Perhaps yours is a plugin conflict, as well.


    dwinnbrown2
    Participant

    @dwinnbrown2

    Hmmm possible I will test it out although there aren’t many plugins to disable! Did all the replies you’d made instantly thread themselves once you’d disabled the plugin or did you have to keep creating new threaded replies?


    mrapino
    Participant

    @mrapino

    Hey there … I got mine working.

    There is a file in the bbPress plugin folder

    plugins > bbpress > templates > default > js > reply.js

    On line 18, there is a line of code that is throwing a JavaScript error every time the “reply” link is clicked.

    reply.parentNode.insertBefore(respond);

    I basically commented this line of code out, and threaded replies are working again.

    I have no idea if this line is needed, but it got rid of the error, and there are no new errors to speak of.

    I wish a plugin developer would chime in here, but that doesn’t seem likely.

    I hope this helps you.

    If anyone else reading this know what this line does, and why it was causing the error, please let us know.


    mrapino
    Participant

    @mrapino

    Actually, I figured out what line 18 does.

    I made a change. Instead of commenting it out, I edited it to be:

    reply.parentNode.insertBefore(respond, reply);

    I added “reply” as the second argument being called.

    After I did this, the response box, where you put your comment now moves to right under the post where you click reply.

    Check it out, and let me know if oyu get it working.

    Cheers!


    dwinnbrown2
    Participant

    @dwinnbrown2

    Thanks! Will give it a go on my site later.


    mrapino
    Participant

    @mrapino

    One last thing … so the change doesn’t get overwritten when you update the plugin, copy the entire ‘reply.js’ file, and put that copy in a ‘js’ folder in your theme’s main folder …. so if you’re using TwentySeventeen, as an example, the path would be ‘Themes/TwentySeventeen/js/reply.js’.

    Then you’ll be safe.


    Robin W
    Moderator

    @robin-w

    @mrapino

    I wish a plugin developer would chime in here, but that doesn’t seem likely.

    I’m not sure how often they visit, but looks like you done some great stuff here.

    I’ve made a note of this thread and I’ll post a trac ticket (bug report) shortly

    Can you just confirm what version of bbpress you are using, and if not bbPress 2.6 Release Candidate 3, can you just check that the code is not improved in this – you’ll do this much faster than me.


    dwinnbrown2
    Participant

    @dwinnbrown2

    No luck I’m afraid


    mrapino
    Participant

    @mrapino

    Robin,

    I am using Version 2.5.13, directly downloaded from the WP Repository. There doesn’t seem to be an update pushed to the repository yet. I usually don’t install non-production versions on a production website.

    dwinn, I’m sorry to hear that you are having a different issue than I am having. Can you please check the console in Chrome Dev Tools to see if you are getting any errors either before, or when you click the ‘reply’ link?

    Thanks!


    mrapino
    Participant

    @mrapino

    Robin,

    As far as Release 2.6 Candidate 3, the line of code in reply.js on/near line 18 is still the same:

    reply.parentNode.appendChild(respond);

    I changed it to:

    reply.parentNode.appendChild(respond, reply);

    Which seemed to do the trick.

    However, I am unsure what else would be affected by this change, as I am unfamiliar with the core code of this plugin.

    Please submit any or all of my comments about this here. My issue is fixed, and I hope it helps others.

    Cheers!


    mrapino
    Participant

    @mrapino

    dwinn,

    I just checked your website, and you have an error in the console:

    Uncaught ReferenceError: jQuery is not defined
        at (index):17

    jQuery not being define can have very negative effects on a website.

    Hope this helps!


    dwinnbrown2
    Participant

    @dwinnbrown2

    jQuery is defined but for some reason some script has been inserted into the head of the page and is loaded before jQuery. Is it possible to call jquery in the first line of the header do you know?


    mrapino
    Participant

    @mrapino

    I’d say this is an appropriate article on how to properly enqueue jQuery:

    How to Properly Add jQuery Scripts to WordPress

    Also, if you know what script is inserting itself above jQuery, and you have control over how it is enqueued, make sure you enqueue to the footer:

    wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );

    Make sure your ‘$in_footer’ is TRUE:

    wp_enqueue_script('script-handle', plugins_url('js/script.js' , __FILE__ ),'','1.0',true);


    dwinnbrown2
    Participant

    @dwinnbrown2

    Thanks for this although I am well aware of how to enqueue jQuery scripts. The issues is that I don’t know what script it is that’s being inserted that early on – I will have to test it out some more.


    heppusiel
    Participant

    @heppusiel

    I just try latest version of BBPress, and this problem exist. Is there any fix coming? Codes above didn’t work for me.


    Robin W
    Moderator

    @robin-w

    ok, so

    1. Save the attached code to your pc, as a new file called reply.js
    2. Create a directory on your theme called ‘js’, and copy the renamed file reply.js to it, so that you end up with wp-content/themes/%my-theme%/js/reply.js

    where %my-theme% is the name of your theme

    Let me know if this works

    addReply = {
    	moveForm : function(replyId, parentId, respondId, postId) {
    		var t = this, div, reply = t.I(replyId), respond = t.I(respondId), cancel = t.I('bbp-cancel-reply-to-link'), parent = t.I('bbp_reply_to'), post = t.I('bbp_topic_id');
    
    		if ( ! reply || ! respond || ! cancel || ! parent )
    			return;
    
    		t.respondId = respondId;
    		postId = postId || false;
    
    		if ( ! t.I('bbp-temp-form-div') ) {
    			div = document.createElement('div');
    			div.id = 'bbp-temp-form-div';
    			div.style.display = 'none';
    			respond.parentNode.insertBefore(div, respond);
    		}
    
    		reply.parentNode.insertBefore(respond, reply);
    		if ( post && postId )
    			post.value = postId;
    		parent.value = parentId;
    		cancel.style.display = '';
    
    		cancel.onclick = function() {
    			var t = addReply, temp = t.I('bbp-temp-form-div'), respond = t.I(t.respondId);
    
    			if ( ! temp || ! respond )
    				return;
    
    			t.I('bbp_reply_to').value = '0';
    			temp.parentNode.insertBefore(respond, temp);
    			temp.parentNode.removeChild(temp);
    			this.style.display = 'none';
    			this.onclick = null;
    			return false;
    		}
    				
    		try { t.I('bbp_reply_content').focus(); }
    		catch(e) {
    			
    
    			
    			
    		}
    		
    		
    
    		return false;
    	},
    
    	I : function(e) {
    		tinymce.execCommand('mceFocus',false,'bbp_reply_content');
    	}
    	
    	
    	
    }

    ams047
    Participant

    @ams047

    I am still fairly new and finding my way around, but found your fix gets rid of the error.

    However, the comments in this thread suggested that the reply comments box appears below the comment which is being replied to, which your code does not. Instead the comment box appears at the end of the thread.

    Restoring I() in reply.js to “return document.getElementById(e);” (from “tinymce.execCommand(‘mceFocus’,false,’bbp_reply_content’);”) fixes that. I tried tinymce.execCommand(‘mceFocus’,false,e); which seemed to be more appropriate but that did not work either.


    Norman Cates
    Participant

    @normancates

    Hi ya,
    bbPress newbie here.

    I’ve found a similar problem where if I click reply on a topic post, then it drops me down the page. In the Chrome console I see this error:

    Uncaught ReferenceError: addReply is not defined
    at HTMLAnchorElement.onclick (VM3866:1501)
    ———-
    And then clicking on the “(VM3866:1501)” link gets this:

    return addReply.moveForm(‘post-369′,’369′,’new-reply-368′,’368’);

    ————–

    I tried adding the above fix to the reply.js file, but that didn’t work.

    But based on that error, I’m assuming that something else is removing that bit of the JavaScript…

    Or there’s a scope problem?


    ams047
    Participant

    @ams047

    Are you sure reply.js is being loaded by chrome? You should be able to see quickly enough under the “Sources” tab of the Developer Tools (Ctrl+Shift+I) – from where you uploaded the replacement reply.js. Possibly a permissions thing?

Viewing 22 replies - 1 through 22 (of 22 total)
  • You must be logged in to reply to this topic.
Skip to toolbar