TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

July 01, 2024, 08:04:33 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,283
  • Total Topics: 21,227
  • Online today: 93
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 104
  • Total: 104

[BLOCK] Unanswered Topics Block

Started by shengton, September 26, 2008, 09:26:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JPDeni

QuoteMay I suggest this to not list the deleted posts, but only the valid posts...

Good job! I had thought about the recycle bin problem, but then forgot while I was doing something else.

Ianedres

If you're through with the block, why not change the subject line with [block] to make it appear in the recent blocks...   ;)

@ Ich - I am all for using organized code and the ternary doesn't bother me (now that I know what it is!)...

This could be a very useful tool for admins/moderators to help monitor and keep their boards active.

JPDeni

Quotewhy not change the subject line with [block] to make it appear in the recent blocks.
Will do. :)

(Just poke me if I forget something. My brain still is in a fog.)

shengton

#13
Hi Sir JPDeni, good day.

Thanks for the codes Sir and I really appreciate your effort. I noticed something, the topics that are already moved are included. I'm talking about the "MOVED: SubjectTitle"

QuoteThis topic has been moved to Applications.

http://www.pc-forums.org/forum/index.php?topic=4967.0

The Reported Topics and Deleted Topics are also included in the block which is not right.

Hope you can help me with this Sir JPDeni.

Thanks and God bless. :)

Ken.

Quote from: SHENGTON on October 01, 2008, 04:34:17 PM
Hi Sir JPDeni, good day.
Thanks and God bless. :)

Actually JP is not a "Sir", but she is most definitely a Lady. :)
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

JPDeni

Try this:


global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 10; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 1; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 0) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
AND m.subject NOT LIKE '%MOVED:%'
ORDER BY t.ID_FIRST_MSG " . $order . ' ' .
$limit, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
  echo '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a><br />';


Iandres's addition to the code took care of deleted topics in a "recycle bin." I don't know how to not include reported topics.

shengton

#16
Sorry I didn't know she's a woman.

Hi Maam JPDeni. :)

Looks ok now. The Reported Topics, Deleted Topics and the Moved Topics are already gone. But one more thing is, looks like there's no dot before the title of topic.

This is the output of your code:
Windows Vista
Linux is Great
Windows XP themes
Four Windows in one computer?
What is core?
What is Windows?
What is Processor?
True or False


I want to look like this:
o Windows Vista
o Linux is Great
o Windows XP themes
o Four Windows in one computer?
o What is core?
o What is Windows?
o What is Processor?
o True or False


The dot color either gray or skyblue. But it's up to you Maam if what colors should fit.

I really really appreciate your effort Maam and you're a good programmer. Hope you can help me with this.

Thanks and God bless. :)

IchBin

Change this:
while ($row = mysql_fetch_assoc($query))
  echo '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a><br />';


To this:
echo '<ul>';
while ($row = mysql_fetch_assoc($query))
  echo '<li><a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a></li>';
echo '</ul>';

shengton

#18
Perfect...This is what I need...Yehey..Thanks guys. You're great programmers.

global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 5; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 0; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 0) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
AND m.subject NOT LIKE '%MOVED:%'
ORDER BY t.ID_FIRST_MSG " . $order . ' ' .
$limit, __FILE__, __LINE__);

echo '';
while ($row = mysql_fetch_assoc($query))
  echo '<img src="image url"> <a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . ' <img src="image url"></a>';
echo '</ul>';

shengton

Guys I need your help again regarding this topic. I want to put an image "new" after the topic.

The output should be like this:
Quoteo Windows Vista
o Linux is Great
o Windows XP themes
o Four Windows in one computer?
o What is core?
o What is Windows?
o What is Processor?
o True or False

Hope you can help with this.

Thanks and God bless. :)