Fuzed

Modification: Mark Threads As Read

Version: 0.20

Author: xandra

Support: Fuzed Themes

Introduction

This will automatically mark threads and forums that you've read and also gives you the ability to manually mark them as read or unread. The info is saved in a cookie, so threads will retain their state across sessions.

Usage:

  • you must be logged into your site to use this mod
  • a thread will automatically be marked as read after you've visited or posted a message to it
  • a forum will automatically be marked as read when there are no unread threads left in it
  • to manually mark a thread as read or unread, click the image that indicates the thread's read/unread status
  • to manually mark an entire forum as read or unread, click the image that indicates the forum's read/unread status

This package contains the following files:

extras
infusions
forum_threads_list_panel
locale
English.php
forum_threads_list_panel.php
mod
6.01.4 to 6.01.6
forum
index.php
postify.php
viewforum.php
viewthread.php
locale
English
forum
main.php
php-files
includes
mtr_jscript.js
mtr_functions_include.phpp

Installation

* * * Backup your website before uploading or modifying any files * * *


Note: If you're using the Advanced Forum Threads List Panel by Fuzed Themes, copy the files from the extras folder to the appropriate directories on your site or follow the mod instructions.

Core files used in this mod:

forum
index.php
postify.php
viewforum.php
viewthread.php
locale
English
forum
main.php

Step 1: Upload the contents of the php-files folder to the appropriate directory on your site.

Step 2: If you have not modified any of the above core files on your site, you should be able to use the included files without any problems. Check the mod folder to see if there is a folder that corresponds with your php-fusion version number. If so, upload the contents of that folder to the appropriate directories on your site and installation will be complete. If there are no files included for your specific php-fusion version or you have modified any of the above files on your site, you will need to modify your existing files using the mod instructions below.

Mod Instructions

The instructions below are for PHP-Fusion v6.01.6, but may work on other versions.

Colored Code: Throughout the mod instructions, some of the code is colored red and some blue. The colors show the code changes made for this mod... red is the code that's been removed, while blue is the code that's been added. This should help you figure out what needs to be changed if you have previously modified some of the lines used in this mod.

Files to be modified:

forum
index.php
postify.php
viewforum.php
viewthread.php
infusions
forum_threads_list_panel
locale
English.php *
forum_threads_list_panel.php*
locale
English
forum
main.php

* instructions are for the Advanced Forum Threads List Panel by Fuzed Themes


Open forum/index.php

Find...

if (!isset($lastvisited) || !isNum($lastvisited)) $lastvisited = time();

ADD below it...

if (iMEMBER) {
	echo "<script type='text/javascript' src='".INCLUDES."mtr_jscript.js'></script>";
	include INCLUDES."mtr_functions_include.php";
	$mtr = mtr_get_data();
}

Find...

		if ($data['last_post'] > $lastvisited) {
			$fim = "<img src='".THEME."forum/foldernew.gif' alt='".$locale['560']."'>";

REPLACE with...

		if (iMEMBER) {
			$fim = mtr_set_forum_image();

Save and close.


Open forum/postify.php

Find...

require_once BASEDIR."side_right.php";

ADD above it...

if ($error == 0) {
	include INCLUDES."mtr_functions_include.php";
	$mtr = mtr_get_data("",$thread_id);
}

Open forum/viewforum.php

Find...

if (!FUSION_QUERY || !$forum_id || !isNum($forum_id)) fallback("index.php");

ADD below it...

if (iMEMBER) {
	echo "<script type='text/javascript' src='".INCLUDES."mtr_jscript.js'></script>";
	include INCLUDES."mtr_functions_include.php";
	$mtr = mtr_get_data();
}

Find... Note: these lines appear twice in the code so find and replace both

				if ($data['thread_lastpost'] > $lastvisited) {
					$folder = "<img src='".THEME."forum/foldernew.gif' alt='".$locale['560']."'>";

REPLACE with...

				if (iMEMBER) {
					$folder = mtr_set_thread_image();

Save and close.


Open forum/viewthread.php

Find...

$can_post = checkgroup($fdata['forum_posting']);

ADD below it...

if (iMEMBER) {
	include INCLUDES."mtr_functions_include.php";
	$mtr = mtr_get_data("",$thread_id);
}

Save and close.


Open locale/English/forum/main.php

Find...

?>

ADD above it...

// Mark Threads Read Mod
$locale['MTR_000'] = "Mark Read";
$locale['MTR_001'] = "Mark Unread";

Open infusions/forum_threads_list_panel/forum_threads_list_panel.php

Find...

echo "<script type='text/javascript' language='JavaScript' src='".INFUSIONS."forum_threads_list_panel/ft_boxover.js'></script>";

ADD below it...

if (iMEMBER) {
	echo "<script type='text/javascript' src='".INCLUDES."mtr_jscript.js'></script>";
	include INCLUDES."mtr_functions_include.php";
	$mtr = mtr_get_data();
}

Find and DELETE...

		if (iMEMBER) {
			$new_posts = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."' and post_datestamp>'$lastvisited'");
		} else { $new_posts = 0; }

Find...

			if ($new_posts > 0){

/*******************************************************************
* Start Threads Marked As Read Mod
********************************************************************/
/*
				$viewed_result = dbquery("SELECT threads FROM ".$db_prefix."viewed_threads WHERE user_id = '".$userdata['user_id']."'");
				if (dbrows($viewed_result) != 0) {
					$viewed_data = dbarray($viewed_result);
					$viewed_data2 = explode(".", $viewed_data['threads']);
					$viewed = array();
					for($i = 0; $i < count($viewed_data2); $i ++) {
						$viewed_data = explode("-", $viewed_data2[$i]);
						$viewed[$viewed_data[0]] = $viewed_data[1];
					}
					if (!isset($viewed[$data['thread_id']]) || $viewed[$data['thread_id']] < $data['thread_lastpost']) {
						$folder_image = $imagenew;
					} else { $folder_image = $imageold; }
				} else
*/
/*******************************************************************
* End Threads Marked As Read Mod
********************************************************************/

				$folder_image = $imagenew;

REPLACE with...

			if (iMEMBER) {
				$folder_image = mtr_set_ftlp_image();

Find...

<img src='$folder_image' alt=''>

REPLACE with...

".(iMEMBER && $folder_image != $imagelocked ? $folder_image : "<img src='$folder_image' alt=''>")."

Save and close.

Open infusions/forum_threads_list_panel/locale/English.php

Find...

?>

ADD above it...

// Mark Threads Read Mod
$locale['MTR_000'] = "Mark Read";
$locale['MTR_001'] = "Mark Unread";
$locale['MTR_002'] = "New Posts";
$locale['MTR_003'] = "No New Posts";

Save and close.

Looking for Support?

Please visit us as Fuzed Themes and post your questions regarding this mod in the forum.

PHP-Fusion Copyright © 2002 - 2007 Nick Jones
Released under the terms & conditions of v2 of the GNU General Public License. For details refer to the included gpl.txt file or visit http://gnu.org