• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

After marking forums read

Stuart Wright

Well-known member
#4
Whenever you mark the forums read (not a single forum, the whole forum) via the nav bar at the top it takes you away from the page you were on and takes you to the forums page. Why does it change the location? Wouldn't it be better to return the user to the page they were on?
Almost a year later, I'm returning to this question. Is it possible to make a quick hack to reload the current page?
 

Daniel Hood

Well-known member
#5
Is it possible to make a quick hack to reload the current page?
Yes.

You can edit /library/XenForo/ControllerPublic/Forum.php line 901

change from
PHP:
return $this->responseRedirect(
                    XenForo_ControllerResponse_Redirect::SUCCESS,
                    XenForo_Link::buildPublicLink('forums'),
                    new XenForo_Phrase('all_forums_marked_as_read')
                );
to

PHP:
return $this->responseMessage(
                    new XenForo_Phrase('all_forums_marked_as_read')
                );
Note that it is not recommended to change core files but you requested it...

[Edit] I guess this doesn't actually refresh the page, just lowers the success message saying the board has been read. Refreshing the page would take a little bit more work.
 

Jeremy

Well-known member
#6
Change the lines Daniel mentions above to this:
PHP:
        $link = $this->_request->getHeader('Referer');
               
        if (!$link) {
            $link = XenForo_Link::buildPublicLink('forums');
        }
               
        return $this->responseRedirect(
            XenForo_ControllerResponse_Redirect::SUCCESS,
            $link,
            new XenForo_Phrase('all_forums_marked_as_read')
        );
Shouldn't be too hard to build into an add-on so it survives upgrades.