Skip to:

Javascript error in topic-js.php whenever I go to a topic page

  • John Conners


    Having done a completely new install of bbPress (to make sure there wasn’t a problem with my existing templates / plugins), when I log in and browse to any topic page I get a javascript error on the following line in bb-includes/js/topic-js.php:

    favoritesToggle[ 1 === isFav ? 'removeClass' : 'addClass' ]( 'is-not-favorite' );

    Apparently favoritesToggle[....] is not a function, according to Firefox.

    Apart from that, great work!

Viewing 17 replies - 1 through 17 (of 17 total)
  • I get the same error as reported in firebug:

    favoritesToggle[1 === isFav ? “removeClass” : “addClass”] is not a function


    Line 55

    Broken JavaScript is a non-trivial, since it will trigger a very visible error message for some users… on essentially every topic page, when logged in. The error isn’t FireFox-specific.

    Commenting out the contents of the “addLoadEvent( function() { // TopicMeta” block of code in topic-js.php appears to remove the error without creating new issues: The underlying AJAX behaviour is broken anyway. A proper fix would be appreciated.

    Edit: Ok… playing with *this* forum, it seems there is already a fix: The equivalent code in appears to work just fine.

    Please ticket this in Trac…



    I fixed the error by adding

    <?php bb_enqueue_script('jquery'); ?>

    just before

    <?php bb_enqueue_script('topic'); ?>

    in header.php in the theme

    Thanks so1o, that’s the quick an dirty fix. That code uses jQuery methods, and jQuery is not available in topic pages.

    It didn’t get picked up because that code falls back to non-ajax requests when it fails.

    We are half way through removing all prototype in favour of jQuery, and this snuck under the radar.



    i thought so..

    I am still getting this error on my install despite having implemented the above fix.

    Any idea when it will be resolved in the main branch of BB?

    I’m also still getting this problem…



    Here is the trac ticket:

    Looks like it’s fixed in the trunk release, but I haven’t seen a date for a new release yet.

    Is this the same problem that I’m experiencing? I’m not a techie, so I don’t really understand what’s being said here. In short, when logged in, my topic threads’ CSS gets broken a bit. When I’m not logged in, it works fine.

    Is this the same problem?

    Is there anything I can do to rectify this? I don’t understand what “trunk” means.



    Trunk means the error has been fixed in the code repository but it hasn’t been packaged into a new release yet.

    You can get the latest trunk code here:

    I have no idea if there are any problems with that release though. You only need one tiny fix for this problem.

    Also, it seems like you have a lot of interesting things going on with your installation based on the number of threads posted here. I suspect there is more going on than just a couple tiny, unrelated problems. If you can afford to do it without losing any work, you might want to try a fresh installation and start from scratch.

    Well, I only installed the BBPress about 2 days ago…

    I’ve overwritten all my current files on the server, with the ones in that trunk code, and still nothing is fixed. My forum is here. Please have a look and tell me what is going on…



    Is it possible things are cached in your browser? I logged into your forum and I don’t see any JavaScript errors once logged in (or even before that.)

    It seems like this problem is fixed?

    I’ve cleared the cache and nothing changed.

    Here are screenshots of what I’m talking about.

    The correct one (when I’m logged out):

    The incorrect way (when I’m logged in):



    I could not log in with IE6 or IE7. Not sure why.

    With FF, I see the difference. Seems like a template problem, stuff is just in the wrong place. I think the theme author mentioned in another thread that a new release was coming. I suspect this will be fixed in that release.

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