TinyPortal

Development => Support => Topic started by: Ray on October 01, 2005, 05:33:39 PM

Title: mark as read
Post by: Ray on October 01, 2005, 05:33:39 PM
When I try to use the mark as read on this site i get a
An Error Has Occurred!
Session verification failed. Please try logging out and back in again, and then try again.
lol what up with that?? I thought only my site did stuff like that ::)
Title: Re: mark as read
Post by: bloc on October 01, 2005, 06:43:37 PM
I haven't updated the themes yet..only default theme is working. :/
Title: Re: mark as read
Post by: Nokonium on October 01, 2005, 07:23:54 PM
I get that on RC1 in my themes but not in a 'virgin' default theme, the theme needs updating.
Title: Re: mark as read
Post by: RoarinRow on January 15, 2006, 06:27:20 PM
When I use 'Mark As Read' on TP .75 with Techhead TP, it brings me to the Home page instead of back to the Forum page that I came from.

How can I fix this?
Title: Re: mark as read
Post by: bloc on January 16, 2006, 12:04:32 PM
does the board(s) get marked as read?
Title: Re: mark as read
Post by: gerrymo on January 16, 2006, 12:11:59 PM
Quote from: RoarinRow on January 15, 2006, 06:27:20 PM
When I use 'Mark As Read' on TP .75 with Techhead TP, it brings me to the Home page instead of back to the Forum page that I came from.

How can I fix this?

It happens all the time on my sites if you hit Mark Read on /index.php?action=forum It takes me back to index.php with all posts marked read. But in the boards themselves, it works as it should.
Title: Re: mark as read
Post by: RoarinRow on January 16, 2006, 10:55:49 PM
Quote from: gerrymo on January 16, 2006, 12:11:59 PM
Quote from: RoarinRow on January 15, 2006, 06:27:20 PM
When I use 'Mark As Read' on TP .75 with Techhead TP, it brings me to the Home page instead of back to the Forum page that I came from.

How can I fix this?

It happens all the time on my sites if you hit Mark Read on /index.php?action=forum It takes me back to index.php with all posts marked read. But in the boards themselves, it works as it should.

Yup, this is exactly what happens to me. 

Quote from: Bloc on January 16, 2006, 12:04:32 PM
does the board(s) get marked as read?

It does.
Title: Re: mark as read
Post by: bloc on January 18, 2006, 04:23:20 PM
hm, maybe its missing a session variable in the link?
Title: Re: mark as read
Post by: Rasyr on January 18, 2006, 04:39:36 PM
More than likely the redirect function is set so that if you are in the forums when you hit the mark as read button, it takes you directly back to the BoardIndex, only it thinks that the BoardIndex is index.php, not index.php?action=forum.

Title: Re: mark as read
Post by: Rasyr on January 18, 2006, 05:00:10 PM
Found it!!  ;D

In Sub-Boards.php (in Sources, around lines 207-229) find the following:


if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'all')
{
// Find all the boards this user can see.
$result = db_query("
SELECT b.ID_BOARD
FROM {$db_prefix}boards AS b
WHERE $user_info[query_see_board]", __FILE__, __LINE__);
$boards = array();
while ($row = mysql_fetch_assoc($result))
$boards[] = $row['ID_BOARD'];
mysql_free_result($result);

if (!empty($boards))
markBoardsRead($boards, isset($_REQUEST['unread']));

$_SESSION['ID_MSG_LAST_VISIT'] = $modSettings['maxMsgID'];
if (!empty($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'action=unread') !== false)
redirectexit('action=unread');

if (isset($_SESSION['topicseen_cache']))
$_SESSION['topicseen_cache'] = array();

redirectexit();



Change it to the following (note: this change ONLY affects the last line of code - the rest was given to make it easier to find):

if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'all')
{
// Find all the boards this user can see.
$result = db_query("
SELECT b.ID_BOARD
FROM {$db_prefix}boards AS b
WHERE $user_info[query_see_board]", __FILE__, __LINE__);
$boards = array();
while ($row = mysql_fetch_assoc($result))
$boards[] = $row['ID_BOARD'];
mysql_free_result($result);

if (!empty($boards))
markBoardsRead($boards, isset($_REQUEST['unread']));

$_SESSION['ID_MSG_LAST_VISIT'] = $modSettings['maxMsgID'];
if (!empty($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'action=unread') !== false)
redirectexit('action=unread');

if (isset($_SESSION['topicseen_cache']))
$_SESSION['topicseen_cache'] = array();

redirectexit('action=forum');


I tried this locally and it worked for redirecting me back to BoardIndex without a hassle.

Title: Re: mark as read
Post by: RoarinRow on January 18, 2006, 08:05:27 PM
My Sub-Boards.php for my SMF 1.0.5 is a little different.  Do you think you line of code will work for mine?

I have it in two places:

// Find all the boards this user can see.
$result = db_query("
SELECT b.ID_BOARD
FROM {$db_prefix}boards AS b
WHERE $user_info[query_see_board]", __FILE__, __LINE__);
if (mysql_num_rows($result) > 0)
{
$boards = array();
while ($row = mysql_fetch_assoc($result))
$boards[] = $row['ID_BOARD'];

markBoardsRead($boards, isset($_REQUEST['unread']));
}
mysql_free_result($result);

$_SESSION['ID_MSG_LAST_VISIT'] = $modSettings['maxMsgID'];
if (!empty($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'action=unread') !== false)
redirectexit('action=unread');

redirectexit();
}
elseif (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'unreadreplies')
{


and

// Find all the boards this user can see.
$result = db_query("
SELECT b.ID_BOARD
FROM {$db_prefix}boards AS b
WHERE b.ID_PARENT = $board
AND childLevel = " . ($board_info['child_level'] + 1) . "
AND $user_info[query_see_board]", __FILE__, __LINE__);
if (mysql_num_rows($result) > 0)
{
$setString = '';
while ($row = mysql_fetch_assoc($result))
$setString .= '
(' . time() . ', ' . $ID_MEMBER . ', ' . $row['ID_BOARD'] . '),';

db_query("
REPLACE INTO {$db_prefix}log_boards
(logTime, ID_MEMBER, ID_BOARD)
VALUES" . substr($setString, 0, -1), __FILE__, __LINE__);
}
mysql_free_result($result);

redirectexit('board=' . $board . '.0');
}
else
{
if (empty($board_info['parent']))
redirectexit();
else
redirectexit('board=' . $board_info['parent'] . '.0');
}
}
}
Title: Re: mark as read
Post by: Rasyr on January 18, 2006, 08:37:40 PM
The second code quote appears to be the portion where you get redirected back to the parent board from a child board. The first code quoteis where you want to place the 'action=forum' inside the redirectexit() function.

If you look at the line above what you put in the first quote, it reads:

if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'all')
{


The important part there is the 'sa' and the 'all', as if you are on the BoardIndex, and hold your mouse over the "Mark Read" button, you will see a url in the bar along the bottom of the browser. That url contains 'sa=all', thus the first section  you quoted is the one you should want.
Title: Re: mark as read
Post by: RoarinRow on January 18, 2006, 09:00:10 PM
Quote from: Rasyr on January 18, 2006, 08:37:40 PM
The second code quote appears to be the portion where you get redirected back to the parent board from a child board. The first code quoteis where you want to place the 'action=forum' inside the redirectexit() function.

If you look at the line above what you put in the first quote, it reads:

if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'all')
{


The important part there is the 'sa' and the 'all', as if you are on the BoardIndex, and hold your mouse over the "Mark Read" button, you will see a url in the bar along the bottom of the browser. That url contains 'sa=all', thus the first section  you quoted is the one you should want.

Cool, thanks Rasyr.  Karma for you from your help yesterday and today!  :)
Title: Re: mark as read
Post by: iwyen on February 18, 2006, 04:58:00 AM
Thanks Rasyr. I tied to edit it to check w/r frontpage is showing forum board index or not so that it will redirect to index.php in the former case and to index.php?action=forum in the latter case. But I failed. I thought it would be cleaner, but I guess it doesn't matter that much  ;)