You are here

Help Wanted: Upgrade MarkAsRead Module to Drupal 6

15 posts / 0 new
Last post
John T. Haller
John T. Haller's picture
Online
Last seen: 3 min 19 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Help Wanted: Upgrade MarkAsRead Module to Drupal 6

We're in need of someone to upgrade the MarkAsRead module we use to display the "Mark all forums read". It's a Drupal 5 module that can be found here:
http://wtanaka.com/drupal/markasread

Chris had mentioned he was going to try but hasn't posted back on it yet... and it's now the one thing holding us back from upgrading and getting some nice new features: better performance, polls, real forum moderators, wikis, etc.

The conversion info is on the Drupal site here:
http://drupal.org/node/114774

If anyone can help... or a couple people can work together on it, please chime in.

Thanks,
John

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 11 months ago
Joined: 2007-04-15 21:08
I am working on it...

But I've hit on an issue which I haven't yet been able to resolve.
(John: I sent you an e-mail about something else a couple of days ago, and mentioned my progress in it. Did you get that)

I'm currently just thinking of creating a new module from scratch with the same functionality... his code is, by Drupal coding standards, ghastly (shudder).

Currently the issue I'm having is visible at http://chrismorgan.info/forum (warning: Invalid argument supplied for foreach() in /home/chrismor/public_html/includes/menu.inc on line 258.). I haven't modified the theme to add in the bit at the bottom, but I don't think that that is the issue. If I recode the module from scratch, I believe that I would be able to do the button properly as a block, visible for forum/* and forums/*.

Currently I have an English assignment to do (20% of the semester grade!) but I should have the draft in by Thursday, and then I can do a bit of work on Mark All Read until my teacher returns it.

Sorry it's taken a while to get going.

Note: if rewriting it, it really isn't hard; the core of it is just the button and one SQL query. I think that if anything, it'll be faster than bugfixing.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 11 months ago
Joined: 2007-04-15 21:08
I'm rewriting the module.

No need for a block.

I'm getting the module to do the button as a module theme overwrite thing - the function is markasread_preprocess_* instead of phptemplate_* (which has also changed from forum_display to forums). This means that the extra bit of code won't need to be put into the theme. I'm not sure why he didn't get the module to do it.

I'll post the code when it's vaguely workable.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

John T. Haller
John T. Haller's picture
Online
Last seen: 3 min 19 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Excellent

Thanks for your work on this Chris. And take whatever approach makes sense in terms of the code. No need to bugfix the old one if it's messy.

Sometimes, the impossible can become possible, if you're awesome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 11 months ago
Joined: 2007-04-15 21:08
Done!

I'm finished! (Feel free to look surprised, as I'm surprised too!)

View the code at: http://chrismorgan.info/development/drupal/modules/markasread/6
Test it for yourselves (you'll need to register or use OpenID) at: http://chrismorgan.info/forum

The code is overhauled, rewritten mostly from scratch, and does not require the extra code in the theme.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Shawn Faucher
Shawn Faucher's picture
Offline
Last seen: 14 years 9 months ago
Developer
Joined: 2007-10-23 22:14
tracker

It works on the forum page but not the tracker page, which is where most people would want to use it...

formerly rayven01

Patrick Patience
Offline
Last seen: 4 years 5 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
Stories

Along with that, it looks like it doesn't mark stories as read which also show up in the tracker. So it would be great to have it mark all stories read too.

Shawn Faucher
Shawn Faucher's picture
Offline
Last seen: 14 years 9 months ago
Developer
Joined: 2007-10-23 22:14
Noticed that too..

But that is actually the same behavior that the current Mark All Read button shows, so I didn't think to mention it. If that is significantly more work I'm sure we could live without that part, since we have so far. Wink

formerly rayven01

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 11 months ago
Joined: 2007-04-15 21:08
Tracker - no can do?

(the /tracker button only covers forum posts, anyway)

I think that Drupal 6 has made it a different themeable hook for that. I can't fix that right now, but I should be able to fix it this afternoon, and make it do all content types and not say "mark all forums read" while I'm at it.

Thanks!

Edit: I've looked at it, and it seems that it can't be done - there is no theme() call which I can use (it only makes calls to 'table' and 'pager', which are generic display things). The only way to do it would appear to be through a block, placed in the footer for /tracker and user/*/track. It's a 'norful way of doing it, and would not work should the URL be different, but should I do it that way?

Another note: on here, the button on /tracker does the same as the button on /forums - removes the "new" flag for that user, for all pages with the content type "forum" - Forum Topics.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

John T. Haller
John T. Haller's picture
Online
Last seen: 3 min 19 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Yeah

If that's the only way to do it, then that's the way we do it.

Odd that something possible in 5 isn't in 6.

Sometimes, the impossible can become possible, if you're awesome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 11 months ago
Joined: 2007-04-15 21:08
To be perfectly honest,

To be perfectly honest, having looked at the tracker.module code from Drupal 5.7, I don't understand why the button gets displayed at the bottom of the tracker page at all: I don't think that it should! But one thing is sure: tracker under Drupal 6 doesn't use the forum_display theme call.

I think that a block is the only way for that page, but I'll check up on the details of the first argument of the theme() call, and see if I can do it that way. Otherwise, it's gotta be a block.

I should be able to continue my research and development when I get home from sport and from school (in about 3 hours time). I've finished my English assignment, so I can go straight on with this.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

John T. Haller
John T. Haller's picture
Online
Last seen: 3 min 19 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Manually

If it's a big deal, we can just do it manually with a block for now.

Sometimes, the impossible can become possible, if you're awesome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 11 months ago
Joined: 2007-04-15 21:08
I've read up on it and

I've read up on it and understand it now.

Module preprocessing of themeable functions (function is called MODULE_preprocess_HOOK - e.g. markasread_preprocess_forums) is new to Drupal 6 - that's why it's not in the Drupal 5 version of the Mark As Read module. But although the forums one is themeable through a function, the tracker one is not. To do that, we'll need to either do it as a block (probably not a good way) or do it in the active theme's directory as page-tracker.tpl.php - I'll try to test it when I get home.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 11 months ago
Joined: 2007-04-15 21:08
Last touch - tracker support!

Done.

See http://chrismorgan.info/development/drupal/modules/markasread/6 for the code (wow... it really messes up Garland's widths! I can't be bothered fixing it now, though). Now I really feel as though I've done something useful with it - I've put in extra functionality, and some extra SQL too!

Shows and works for:

  • Forum lists (forum, but we have an alias here to forums)
  • Topic lists (forum/n, but we have aliases here so that it looks nice)
  • tracker
  • tracker/*UserID*
  • user/*UserID*/track

(Note: it also shows for tracker/INVALID, but I don't think that that matters... it's no security issue - it's all filtered.)

I believe that we can now roll out Drupal 6! Woohoo! :-):D:-):D:-):D:-):D:-):D (I'm getting a bit overexcited...)

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Shawn Faucher
Shawn Faucher's picture
Offline
Last seen: 14 years 9 months ago
Developer
Joined: 2007-10-23 22:14
Sweet!

Works good. Glad to see it extended to work properly for all content types. Smile

formerly rayven01

Log in or register to post comments