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.
Re not working unread:
Yeah, that's a funny case of making things unnecessary complicate. :)
If you are SURE you want to output 'Michieal Coder'
you would
echo 'Michieal Coder';
and not
$name = 'Michieal Coder';
echo "{$name}";
Right?
Same here: You want to set viewed to NULL? So just do it!
UPDATE ossn_notifications SET viewed=NULL
Be aware that mysql expects a VALUE (namely NULL) here, thus viewed='NULL'
would be wrong
Your original construct
$nix = NULL; SET viewed={$nix}
is passing just an unset variable (=NOTHING) and that's why MySQL bombs out.
So if you really want insist on doing it that way, you need to change it like
$nix = 'NULL'; SET viewed={$nix}
Aside from that: all these fields are defined as BIGINT, thus expecting values in all three cases and no strings. So a more correct syntax would be
$Notification->statement("UPDATE ossn_notifications SET viewed={$nix} WHERE(owner_guid={$owner_guid} and guid={$guid});");
With the new version in, using Hugo's test name from his comment; I change an existing user's name to kate bishop (c) because I had notifications from them.
New release uploaded complete with the suggested changes.
Hugo, if you would be so kind, I would genuinely like it if you would give the new version a test spin!
Again thank you Hugo, Michael, and Arsalan! I appreciate the help!
I see! Okay, Yeah uhm, I don't have users with special characters like umlauts in their names yet. Sorry for not fully understanding the issue, Hugo! Thank you for finding it!!
Also, thank you Arsalan and Michael for your help with this!!!
I will post a new version here in a few minutes, after adding in your suggestions to the the merged code.
Yes agree
Yup, and it makes sense to remove it in the end like
return str_replace('<?xml encoding="UTF-8">', '', $doc->saveHTML());
Otherwise you'll get a lot of unnecessary lines in your output
This is common issue when using DOMDocuments the fix is sent to https://github.com/michieal/marknotification/pull/1
Ah ok, got it.
Re UTF-8 issue: I can confirm Hugo's finding. After renaming my beloved testuser Honey Bunny to Höney Bünny the trouble starts. And actually only on those notification types which are hooked by your component.
@Michael - Users starting using the thumbs up (Like) for comments for them to keep track of what they have read. So, 99% of the notifications I received were like reactions on comments, in an active topic/post. Hence, the button to clean up some notifications, as a convenience.
Component Disabled:
Component Enabled:
Name for testing:
➳ Kᴀᴛᴇ Bɪsʜᴏᴘ ©