Skip to content

Instantly share code, notes, and snippets.

@marc1706
Created December 11, 2012 23:46
Show Gist options
  • Save marc1706/4263460 to your computer and use it in GitHub Desktop.
Save marc1706/4263460 to your computer and use it in GitHub Desktop.
Get rid of popup message and refresh the page after marking forums read.
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 7312980..ed3d1b0 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -61,10 +61,13 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
{
markread('all', false, false, request_var('mark_time', 0));
- trigger_error(
- $user->lang['FORUMS_MARKED'] . '<br /><br />' .
- sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect . '">', '</a>')
- );
+ if (!$request->is_ajax())
+ {
+ trigger_error(
+ $user->lang['FORUMS_MARKED'] . '<br /><br />' .
+ sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect . '">', '</a>')
+ );
+ }
}
else
{
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index fa31d32..c941b72 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -2,6 +2,11 @@
"use strict";
+// This callback will quickly refresh the page without scrolling to the top
+phpbb.add_ajax_callback('quick_refresh', function() {
+ location.reload();
+});
+
// This callback finds the post from the delete link, and removes it.
phpbb.add_ajax_callback('post_delete', function() {
var el = $(this),
diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html
index 6babbf5..b7d9010 100644
--- a/phpBB/styles/prosilver/template/index_body.html
+++ b/phpBB/styles/prosilver/template/index_body.html
@@ -8,7 +8,7 @@
<!-- IF S_DISPLAY_SEARCH -->
<li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_LOAD_UNREADS --> &bull; <a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --> &bull; <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> &bull; <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
<!-- ENDIF -->
- <!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m" data-ajax="true">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF -->
+ <!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m" data-ajax="quick_refresh" data-overlay="false">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF -->
</ul>
<!-- ENDIF -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment