News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Show unread topics for a specific board

Started by [Unknown], September 11, 2004, 03:31:27 PM

Previous topic - Next topic

[Unknown]

Ever wondered if you could show the unread topics in just one specific board?  For example, maybe you marked some topic in SMF Coding Discussion unread, but you can't find it - you just know it's in there.

Well, it'd sure help to be able to show unread topics in that board, wouldn't it?  You can!  All you do is you take this:

http://www.simplemachines.org/community/index.php?action=unread

And then you add the board to it:

http://www.simplemachines.org/community/index.php?action=unread;board=60.0

But we're not done.  You probably want "since all time", not "for a wee bit".  So let's add all on there too:

http://www.simplemachines.org/community/index.php?action=unread;board=60.0;all

Nice, eh?  Now you've got all the unread topics - in that board.  This works if you're looking for unread topics you've posted in too, like so:

http://www.simplemachines.org/community/index.php?action=unreadreplies;board=60.0
(this doesn't need "all" ;).)

There's no interface for this, but that doesn't mean you can't make a theme that has one ;).

-[Unknown]

Anguz

Pretty cool man, I was just thinking about this yesterday. :)

What other features are there in the code that are still not visible in the themes?
Cristián Lávaque http://cristianlavaque.com

Fizzy

#2
I was hoping to make a small change to the unread topics function but it doesn't seem to be doing what I would like.

When clicking on "Show new replies to your posts" I would like the member to only see the posts that they started so I managed to find in SubsBoards.PHP


