New unread posts and 0 replies.

Started by ~DS~, March 04, 2010, 05:24:10 AM

Previous topic - Next topic

~DS~

Ok it annoys me that everytime there's a new unread post or topic and I have decided to read them later...logged out, then login back in a few hours later only to find those new unread posts or topics as it was already read and disappear from "Show unread posts since last visit." What's even worse, it's buried in pages. The same for topics that have 0 replies. I want to replies to topics that have 0 replies only to find they are not on the "Show unread posts since last visit." or "Show new replies to your posts." Is there a easy way to access topics with 0 replies without having to go though all the pages?
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

[unplugged]

For zero-reply topics, I use:

function zeroReplyTopics($type = 'replies', $num_topics = 10, $exclude_boards = null, $output_method = 'echo')

{

global $db_prefix, $txt, $scripturl, $user_info, $modSettings, $smcFunc, $context, $board;



if ($modSettings['totalMessages'] > 100000)

{

// !!! Why don't we use {query(_wanna)_see_board}?

$request = $smcFunc['db_query']('', '

SELECT id_topic, id_board

FROM {db_prefix}topics

WHERE num_replies = 0' . ($modSettings['postmod_active'] ? '

AND approved = {int:is_approved}' : '') . '

AND b.id_board != 4

    AND b.id_board != 6

    AND b.id_board != 7

    AND b.id_board != 22

    AND b.id_board != 158

    AND b.id_board != 435

    AND b.id_board != 436

    AND b.id_board != 440

    AND b.id_board != 443

ORDER BY num_replies ASC

LIMIT {int:limit}',

array(

'is_approved' => 1,

'ignored' => $ignored,

'limit' => $num_topics > 100 ? ($num_topics + ($num_topics / 2)) : 100,

)

);

$topic_ids = array();

while ($row = $smcFunc['db_fetch_assoc']($request))

$topic_ids[] = $row['id_topic'];

$smcFunc['db_free_result']($request);

}

else

$topic_ids = array();



$request = $smcFunc['db_query']('', '

SELECT m.subject, m.id_topic, t.num_views, t.num_replies, b.id_board

FROM {db_prefix}topics AS t

INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)

INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)

WHERE {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '

AND t.approved = {int:is_approved}' : '') . (!empty($topic_ids) ? '

AND t.id_topic IN ({array_int:topic_list})' : '').'

AND b.id_board != 4

AND b.id_board != 6

AND b.id_board != 7

AND b.id_board != 22

AND b.id_board != 158

AND b.id_board != 435

AND b.id_board != 436

AND b.id_board != 440

AND b.id_board != 443

AND t.num_replies = 0

ORDER BY m.id_topic ASC

LIMIT {int:limit}',

array(

'topic_list' => $topic_ids,

'is_approved' => 1,

'limit' => $num_topics,

)

);

$topics = array();

if(!in_array($board, array(4))){

while ($row = $smcFunc['db_fetch_assoc']($request))

{

$context['bi_board'] = $row['id_board'];

censorText($row['subject']);



$topics[] = array(

'id' => $row['id_topic'],

'subject' => $row['subject'],

'num_replies' => $row['num_replies'],

'num_views' => $row['num_views'],

'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',

'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>',

);

}

}

$smcFunc['db_free_result']($request);



if ($output_method != 'echo' || empty($topics))

return $topics;



echo '

<table class="ssi_table">

<tr class="catbg">

<th align="left">', $txt['post'], '</th>

<th align="left">', $txt['views'], '</th>

<th align="left">', $txt['replies'], '</th>

</tr>';

$alt = false;

foreach ($topics as $topic)

{

echo '

<tr class="windowbg', $alt ? '2' : '', '">

<td align="left">

', $topic['link'], '

</td>

<td align="right">', comma_format($topic['num_views']), '</td>

<td align="right">', comma_format($topic['num_replies']), '</td>

</tr>';

$alt = !$alt;

}



echo '

</table>';

}


and then call it using:zeroReplyTopics($type = 'replies', $num_topics = 250, $output_method = 'echo');
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



~DS~

Quote from: SunKing on March 04, 2010, 06:22:42 AM
For zero-reply topics, I use:

function zeroReplyTopics($type = 'replies', $num_topics = 10, $exclude_boards = null, $output_method = 'echo')

{

global $db_prefix, $txt, $scripturl, $user_info, $modSettings, $smcFunc, $context, $board;



if ($modSettings['totalMessages'] > 100000)

{

// !!! Why don't we use {query(_wanna)_see_board}?

$request = $smcFunc['db_query']('', '

SELECT id_topic, id_board

FROM {db_prefix}topics

WHERE num_replies = 0' . ($modSettings['postmod_active'] ? '

AND approved = {int:is_approved}' : '') . '

AND b.id_board != 4

    AND b.id_board != 6

    AND b.id_board != 7

    AND b.id_board != 22

    AND b.id_board != 158

    AND b.id_board != 435

    AND b.id_board != 436

    AND b.id_board != 440

    AND b.id_board != 443

ORDER BY num_replies ASC

LIMIT {int:limit}',

array(

'is_approved' => 1,

'ignored' => $ignored,

'limit' => $num_topics > 100 ? ($num_topics + ($num_topics / 2)) : 100,

)

);

$topic_ids = array();

while ($row = $smcFunc['db_fetch_assoc']($request))

$topic_ids[] = $row['id_topic'];

$smcFunc['db_free_result']($request);

}

else

$topic_ids = array();



$request = $smcFunc['db_query']('', '

SELECT m.subject, m.id_topic, t.num_views, t.num_replies, b.id_board

FROM {db_prefix}topics AS t

INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)

INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)

