#3327 closed defect (bug) (fixed)
BUG: Threaded replies not working if WordPress adminbar is disabled
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.6.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Component - Replies | Keywords: | |
Cc: |
Description
Reported in bbpress support
In bbpress 2.6.3 threaded replies only work if the WordPress adminbar is enabled. If it is disabled and you click a reply link of a lower level reply the page is reloaded which is not supposed happen. If you then post the reply, it is added at the end of the forum post and not after the corresponding reply.
The bug is in templates/js/reply.js line 109ff. If you remove the reference to the adminbar, threaded replies work properly.
The bug did not exist in bbpress 2.6.1.
Change History (7)
#2
@
3 years ago
I see the same error. Note the reply appears at the end of the topic because the JS error does not prevent the default action of the reply 'button' (actually a formatted a tag) which refreshes the page with the reply box at the bottom.
The following work-around works because it prevents the default action of the reply 'button':
// Prevent reply button in forums from executing a refresh of the page add_filter('bbp_get_reply_to_link', 'ctcFixReplyToLink', 10, 3); function ctcFixReplyToLink( $link, $r, $args ) { return str_ireplace( '"return addReply', '"event.preventDefault(); return addReply', $link ); }
templates/default/js/reply.js
Line 110:
if ( typeof ( adminbar ) !== 'undefined' ) {
should probably just be:
if ( adminbar ) {
Since document.getElementById() returns null if the ID is not found, and in JS, the typeof(null) is "object" not "undefined".