I've googled this, tried different modules and plugins and patches and everything, and nothing seems to work or be compatible with 6.x.
I want a link (something like /markread) that will simply mark EVERYTHING as read on the site (all comments, all nodes which are published) and then return you to the previous page with a drupal message that says something like "You have cleared all "new" notifications." So far, nothing I've found on this site or third party sites has worked for me. Suggestions?
By the way, for anyone who is actively helping out with the development of 7.x: This NEEDS to be in Drupal 7.
-
Side note: Could this be done with views and/or the views "action" module (the one that puts checkboxes in a views table)? I have views installed and am using it, so I could do it that way if that's easier, I just don't know if there's an action for "Mark as read".
Comments
Nobody has any ideas? Really?
Nobody has any ideas? Really?
Okay, so I've been digging
Okay, so I've been digging around the internet a bit, and it seems you can't do this with VBO (Views Bulk Operations), or the Actions module, or Drupal core.
If nobody knows how to do this, at the very least, does ANYONE know at what point nodes get "marked as read" or have their timestamps updated to reflect not-new status? I'd like to manually call the function that does this, within an action. I've tried node_load(), but that doesn't seem to update the timestamp for "read".
If ANYONE has any insight whatsoever, every little bit helps. Speak up!
_
advanced forum has this capability for forum posts-- i would think you should be able to grab the code and alter as necessary for other content types.
.
If you want this in core for D7, helping with #515034: Mark all forum topics read is a good start.
Michelle
I actually managed to write
I actually managed to write an action that did this (using node_tag_new() or whatever it's called), and, using VBO, I have successfully implemented the feature I needed.
_
Nice-- can you post the code for the action for future reference?
Post it where? I can't attach
Post it where? I can't attach files to forum posts or replies.
_
Not attach it-- just post (ie copy & paste) it, between <code> tags, right into the thread.
Sure, see below. :)
Sure, see below. :)
Action "Mark as Read" code
Place this code inside a module to get an action that will mark a node as "read". This works excellently with Views Bulk Operations.
Note: Module name in this instance was "markread".
_
Excellent-- thanks for posting! I'm sure other users will find this very useful.
Awesome work!
It's great to see someone come up with a solution. I know this topic has been hot in the forums for years now. :-)
Can you explain how you use this with VBO? Are you displaying all of your content to users with checkboxes? What are the use-cases for using this?
Also, I noticed the two functions have slightly different nomencature. One has markread_ and the other is mark_read_ ... is that correct?
Yes, that's correct. The
Yes, that's correct. The callback function can be named whatever you like, but you can change it if you want. (Be sure to change it both places).
I personally use this on my site that has a "recent posts" page that displays a table of all new posts and forum topics and whatnot (including replies), and if I update, say, 10 different nodes, they all get marked as "Updated". My users can then simply "check" the ones they don't want to actually read and clear them using VBO. It's somewhat confusing, but it definitely has its place.
MarkRead module
Any interest in trying to make a custom module to handle various methods of marking nodes as read? Use the personal contact form and let me know if you'd be interested.
I did as you posted. Now that
I did as you posted. Now that the action is created how do we set off the action? Is there a way to create a menu item or themeable button?
subscribe
SpikeX, thank you for the research and code you provided. I am trying to include this functionality in a site I am developing now. Hopefully I can come back and share my work and results here.
_
I did the above but nothing happened. Do you need to print the button in a .tpl.php-file? And how do you do that?
Guys. All you need to do is...
... read documentation for VBO concerning using Action API.
or just do this:
1) create markread.info file:
2) create markread.module file:
3) put them both into your modules directory under 'markread' subdirectory.
4) enable the module
5) use the Mark Read action in VBO settings.
could this function mess up
could this function mess up with other views, modules on the site?
It does not (at least on my
It does not (at least on my site).
But it possibly could (who knows), that is what testing is about.
I was in need of the same
I was in need of the same feature for my Drupal 7 site. I have taken the code above and modified to suit. I have posted the module/code to the VBO issue queue under #1886916: Mark all nodes as read action.
Mark as Read for D7
Actually, for Drupal 7 it's really easy to achieve this, all you need to do is:
node_tag_new($entity);That's all there is to it. A custom action and one line of PHP.
For All Users?
Great idea. I did it and it works well for the user executing the Mark as read action. Only thing is how to execute this for ALL users?