elseif (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'unreadreplies')
{
// Make sure all the boards are integers!
$topics = explode('-', $_REQUEST['topics']);

$setString = '';
foreach ($topics as $ID_TOPIC)
{
$ID_TOPIC = (int) $ID_TOPIC;
$setString .= "
(" . time() . ", $ID_MEMBER, $ID_TOPIC),";
}

db_query("
REPLACE INTO {$db_prefix}log_topics
(logTime, ID_MEMBER, ID_TOPIC)
VALUES" . substr($setString, 0, -1), __FILE__, __LINE__);

redirectexit('action=unreadreplies');
}


Whcih I then changed to


elseif (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'unreadreplies')
{
// Make sure all the boards are integers!
$topics = explode('-', $_REQUEST['topics']);

$setString = '';
foreach ($topics as $ID_TOPIC)
{
$ID_TOPIC = (int) $ID_TOPIC;
$setString .= "
(" . time() . ", $ID_MEMBER_STARTED, $ID_TOPIC),";
}

db_query("
REPLACE INTO {$db_prefix}log_topics
(logTime, ID_MEMBER_STARTED, ID_TOPIC)
VALUES" . substr($setString, 0, -1), __FILE__, __LINE__);

redirectexit('action=unreadreplies');
}


It didn't change the results though.
Is there any chance you could have a look and give me some pointers where I'm going wrong please?

Thanks



{edit>

Oh hang on, am I right in thinking that the above writes in to the 'log_topics' table?
That explains my goof in part. There is no field in the table for "ID_Member_Started" so I need to find something somewhere else to help me sort/filter the data?
"Reality is merely an illusion, albeit a very persistent one." - A.E.


[Unknown]

I think you're looking in the wrong file.  Try Recent.php.

-[Unknown]

Fizzy

Thanks [Unknown]

I was kind of hoping you wouldn't say Recent.php  ;D

Looking through that I am a bit totally confused (who am I trying to kid :) )  about which part to fiddle with without messing up the whole forum.
Any chance you could give me a clue please if I should be looking for something like
'id' => $row['ID_FIRST_MEMBER'],
or maybe
AND t.ID_MEMBER_STARTED = $ID_MEMBER

? ?
"Reality is merely an illusion, albeit a very persistent one." - A.E.


[Unknown]

Find:

$request = db_query("
SELECT COUNT(DISTINCT t.ID_TOPIC)
FROM {$db_prefix}messages AS ml, {$db_prefix}topics AS t, {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_TOPIC = t.ID_TOPIC)
WHERE t.ID_MEMBER_UPDATED != $ID_MEMBER
AND m.ID_MEMBER = $ID_MEMBER
AND ml.ID_MSG = t.ID_LAST_MSG
AND b.ID_BOARD = t.ID_BOARD
AND $query_this_board
AND IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) < ml.posterTime", __FILE__, __LINE__);


Replace:
$request = db_query("
SELECT COUNT(DISTINCT t.ID_TOPIC)
FROM {$db_prefix}messages AS ml, {$db_prefix}topics AS t, {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
WHERE t.ID_MEMBER_UPDATED != $ID_MEMBER
AND t.ID_MEMBER_STARTED = $ID_MEMBER
AND ml.ID_MSG = t.ID_LAST_MSG
AND b.ID_BOARD = t.ID_BOARD
AND $query_this_board
AND IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) < ml.posterTime", __FILE__, __LINE__);


Find:
$request = db_query("
SELECT DISTINCT t.ID_TOPIC
FROM {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ml
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_TOPIC = t.ID_TOPIC)
WHERE t.ID_MEMBER_UPDATED != $ID_MEMBER
AND m.ID_MEMBER = $ID_MEMBER
AND ml.ID_MSG = t.ID_LAST_MSG
AND b.ID_BOARD = t.ID_BOARD
AND $query_this_board
AND IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) < ml.posterTime
ORDER BY ml.ID_MSG DESC
LIMIT $_REQUEST[start], $modSettings[defaultMaxTopics]", __FILE__, __LINE__);


Replace:
$request = db_query("
SELECT DISTINCT t.ID_TOPIC
FROM {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ml
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
WHERE t.ID_MEMBER_UPDATED != $ID_MEMBER
AND t.ID_MEMBER_STARTED = $ID_MEMBER
AND ml.ID_MSG = t.ID_LAST_MSG
AND b.ID_BOARD = t.ID_BOARD
AND $query_this_board
AND IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) < ml.posterTime
ORDER BY ml.ID_MSG DESC
LIMIT $_REQUEST[start], $modSettings[defaultMaxTopics]", __FILE__, __LINE__);


-[Unknown]

Fizzy

That's fantastic [Unknown]   :D

Thanks for your help with that.

I'm pleased that I was on the right track with the
AND t.ID_MEMBER_STARTED = $ID_MEMBER
but it looks like I made the mistake of leaving in the original
AND m.ID_MEMBER = $ID_MEMBER
which presumably caused a conflict.
"Reality is merely an illusion, albeit a very persistent one." - A.E.


mytreo

Quote from: [Unknown] on September 11, 2004, 03:31:27 PM
Ever wondered if you could show the unread topics in just one specific board? For example, maybe you marked some topic in SMF Coding Discussion unread, but you can't find it - you just know it's in there.

Well, it'd sure help to be able to show unread topics in that board, wouldn't it? You can! All you do is you take this:

http://www.simplemachines.org/community/index.php?action=unread

And then you add the board to it:

http://www.simplemachines.org/community/index.php?action=unread;board=60.0

But we're not done. You probably want "since all time", not "for a wee bit". So let's add all on there too:

http://www.simplemachines.org/community/index.php?action=unread;board=60.0;all

Nice, eh? Now you've got all the unread topics - in that board. This works if you're looking for unread topics you've posted in too, like so:

http://www.simplemachines.org/community/index.php?action=unreadreplies;board=60.0
(this doesn't need "all" ;).)

There's no interface for this, but that doesn't mean you can't make a theme that has one ;).

-[Unknown]

This is Brilliant [Unknown], really Brilliant!

But (oh no :) ), I discovered a problem maybe you can help fix please? When I view this link for example and there is more than 1 page of new replies, clicking the link to the next page in the [1] [2] [3] page menu doesn't keep the "board=4.0" in the URL and so it takes you to the ALL Unread replies page. Not so useful.

Thanks for reading, I hope someone can help
Chris
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

[Unknown]


mytreo

Quote from: [Unknown] on January 03, 2005, 11:18:33 PM
Darn, fixed...

-[Unknown]

Great! This is an awesome built in feature. I intend to code this into our theme so that when there are new posts in a board you can click the "On.gif" icon on the board index to quickly view all unread from that board.
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Anguz

Quote from: mytreo on January 04, 2005, 06:35:16 AM
Great! This is an awesome built in feature. I intend to code this into our theme so that when there are new posts in a board you can click the "On.gif" icon on the board index to quickly view all unread from that board.

That's a great idea to implement it. :)
Cristián Lávaque http://cristianlavaque.com

mytreo

Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

mytreo

#12
Quote from: [Unknown] on January 03, 2005, 11:18:33 PM
Darn, fixed...

-[Unknown]

Hi [Unknown] I noticed this is fixed in v1.0.1 :D :D thank you, but unfortunately it revealed another tiny thing that needs your developer gun...

When there is more than one page of new topics on a specific board like in this link clicking to go to the next page has no effect, it's like it doesn't understand what to do with the start=xx. Could you let me know what changes to make please so that this works? Thank you! :)

On a related note, it would be nice if when board=xx is set the page <title> displayed "Board Name - All Unread Topics" intead of "All Unread Topics".

Cheers
Chris
Treo forum - Powered by SMF, of course
Treo news - powered by MovableType and integrated with SMF
Treo downloads - hacked from phpNuke and integrated with SMF
Treo knowledge base - powered by Wikka and integrated with SMF
Treo 650 | Treo 700w | Treo 700p

Cerberus

It would be nice to have a sort of dropdown menu with the list of the boards (like the jump to)
Best Regards, Cerberus
YaBB Gold -> YaBB 1.1 -> YaBB SE (YaPP -> PfaBB) -> SMF
Pocket PC Russia

bloc

Yes, a dropdown menu could easily made when on frontpage, you could just traverse the boards info for that.

But 2 or 3 small icons instead would be cool..maybe put them in top right corner of board name/description, or even in a narrow single column to the right of the whole board-row. 

forumite

I'm getting requests from folks who want to exclude one or more boards when they click show unread posts. Can this be done with some modification of the URL examples here or a code change?

TIA

Ivan Minic

Quote from: rvforumite on May 30, 2005, 08:52:54 PM
I'm getting requests from folks who want to exclude one or more boards when they click show unread posts. Can this be done with some modification of the URL examples here or a code change?

TIA
Need this badly too... but exclude it only in show unread posts, not as ignore forum mod does.
Maybe put a table with forums next to results in another column where you can click what to exclude od something like that...

altdot

Is there a way to show unread/recent topics per category instead of per board? Our forum has a pretty wide demographic, and members want to see everything in a category rather than everything in boards x, y, z.  (Like, "see all unread topics in SMF SUPPORT".) Right now, I've got hard-coded links that append the boards in the various categories, but that's a PITA to maintain when new sub-boards are created.

bloc

Yes, it is. And its dead easy. The link is simply index.php?action=unread;c=2 where 2 is the id of the category.

altdot

Oh, excellent! What versions is that supported in?

Advertisement: