Mark All Forums Read MyBB Plugin

One of the nice things about MyBB 1.4 (the first version I’ve used) is the “View New Posts” link in the header, but the “Mark All Forums Read” links is only on the main page, and at the bottom.

Below is a plugin I wrote that adds a “Mark All Forums Read” link to the header, after the “View New Posts” and “View Today’s Posts” links.

Save this file as “krfr_markallforumsread.php” and place it into the ./inc/plugins/ folder and activate it from the admin panel.

<?php
/**
 * MyBB 1.4
 * Christopher Fritz
 *
 * Website: http://www.kurifuri.com/
 * License: Creative Commons Attribution 3.0 Unported License
 * License Details: http://creativecommons.org/licenses/by/3.0/
 * Filename: krfr_markallforumsread.php
 */

if(!defined("IN_MYBB"))
{
  die("<p>Viewing this plug-in from the web is not allowed.</p>.");
}

function krfr_markallforumsread_info()
{
  return array(
    "name"          => "Mark All Forums Read",
    "description"   => "Adds a link to \"mark all forums read\" into the header.",
    "website"       => "http://kurifuri.com/2009/08/11/mark-all-forums-read-mybb-plugin",
    "author"        => "Christopher Fritz",
    "authorsite"    => "http://kurifuri.com/",
    "version"       => "1.0",
    "guid"          => "",
    "compatibility" => "*"
  );
}

function krfr_markallforumsread_activate()
{
  global $db;
  include MYBB_ROOT.'/inc/adminfunctions_templates.php';
  find_replace_templatesets("header_welcomeblock_member", "#".preg_quote('{$lang->welcome_todaysposts}</a>')."#i", '{$lang->welcome_todaysposts}</a><!--KURIFURI MARKALLFORUMSREAD BEGIN--> | <a href="misc.php?action=markread">Mark All Forums Read</a><!--KURIFURI MARKALLFORUMSREAD END-->', 0);
}

function krfr_markallforumsread_deactivate()
{
  global $db;
  include MYBB_ROOT."/inc/adminfunctions_templates.php";
  find_replace_templatesets("header_welcomeblock_member", "#".preg_quote('<!--KURIFURI MARKALLFORUMSREAD BEGIN--> | <a href="misc.php?action=markread">Mark All Forums Read</a><!--KURIFURI MARKALLFORUMSREAD END-->')."#i", '', 0);
}
?>

Tags:

Comments are closed.