Fixing Brians Threaded Comments Plugin
Brians Threaded Comments Plugin is perhaps the most popular among the WordPress blog users due to functionality it provides and a huge enhancement to standard comments system that comes with WordPress. Problem is - the plugin is Not Well Supported and has quite a few bugs.
In fact if you simply decide to use what is provided you will run into quite a few issues and since the plugin is hard to customize if you are not a programmer it might be more problems then one can handle. Well fear not - I have spent a few hours of researching, fixing and testing and want to present you with resulting file. Now you too can have Brians Threaded Comments on your blog, minus all the issues…
As always I want to make a disclaimer here. What is presented below is currently used on my blog and fully tested but I can’t guarantee for 100% it will work on yours. Before doing ANYTHING - make sure to backup current comments.php file that comes with your blog theme.
This post assumes that you are working with latest officially available version of the Brians Threaded Comments Plugin - 1.5.12. I have not tested previous version and have no clue if this tutorial will work for you or not. Before doing anything else - install that version…
Everything below provided AS IS. Take it or leave it at your own risk and please don’t ask for support.
Brians Threaded Comments Problem List
In this section I want to outline the issues I have fixed following multiple guidelines I have found on the net and provide a link to original authors, where available to give them credit for addressing it.
1. Fixing Brians Threaded Comments “Cancel” Issue - was provided on John Chow blog and while John provided a nice explanation I wanted to add a simple graphic details to it to simplify the work for you - not all of us technically savvy. Click on image below to open full view in new window and see fix details below image:

- Step 1: Open Admin->Plugins->Plugin Editor and click on Brians Threaded Comments to open for editing (some hosts might require that you chmod the file to 666 or 777 prior to be able to do so).
- Step 2: Locate reRoot() function and replace content with content-main as shown in image. Hint: pay attention to position of sliding bar on image above to locate the function you need.
2. Separate Trackbacks From Comments in Brians Threaded Comments was provided by Tim Nash (who by the way has a great blog that I frequently read).
3. A few fixes borrowed from NSpeaks, even though author no longer uses plugin himself his fixes work nicely and here is list of what I have addressed using his guide:
- Admin Is Now Recognized by plugin
- Double Subscribe To Comments Option Removed
- Comments Moderation text Added
Enhancements To Brians Threaded Comments
To make the commenting system more interactive and protected I have added some enhancements that will require installation of couple plugins. But if you decide Not To Use Them - I provide 2 versions of the file you can use: with and without enhancements:
- MyBlogLog avatars integrated into comments system. This enhancement requires that you have installed MyAvatars plugin. I feel that this one is a very nice option I simply didn’t want to go without and it adds avatar at the bottom right corner of the comment. You can see it in image below or comment to see how it works - please be aware - all test comments will not be allowed

- Math Comment Spam Protection integrated into Brians Threaded Comments. This one is a rather nice companion for Akismet and its integration requires that you have the Math Comment Spam Protection installed. One added it will save you a lot of administrative grief by removing bot SPAM submission.
Fixed Brians Threaded Comments Download
As I have mentioned I will provide below 2 files with all afore mentioned integrated: 1 with enhancements and one without. But the installation is same for both:
Files below proved as Text Files. Simply download one that you need to your computer, rename it as comments.php (comments-enhanced.txt to comments.php) and then upload and replace your current theme comments.php file. Make sure to back up your current comments.php file in case you decide you don’t like what you get and want to go back to your original system!
Download Fixed Brians Threaded Comments - no enhancementsDownload Fixed AND Enhanced Brians Threaded Comments
Please be advised I don’t try to claim ANY credit and simply provide the files for convenience of other people. All credit belongs to its author and many thanks go out to guys who provided the multitude of fixes I have integrated and present above. Enjoy.
UPDATE:
I have reworked the fix based on comments I have received and providing a new file download, it has all the enhancements but they are using “optional statements”, meaning if function doesn’t exist because you simply don’t have the plugin - it will be ignored.
Also make sure to watch the video that outlines entire process below:
| 2.5 |
If you're new here, you may want to subscribe to my RSS feed. Or click here to learn What is RSS And Why You Should Subscribe. Thanks for visiting!
Related posts
If you like this post subscribe to Full Text RSS feed and read news at your leisure or get daily posts conveniently delivered to your inbox by Subscribing via Email (requires confirmation)
Technorati Tags: blog, brians threaded comments, comments system, community, plugin, video-tutorial, WordPress, wordpress-plugins

