This component adds in the ability to mark a notification as read, or to delete a notification without leaving the page that you are on. No more having to click the various notifications to mark them as read. This utility grants the user the ability to delete their own notifications (and thus help keep your database clean). Modeled off of how Facebook allows you to just mark a notification as read, or to delete those annoying "this person liked your comment" notifications.
Suggestions for improvement, or bug fixes (or simply finding one and letting me know) are always welcome!
This is the initial release of the component, and I have tested it on a live site.
@Michael
If I do that, will it put it back into the Notifications Dropdown? Because that is the only reason that I can think of, to have an Unread feature.
btw, thank you for your help. I do appreciate you.
@Hugo I am about to upload a new version of the component. I cannot say that my component damages the user name in any way, because it never touches the user name.
Literally, it looks at the very end of the notification and appends html after the end. If you Inspect (with your browser) the html, you will see that my code exists outside of the notification.
For example, from my own site:
</a><a href="https://www.site.com/action/mark/read?guid=2500&ossn_ts=1645772895&ossn_token=SomeTokenWrittenInHex" class="apop-notif-read" title="Mark Notification as read.">Mark Read ✔️</a><a href="https://www.site.com/action/mark/delete?guid=2500&ossn_ts=1645772895&ossn_token=SomeTokenWrittenInHex" class="apop-notif-delete" title="Delete Notification.">Delete ❌</a><br><hr class="apop-hr">
Where as the section that you are talking about - is put in by OssnNotifications component.
But, here's what you do. Take a picture of it with the component enabled, and with the component disabled, and post it here. I personally, cannot recreate this issue.
Another finding:
The component breaks chracters or UTF-8 unicode of the users names and some other locale.php strings of my site like "user commented in the publication", you can see the:
ó = ó
or all the user unicode name.
I agree that re-marking a notification as "unread" would be a rather rare occurrence. Nevertheless, you could of course query the 'viewed' status with if ($params->viewed === null) {....
and change the displayed link accordingly. Incidentally, I could not find any display problems on smartphones, either.
Thank you!
I had to disable the mark unread option, as Php NULL is different than MySql DB NULL. The way that notifications are done, DBNull is unread, and not null is read.
That, and making Mark Unread fit on small screens (like phones) fails. So I just kind of sidelined it because the main functionality is to mark things read, and to delete notifications.
Hi Michiel, nice component!
Not sure why, but i dont see the "unread" option after the notification are marked as read. But overrall all seems fine, i will do some testings in my VM and then perhaps in my prod env.
Updated license to GPL v3.0
Updated to account for the possible security issue (by checking for ownership) and to make use of the native error logging mechanism in OSSN.
1) because when I first started writing it, I didn't exactly know how to use the built in error log... and I needed the information so it was kinda easier to just add in one quickly.
2) It doesn't show you others' notifications as it solely hooks into your notifications, as Arsalan showed me to do, a while back. So, I didn't need to check for that.
Can you see a way that a person can bypass it, to nix others' notifications?
Admittedly, this is my first public component. So, I assume that there's bound to be some issue somewheres.
More important: Any logged in user may mark/delete any notification because there's no owner verification.