News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Confirmation message to "Mark as Read"

Started by margarett, October 01, 2013, 06:55:20 AM

Previous topic - Next topic

margarett

EDIT: This is now available as a MOD:
http://custom.simplemachines.org/mods/index.php?mod=3786

First of all, I hope this hasn't been issued before, but a quick search brought no results, so...

I'm sure everyone already found himself in this situation: 2 "unread posts since last visit", plus 4 pages of "All unread posts" and just when you are to click the "ALL UNREAD POSTS", you actually click the "MARK ALL MESSAGES AS READ".

First you curse like hell, then you realize there's nothing to to about it :P

This happened to me just today on this very forum, so I tried to find a way to have the confirmation message that we get in many other places also available in this little button. And it's quite easy.
So:

languages/index.english.php
Add at the end of the file (before ?>)
$txt['are_sure_mark_read'] = 'Are you sure you want to mark messages as read?';
Of course, you can change the text to anywhere you like.

BoardIndex.template.php
Find:
'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
Replace with:
'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_mark_read'] . '\');"', 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),

MessageIndex.template.php
Find:
'markread' => array('text' => 'mark_read_short', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']),
Replace with:
'markread' => array('text' => 'mark_read_short', 'image' => 'markread.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_mark_read'] . '\');"', 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']),

Recent.template.php
Find
'markread' => array('text' => !empty($context['no_board_limits']) ? 'mark_as_read' : 'mark_read_short', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=' . (!empty($context['no_board_limits']) ? 'all' : 'board' . $context['querystring_board_limits']) . ';' . $context['session_var'] . '=' . $context['session_id']),
Replace with:
'markread' => array('text' => !empty($context['no_board_limits']) ? 'mark_as_read' : 'mark_read_short', 'image' => 'markread.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_mark_read'] . '\');"', 'url' => $scripturl . '?action=markasread;sa=' . (!empty($context['no_board_limits']) ? 'all' : 'board' . $context['querystring_board_limits']) . ';' . $context['session_var'] . '=' . $context['session_id']),

Find:
'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=unreadreplies;topics=' . $context['topics_to_mark'] . ';' . $context['session_var'] . '=' . $context['session_id']),
Replace with:
'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_mark_read'] . '\');"', 'url' => $scripturl . '?action=markasread;sa=unreadreplies;topics=' . $context['topics_to_mark'] . ';' . $context['session_var'] . '=' . $context['session_id']),

And now, a nice confirmation message is shown when you click the "MARK ALL MESSAGES AS READ" button.
This is valid for SMF 2.0.x.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

ziycon


kat

Can we have that, here? Can we? Huh? Can we? Huh? PLEEEEEEEEZ!

margarett

Some day I will have to register and learn how to use it :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair


margarett

Quote from: ziycon on October 01, 2013, 07:06:15 AM
PR on github...?
Quote from: margarett on October 01, 2013, 07:07:48 AM
Some day I will have to register and learn how to use it :P
Well, I've just registered myself on GH. Now what to do next a totally different story :P
And I still need to check if those buttons are generated the same way in 2.1. I'll give it a go. I hope :P

Quote from: K@ on October 01, 2013, 07:07:23 AM
Can we have that, here? Can we? Huh? Can we? Huh? PLEEEEEEEEZ!
To have this in 2.0 is now unlikely as this, for sure, is not a security fix :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

kat

I'd love to have that, here, on this site, coz I keep hitting that pig, by mistake. :P

margarett

That's what happened to me, just today...

You'd have to bring it "upstairs" :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

ziycon



margarett

Quote from: ziycon on October 01, 2013, 09:21:27 AM
Throw it into a mod for the time being :)
I'm still to learn how to do that :P

Quote from: K@ on October 01, 2013, 09:23:20 AM
They'll say "Piss off!". :(
You'll never know if you don't try :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

kat


margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair


Burke ♞ Knight


Burke ♞ Knight


margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Burke ♞ Knight

May want to post links to the mod and support topic here and lock this?

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: