UBB.Dev
Mod Name / Version: Correct mark posts as read or unread in Threaded mode

Description: Correctly read read/unread posts in threaded mode.
Testet in 6.5.1 (should also work in 6.5)

Working Under: UBB.Threads 6.5

Mod Status: Beta

Any pre-requisites:

Author(s): Yakub ([email protected])

Date: 02/21/05

Credits:

Files Altered: showthreaded.php

New Files: No.

Database Altered: Add U_TempRead (VARCHAR 255) field of the end of w3t_Users

Info/Instructions: Find:
$Subjectlinkstart = "";
$Subjectlinkstop = "";

Add below:
$read = "";

Find:
global $config,$dbh,$theme,$images,$ubbt_lang, $thispath,$tempstyle,$replycode,$tree,$z,$postrow,$modcheck, $var_start, $var_eq, $var_sep,$topicread,$mainpostid;

Change for:
global $config,$dbh,$theme,$images,$ubbt_lang, $thispath,$tempstyle,$replycode,$tree,$z,$postrow,$modcheck, $var_start, $var_eq, $var_sep,$topicread,$mainpostid,$read,$username2;

Find:
$imagesize = $images['icons'];
if (!in_array($PNumber,$topicread['threaded_read']['track']) && $Posted > $unread) {
$alt = "*";
$folder = "newfolder.gif";
$topicread[$mainpostid] = $html->get_date();
$_SESSION['topicread'] = $topicread;
}
else {
$alt = "*";
$folder = "nonewfolder.gif";
}
if ( ($Open == "C") || ($Open == "M") ){
$Icon = "lock.gif";
}
Change for:
$time = $html -> convert_time($Posted,$offset,$timeformat);
$alt = ".";


$check = ",$PNumber,";
$check_akt = ",$Number,";

$imagesize = $images['icons'];

if ($config['newcounter']) {

if ( (!strstr($read,$check)) && $Posted > $unread ) { //echo "debug1";

if ($check==$check_akt)
{
$alt = "*";
$folder = "nonewfolder.gif";
}
else
{
$alt = "*";
$folder = "newfolder.gif";
}
$topicread[$mainpostid] = $html->get_date();
$_SESSION['topicread'] = $topicread;

$read2 = $read . ",$Number,";
$Username_q = addslashes($username2);
$read_q = addslashes($read2);

$query = "
UPDATE {$config['tbprefix']}Users
SET U_TempRead = '$read_q'
WHERE U_Username = '$Username_q'
";




$dbh -> do_query($query);

}
else {
$alt = "*";
$folder = "nonewfolder.gif";
} }
if ( ($Open == "C") || ($Open == "M") ){
$Icon = "lock.gif";
}

Find:
// Get the user info
$userob = new user;
$user = $userob -> authenticate("U_Display, U_Groups, U_PostsPer, U_PicturePosts, U_FlatPosts, U_TimeOffset,U_ShowSigs,U_TimeFormat,U_Ignored,U_Preview,U_TextCols,U_TextRows");

Change for:
// -----------------
// Get the user info
$userob = new user;
$user = $userob -> authenticate("U_Display, U_Groups, U_PostsPer, U_PicturePosts, U_FlatPosts, U_TimeOffset,U_ShowSigs,U_TimeFormat,U_Ignored,U_Preview,U_TextCols,U_TextRows,U_TempRead,U_Username");
$read = $user['U_TempRead'];
$username2 = $user['U_Username'];

//echo $username2;

//echo $read;

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
Great... it seems to be working...
It works, but it doesn't. It works if you enter a forum from the main index page, but if you click the link of a thread from the main index, the lightbulb is still there when you open another browser at any time. Part of the problem solved though
© UBB.Developers