WHERE {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '

AND t.approved = {int:is_approved}' : '') . (!empty($topic_ids) ? '

AND t.id_topic IN ({array_int:topic_list})' : '').'

AND b.id_board != 4

AND b.id_board != 6

AND b.id_board != 7

AND b.id_board != 22

AND b.id_board != 158

AND b.id_board != 435

AND b.id_board != 436

AND b.id_board != 440

AND b.id_board != 443

AND t.num_replies = 0

ORDER BY m.id_topic ASC

LIMIT {int:limit}',

array(

'topic_list' => $topic_ids,

'is_approved' => 1,

'limit' => $num_topics,

)

);

$topics = array();

if(!in_array($board, array(4))){

while ($row = $smcFunc['db_fetch_assoc']($request))

{

$context['bi_board'] = $row['id_board'];

censorText($row['subject']);



$topics[] = array(

'id' => $row['id_topic'],

'subject' => $row['subject'],

'num_replies' => $row['num_replies'],

'num_views' => $row['num_views'],

'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',

'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>',

);

}

}

$smcFunc['db_free_result']($request);



if ($output_method != 'echo' || empty($topics))

return $topics;



echo '

<table class="ssi_table">

<tr class="catbg">

<th align="left">', $txt['post'], '</th>

<th align="left">', $txt['views'], '</th>

<th align="left">', $txt['replies'], '</th>

</tr>';

$alt = false;

foreach ($topics as $topic)

{

echo '

<tr class="windowbg', $alt ? '2' : '', '">

<td align="left">

', $topic['link'], '

</td>

<td align="right">', comma_format($topic['num_views']), '</td>

<td align="right">', comma_format($topic['num_replies']), '</td>

</tr>';

$alt = !$alt;

}



echo '

</table>';

}


and then call it using:zeroReplyTopics($type = 'replies', $num_topics = 250, $output_method = 'echo');
lol, ok first of all I have no idea where this should be putted.  :P I am not coder expert. So with this codes I can show topics with 0 relies?  Like this: "Show topics with 0 relies"
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

[unplugged]

What version of SMF are you using and where would you like the link?
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



~DS~

Quote from: SunKing on March 04, 2010, 04:03:25 PM
What version of SMF are you using and where would you like the link?
Under "Show new replies to your posts." will do. Boy this should have default in SMF as well as vbullentin's "Today's Posts"
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

[unplugged]

« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



~DS~

"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

[unplugged]

 >:( I have tried three times now to upload some code to my test site and three times some technician somewhere giggles as he turns off my internet. I use that code in conjunction with the Site Integration mod, so I am trying to work out the code to turn it into a standard action for you. Bear with me (and my irritating internet) so I can get it finished. :)


* SunKing crosses his fingers that this post even goes through...
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



~DS~

Quote from: SunKing on March 04, 2010, 06:03:22 PM
>:( I have tried three times now to upload some code to my test site and three times some technician somewhere giggles as he turns off my internet. I use that code in conjunction with the Site Integration mod, so I am trying to work out the code to turn it into a standard action for you. Bear with me (and my irritating internet) so I can get it finished. :)


* SunKing crosses his fingers that this post even goes through...
Take your time.  :)
Will be back later tonight as duty calls.
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

[unplugged]

Well, to add insult to injury, I cannot seem to be able to figure out exactly how to turn it into a standalone action. Well, I got it to work, it just shows the topics with zero replies up above the forum template instead of nicely inside it. You can see the standalone here: http://www.empireofthesun.net/testsite/index.php?action=zeroreplies
username: test password: test

The version I actually use through the Site Integration mod can be seen here: http://www.empireofthesun.net/forum/index.php?action=zero
username: test password: tester123

So the code works, I just cannot get it to work properly on its own. I at least got you headed in the right direction. ;)
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



~DS~

Quote from: SunKing on March 04, 2010, 09:56:51 PM
Well, to add insult to injury, I cannot seem to be able to figure out exactly how to turn it into a standalone action. Well, I got it to work, it just shows the topics with zero replies up above the forum template instead of nicely inside it. You can see the standalone here: http://www.empireofthesun.net/testsite/index.php?action=zeroreplies
username: test password: test

The version I actually use through the Site Integration mod can be seen here: http://www.empireofthesun.net/forum/index.php?action=zero
username: test password: tester123

So the code works, I just cannot get it to work properly on its own. I at least got you headed in the right direction. ;)
Ummm...not working. You have some topics with 0 relies and I clicked the link it shows up nothing.
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

[unplugged]

Oops, somehow the permissions didn't get applied. It's fixed now. Sorry.
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



~DS~

"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

aussieherps

Where do I post the code you are using. I am on 2.0rc2
http://aussieherps.com">snakes lizards spiders turtles and much more

[unplugged]

I am using it in conjunction with the Site Integration mod and the code is just in it's own file. I am trying to finish up getting the code into it's own action.
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



Advertisement: