Notifications failing for some users on Invision Community forums

dean Dean, 5th March 2020

Our client OilPrice.com use InvisionCommunity to power their very popular oil and energy discussion forums.

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.

 

More from our blog

18a win Netty 2024 award for Activibees.com

18a win Netty 2024 award for Activibees.com

29.02.24

We are delighted to announce that 18a has been recognised for its outstanding work in the "Web Design Agency of the Year - UK" category at… Read →

Generating an Effective Content Security Policy with your Laravel React App

Generating an Effective Content Security Policy with your Laravel React App

27.02.24

I recently had an interesting problem to solve. I'd built a brand new author website on a shiny installation of Laravel 10, utilising its out-of-the-box… Read →

If your WordPress website looks broken, it could be because of this.

If your WordPress website looks broken, it could be because of this.

15.02.24

WordPress is the incredibly popular blogging-come-full-website platform that powers over 835 million websites* in 2024. It's functionality is extended by plugins, and one such very… Read →