I haven’t got around to completely sorting out my comments but its nice to see people fixing and expanding the idea, one further enhancement I would suggest is much of the CSS hidden in Brians code can be placed in your themes CSS file and those that require a bit of PHP can either be removed or just kept as they are.
Thanks for the link glad you like the blog.
Tim Nash’s last blog post..Green Screen production
Tim,
Yes, that would be a next logical step
I have looked at it as well as externalizing the Javascript that currently comes with the plugin - its quite hefty right now… but never got to it and since I don’t know WHEN I might be able to - I just provided what I have.
Alex
Moving the CSS is not to bad, took about 10 minutes but the javascript I would leave where it is for the time being
Still I did notice a huge speed increase with just moving the CSS so worthy you doing.
Tim Nash’s last blog post..Green Screen production
Yeah, actually you were right. Just copying the css statements into my theme style.css and removing it from briansthreadedcomments.php file did the trick.
I only found one php statement within it for getting the shrink size that is looking for value provided in Threaded Comments admin option. Simply replacing it with static value of whatever percentage I wanted works nicely.
And last but not least - I didn’t see the reason to query the blog url and replaced it with static statement appropriate for my blog.
Not sure if it improved the load speed but source looks cleaner
I have been thinking of moving that horrible javascript for ages. I suppose I should do the CSS as well.
Andy Beard’s last blog post..Green Pixel Dust Has A Negative
Andy,
CSS turned out to be an easy solution … now JAVA option is something I’ll be waiting for you to fix
Alex
Thanks for the mention. Appreciated.
NSpeaks’s last blog post..Rewarding Top Commentors for March
Hi Alex,
Michael from Germany here.
Well done ..*-)
Your fix might be just what i’m looking for.
Will check it out now.
Keep the good work up …*-)
Michael
I know you’re not offering support on this, but I installed the fixed comments without enhancements, and it’s returning this error:
Parse error: parse error, unexpected T_ELSE in /path/to/my/theme/comments.php on line 218Just wanted to report that. Thanks for offering this.
Jeff,
Thanks I will look into it. In mean time you can download the Enhanced file and simply upload it. While it has a built in option for Avatars and Comments Spam Math - they are using the “if(function_exists” statement and should works just fine. Meaning - if plugin not installed - function will be simply ignored. Here is an example of function for MyAvatars: < ?php if(function_exists("MyAvatars")) MyAvatars(); ?>
You can either delete it or leave it there, comments will work anyway…
Alex
Thanks Alex. I really enjoy your site. I’ve got the fixed comments working, but when I click “cancel reply”, the focus moves to the top of the page, and the comments box disappears. I did the “John Chow” fix. Anyone know what else I need to do?
Jeff’s last blog post..Tell Us What You Think
Jeff,
Try to UNDO the fix
It is possible that fix wasn’t necessary for you … I have read a comment somewhere with issue similar to yours.
I have the same problem with the unenhanced fix. I’ll try the enhanced version and hope it works.
Laina.
Enhanced version uses IF EXISTS statement so it should work even if you don’t have those plugins installed. Please let me know if it works and I’ll remove the file that is failing.
Thanks,
Alex
Alex,
I’m sorry to be a pain. The comments are back with the enhanced file, but now the comment text is running out of the comment box in Firefox. This was not the case before the threaded comments were added, so I suspect that this is the problem. I’m not sure how to fix it, though. I’ll probably just have to work without threading.
Liana’s last blog post..She’s, Um…like You
Liana,
No sure what to tell you … I have tested this one with several themes and had no issues. Might be some overlap of css styling of your theme and BTC plguin … sorry, can’t help you there.
Thanks for the enhancement. Wnat to try it right away, though I’m a bit doubtul if it fits with my template.
Fatih’s last blog post..Steve Jobs and God
Does this fixed version also work correctly on 2.3.3 installations?
And, does anyone here know, how to make it use AJAX?
Jo0Lz’s last blog post..Myth Buster!
That is the version I use … so yes, it does.
No clue on AJAX
Hey, I’ve tried installing this plugin, in the enhanced kubrick theme, K2.
Still having problems,
Fatal error: Call to undefined function show_subscription_checkbox() in /home/joolz/domains/joolz.nl/public_html/wp-content/themes/k2/comments.php on line 197
:{ So, it doesn’t work?
Also, if I click the Reply to this comment, I get an error about missing Form.
No hidden form field “comment-reply-ID”, please look at old comments.php and copy over the field?
Using the Enhanced version, cause the fixed comments.php does not work, get an error about T_ELSE, like commented here in the comments.
Jo0Lz’s last blog post..Cat burglars
Jo0Lz,
show_subscription_checkbox() - comes from your blog not having Subscribe to comments plugin. I’ll have a look at the file again. Sorry been so swamped that simply have no time …
Alex
Yeah I figured as much, installed the plugin and the error is gone. That other error was related to the change you described, changing content to content-main, so that error is gone aswell…
However, I still have some issues, like when I cancel the “reply here” thing…
The reply form goes missing, and when I want to reply I have to refresh the page… (If I don’t , I get the error that the div “addcomment” is missing, and I have to check the comments.php file…)
Hope you can come up with a fix,
Greetings,
Jo0Lz.
Jo0Lz’s last blog post..Cat burglars
Yep, that one exists on my blogs as well …
Sorry no fix for that one and since I personally don’t consider it to be such a big deal I don’t think I’ll be addressing it, sorry.
The bug does not exist on this current page…
At least, i just tried, and when cancelling the reply, it just reroots below…
Jo0Lz’s last blog post..Cat burglars
^^
I fixed the bug. The ID “content” was different in my theme.
I changed it, tried a few, got it working now…
Now just some small tweaks, and I am once again a happy camper.
Thanks!
Jo0Lz’s last blog post..Cat burglars
Hey JoOLz, glad you got it working …
Alex
How did you get commentluv to work with the threaded comments. On my installed wordpress blog, I cannot get the two to work together… any thoughts?
Anna Wise’s last blog post..Wordless Wednesday - #5
As you can see it is working, your last comment is in
This is great, I even templated the comments from scratch, imho it looks a lot better now…
See for yourself @ http://joolz.nl/about-jo0lz/
*O*
Jo0Lz’s last blog post..Networking?
It’s cool that you found a way to fix it, I might try it out. I never did install it because I had issues trying to run it on my old theme.
I wonder why the original plug author released it and then never provided support?
Chris Guthrie’s last blog post..21 ways to avoid saying MMO (Make Money Online)
That’s because plugins don’t pay for his rent. Read his reply to updating plugins here: http://meidell.dk/archives/200...../#comments
NSpeaks’s last blog post..Wordpress 2.5 Beta Released
Does the enhanced version work with WP 2.5 since it has built in support for Gravatars already?
Also, Mark Jaquith, seems to suggest that the ability to do threading is built into WordPress, and is there for plugin authors. Does this use the
comment_parentcolumn just in case they ever decide to make threading an option in the core?Original Plugin updated to 1.5.15 - and don’t expect these enhancements to work in it….they are still not supported…
I will recommend using this version only.
NSpeaks’s last blog post..Wordpress 2.5 Beta Released
@Brian - It works with 2.5 beat but gravatars are not built into this file. On existining functionality - I can only wish the core developers address it. If function if provided, why not integrate it into core, consdering how desirable the function is. Or at least do it with thier default theme as an optional feature to show developers how its done.
@NSpeaks - Thanks. I just visited his blog and read it. Looks like his latest version is nothing more then couple bug fixes that are already addressed by other people. I can see his point and understand the time limitations and can’t really blame the guy …
I guess we will wait for a next release to see all the fixes officially integrated.
In mean time - I know the file I provide above works with 2.5 and 2.3. I will update the file to support built in gravatars once the 2.5 officially released.
Alex
IMPORTANT: Brian have implemented and addressed all the fixes discussed in this article into the latest version of his plugin:
http://code.google.com/p/briansthreadedcomments/
Please be sure to get the original plugin. All you need plus the functionality that will be available with WordPress 2.5 (Gravatars and MyAvatars) are built into new plugin.
Alex