Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Post count not updating.



  • rgprgp London New

    The solution to the 'most recent' not updating was to add the same code to CategoryModel->updateLastPost().

  • rgprgp London New

    It looks like my web host isn't using mysqlnd as the PDO MySQL driver :-)

    Obviously specific to my webhost, but might possibly account for some of the other folk's problems with this issue, too?

  • @rgp Try adding this to your configuration:

    $Configuration['Database']['ConnectionOptions'] = [PDO::ATTR_STRINGIFY_FETCHES => false, PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE => true];
  • rgprgp London New
    edited September 2018

    @Bleistivt Thanks for the suggestion, but PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE is a SQL Server specific constant -- it isn't defined in the PHP build on my webhost.

  • rgprgp London New

    Given the reliance on mysqlnd, though it's not listed as a requirement, I've raised an issue for this:

  • You have completely lost me ther but I will keep following this thread in case a fix is found. I think this is the niceset forum software I have found but not usable with this bug

  • rgprgp London New

    Hi @teppsta.

    I suggest you check if your installation is using mysqlnd as its PDO MySQL driver -- if it is not, your problem is likely to be the same as mine, but if it is, it's definitely something different.

    To check, create a single-line PHP file, containing just the following:

    <?php phpinfo();  

    Upload this file to your forum directory and run it. In the resulting web page, search for the PDO Driver for MySQL section. If the Client API version is anything other than mysqlnd, the workarounds I described above will likely fix your problem too.

  • Yes having the same issue 2.6.1 categories not showing post counts or comment counts

  • Thanks RGP !

    I have had my service provider check and they state that whilst MySQLnd is present it is not used. Rather the connection is done with the default mysql client library.

    They created a script which you can see at :

    I hope this may lead to a simple solution !

    Many thanks


  • rgprgp London New

    I have had my service provider check and they state that whilst MySQLnd is present it is not used. Rather the connection is done with the default mysql client library.

    In that case the workaround I described above (in CategoryModel->incrementLastDiscussion() and CategoryModel->updateLastPost() (in file /applications/vanilla/models/class.categorymodel.php) should fix it for you.

    Unfortunately these are not overridable functions, so you'll have to edit the core file and reapply the fix each time you upgrade (until a permanent fix is made to the core files).


  • rgprgp London New

    I found at least one other place where this is a problem, decrementing the count when deleting a discussion.

    So I decided to remove my existing fixes, and instead alter CategoryModel->get() to check the id for is_numeric() instead of is_int():

          } elseif (is_numeric($categoryID)) {
                $id = (int)$categoryID;

    This has the advantage of only needing to reapply the change in one place on an upgarde, instead of at least three places. In theory it breaks other things if any category has an entirely numeric slug, but that won't be true in my forum (would it be anywhere?).

  • Does anyone have a fix for this yet? I tried one of @rgp above but didnt work. Its the counts on my front Category view that arent updaing. The last poster is though. Any help would be great as this is a pretty annoying bug.

  • rgprgp London New

    Hi @Chrismawa

    As I said in an earlier post, before editing any code the first thing to check if your installation is using mysqlnd as its PDO MySQL driver. 


  • Hi @rgp

    My phpinfo is here:

    Mysqlnd is listed on there but its not in the PDO drivers section. Does this mean its installed but being used?

  • rgprgp London New

    Yes, the PDO Driver for MySQL section shows that your PDO installation is not using mysqlnd.

    I suggest you try the last fix I suggested above, which is working for me:

    Alter CategoryModel->get() to check the id for is_numeric() instead of is_int():

          } elseif (is_numeric($categoryID)) {
                $id = (int)$categoryID;


  • Thanks Richard, excuse my poor knowledge of Vanilla but where is that line located? Inside class.categorymodel.php? As I can't seem to locate it.

  • rgprgp London New

    Whoops, sorry that's my mistake.

    It's in CategoryCollection->get() (not CategoryModel), so in file class.categorycollection.php (approx line 165 in v2.6 -- I haven't yet upgraded to v2.8).

    Sorry again ...

  • Thanks mate, it seems to be a partial fix. My post count is now updating just not the Thread count. Thanks for your help.

  • Actually it has fixed both counts! Thanks @rgp !!

Sign In or Register to comment.