This Drupal 5 module facilitates the creation of a button that allows your Drupal users to mark all topics on a Drupal forum as read. This is a feature of most dedicated forum software which is missing from Drupal's forum module.
- This module marks everything as read using a single call to a (non-standard MySQL-specific) REPLACE query.
- It takes input via POST instead of GET, because pages retrieved with GET should never have the significance of taking an action other than retrieval.
- Install the module (both markasread.module and markasread.info needed for Drupal 5) and enable it in the modules administration page
- Add a phptemplate_forum_display function to your theme's template.php with something like:
function phptemplate_forum_display($forums, $topics, $parents, $tid,
$forum_display = theme_forum_display($forums, $topics, $parents,
$tid, $sortby, $forum_per_page);
$markbutton = '';
if ($user->uid && function_exists('markasread_form_helper'))
$markbutton = markasread_form_helper(
$tid ? t('Mark all topics read') : t('Mark all forums read'),
$tid ? $tid : NULL);
return $forum_display . $markbutton;
- Would it be better to use an "UPDATE ... ON DUPLICATE KEY INSERT" query? I saw vague mention of that syntax being supported by PostgreSQL, and being faster in cases on MySQL?
The logic of the SQL query is from this patch. I assume that patch is GPL, which means this module is GPL as well.
There's another similar module: forum_mark_read. It uses N+1 database read queries and N database write queries, where N is the number of forum topics that need to be marked as read. If anyone knows how well that performs, I'd appreciate a comment -- maybe that number of queries is not an issue? forum_mark_read also uses GET, and I need something that uses POST (see above).
If you encounter any issues, please leave a comment below.