Just another Websupporter site

BuddyPress Desktop Notification 0.7 Release

Today, I am happy to announce the 0.7 release of my WordPress plugin “BuddyPress Desktop Notification“. If you do not know my plugin yet, I covered it in a small blog post here.

Today I’ve (finally) read a small complain in the support forum of my plugin:

Notification received excellent but repeating again and again

Basically, when a message is pushed through the notification API the same message won’t be displayed again, unless – and this is more or less the typical use case 😀 – you click-through the page. You read a message, you go back to the homepage, you edit your profile. In this case you will get informed again and again about lets say an unread message. This can become quite annoying. I was wondering a bit if I should solve this problem server or client-side, but I think it’s better to solve this issue on the client side.

One solution I was thinking about was to save somewhere in the database, which messages have been already sent to avoid sending them again. I didn’t like this solution since the database would get quite a lot of useless information after a while. Imagine a huge community and for every single activity we would need to save a lot of data, which person this message already got via the notification system.

So I decided to go with a client side solution. Here, we go with Javascript. In version 0.6 we had already an array, where the ID of the message is saved to avoid popping up again and again – on the same page. The question was: How do we save this array, when the user jumps to another page: The solution, sessionStorage. I do like this solution, since its small, quick and does not need any database storage. Some might say, the disadvantage of this solution is, the array is only saved for one browser session. But on the other side, this is quite nice, you might have missed a notification or whatever. Nevermind, you will be reminded in your next session.

What do you think?

About the author

Seine erste Webseite hat David Remer 1998 in HTML verfasst. Wenig später war er fasziniert von DHTML und JavaScript. Nach jahrelanger Freelancerei arbeitete er zunächst für Inpsyde und ist heute Entwickler bei Automattic. Außerdem hat er das Buch "WordPress für Entwickler" verfasst.

Leave a Reply

Your email address will not be published.