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.
PR on github...?
Can we have that, here? Can we? Huh? Can we? Huh? PLEEEEEEEEZ!
Some day I will have to register and learn how to use it :P
Great tip! :)
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
I'd love to have that, here, on this site, coz I keep hitting that pig, by mistake. :P
That's what happened to me, just today...
You'd have to bring it "upstairs" :P
Throw it into a mod for the time being :)
Quote from: margarett on October 01, 2013, 09:19:20 AMYou'd have to bring it "upstairs" :P
They'll say "Piss off!". :(
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
Oh, but I do.
I kinda already asked.
Whooo I released a MOD ;D ;D ;D
Yay!
/me goes to look...
margarett
Check you PM's. :)
I did. TY ;)
May want to post links to the mod and support topic here and lock this?
Good idea.
Please find the MOD here:
http://custom.simplemachines.org/mods/index.php?mod=3786
Locking this.