Notifications failing for some users on Invision Community forums
5th March 2020,
5th March 2020,
However, after a recent upgrade to version 4.4.10, we had reports that some users were clicking the popular bell icon to view notifications and encountering an error. The box that would normally display the notifications was instead just showing a loading animation that a user dubbed “The wheel of death”. Clicking to view all notifications would take the user to an error page with no way of allowing users to view their notifications. This was a heavily used feature on the site and without it users were finding it difficult to know when their posts had been replied to so were actively engaging in the forum less.
The first issue in trying to diagnose the bug was that it wasn’t happening for every account - and it wasn’t happening for any account that I had access to. However, a feature of the software that I hadn’t been aware of before this suddenly came in very useful. Through the admin control panel, you are able to log into any account and see the website as if you were them. This allowed me to log into another admin’s account on the site and see the problem for myself and get a detailed error message of what the error was and where it was happening.
While I now knew where the problem was the issue was that it was in a core file that shouldn’t be modified from official releases as it could be overwritten by future software updates. The first thing I tried was updating the version of PHP. The version we were using was reaching its end of support life so it was due an upgrade soon anyway so I took this as an opportunity to update PHP and see if this would also fix the problem. It didn’t.
So to get the bug fixed as soon as possible I made the decision to update the core file that was causing the issue, and contact the support team for the software to make them aware of the issue. The problem was a function call made to a function that didn’t exist.
The problem file: applications/core/extensions/core/Notifications/Content.php line 589
The problem line:
'unread' => (bool) ( $item->unread() ),
The updated line:
'unread' => (bool) ( method_exists($item,'unread') ? $item->unread() : true ),
I updated the line to check that the method exists before calling it and if the function doesn’t exist then just return true. This has fixed the issue and means users can now fully engage with discussions again - and hopefully by the time of a future upgrade the bug will be resolved with the software.
Want to share? Tweet it!
We're looking for an experienced PHP developer to join our highly effective team. We're problem solvers, with clients depending on us - some of them… Read →
We've been busy helping our client OilPrice.com with the launch of their new trading platform. Made in conjunction with FTSE 250 company owned Markets.com, OPCMarkets… Read →