How do I change this to recent topics instead?
I've looked through the BoardIndex.php file and the BoardIndex.template.php files and tried a few things but I can't get it to work.
You can enable recent posts on the box index in Admin > Current Theme > Number of recent posts to display on board index: [value].
If you want it to be topics, one possible solution is to omit all topic names that have "re" in front of them
Quote from: ccbtimewiz on August 02, 2008, 01:07:07 PM
You can enable recent posts on the box index in Admin > Current Theme > Number of recent posts to display on board index: [value].
If you want it to be topics, one possible solution is to omit all topic names that have "re" in front of them
...I realise this ;)
Quote from: Septimus on August 02, 2008, 01:54:55 AM
How do I change this to recent topics instead?
I've looked through the BoardIndex.php file and the BoardIndex.template.php files and tried a few things but I can't get it to work.
I want them to be topics and not posts.
Quote from: Septimus on August 02, 2008, 10:16:34 PM
I want them to be topics and not posts.
Quote from: ccbtimewiz on August 02, 2008, 01:07:07 PM
If you want it to be topics, one possible solution is to omit all topic names that have "re" in front of them
;)
Quote from: ccbtimewiz on August 02, 2008, 10:22:05 PM
Quote from: Septimus on August 02, 2008, 10:16:34 PM
I want them to be topics and not posts.
Quote from: ccbtimewiz on August 02, 2008, 01:07:07 PM
If you want it to be topics, one possible solution is to omit all topic names that have "re" in front of them
;)
...I don't know how to do that and you arent telling me so how on earth am I supposed to do that?
i believe this mod is able to do this:
http://custom.simplemachines.org/mods/index.php?mod=1069
however, i don't believe it works with SMF 2.0 yet though there is another mod which may do similar (i havent tried it)
http://custom.simplemachines.org/mods/index.php?mod=654
I hate to be trouble but I want it to be static, not an option. I don't want all of the features of that mod. I used that mod on 1.1.5 and it caused me some trouble.
I just want recent topics instead of posts. I did this on 1.1.5 but have been unable to do it for 2.0.
Is there something in the code I can edit?
Yep, here is a quick/nasty edit that will do it for you.
Open up your 'Subs-Recent.php' file and perform the following edit:
Find this code:
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
Replace it with this code:
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m2.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}messages AS m2 ON (m2.id_msg = t.id_first_msg)
Don't forget to clear the file cache before it will update.
Thankyou for that code but unless I'm looking in the wrong file it isnt there :(
The closest to it is this:
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_msg >= {int:likely_max_msg}' .
(!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY m.id_msg DESC
LIMIT ' . $latestPostOptions['number_posts'],
array(
'likely_max_msg' => max(0, $modSettings['maxMsgID'] - 20 * $latestPostOptions['number_posts']),
'recycle_board' => $modSettings['recycle_board'],
'is_approved' => 1,
Did you need me to attach my file?
Nope, replace that code which you posted. With the code below:
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m2.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}messages AS m2 ON (m2.id_msg = t.id_first_msg)
WHERE m.id_msg >= {int:likely_max_msg}' .
(!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY m.id_msg DESC
LIMIT ' . $latestPostOptions['number_posts'],
array(
'likely_max_msg' => max(0, $modSettings['maxMsgID'] - 20 * $latestPostOptions['number_posts']),
'recycle_board' => $modSettings['recycle_board'],
'is_approved' => 1,
Well....that wasnt exactly what I wanted.
QuoteName the Bands by Mouse (Fun and Games) Today at 09:44 PM
Name the Bands by Mouse (Fun and Games) Today at 09:40 PM
Name the Bands by Mouse (Fun and Games) Today at 09:32 PM
Name the Bands by Mouse (Fun and Games) Today at 09:30 PM
Name the Bands by Mouse (Fun and Games) Today at 09:28 PM
I just want it listed once...I want it to be like the unread topics list in the way that it shows the topics and goes to the last unread...but still be the forums recently replied to topics..
I feel like I'm being such a pain :(
Its no problem, try this:
$request = $smcFunc['db_query']('substring', '
SELECT DISTINCT
m.poster_time, m2.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}messages AS m2 ON (m2.id_msg = t.id_first_msg)
WHERE m.id_msg >= {int:likely_max_msg}' .
(!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
GROUP BY m2.subject
ORDER BY m.id_msg DESC
LIMIT ' . $latestPostOptions['number_posts'],
array(
'likely_max_msg' => max(0, $modSettings['maxMsgID'] - 20 * $latestPostOptions['number_posts']),
'recycle_board' => $modSettings['recycle_board'],
'is_approved' => 1,
That seems to work for me, although maybe somebody with more MySQL experience could check over it?
QuoteI feel like I'm being such a pain :(
Not at all. :)
LHVWB: you should consider packaging it as a mod. I think theres a few that'd be interested in it.
It looks okay to me...just the times to be concerned about.
It shows when the topic was started, at 8PM...the last post was at 10:10 PM....can I make it show the last posts time instead of the topic start time?
Quote from: metallica48423 on August 03, 2008, 12:08:32 AM
QuoteI feel like I'm being such a pain :(
Not at all. :)
LHVWB: you should consider packaging it as a mod. I think theres a few that'd be interested in it.
Agreed, and thank you :D
And....when I reply to topics they arent bumped up to the top....they arent even on the list :(
Quote from: Septimus on August 03, 2008, 12:15:26 AM
And....when I reply to topics they arent bumped up to the top....they arent even on the list :(
Hmm, I have been trying to fix that for a while now. I can't find a solution. I will have another try later though.
Maybe somebody with better SQL skills can give it a go?
If I do manage to solve it, then I will make a mod. ;)
QuoteAnd....when I reply to topics they arent bumped up to the top....they arent even on the list :(
Wouldn't that basically make it the exact same thing as the last posts, just with a group by?
@metallica48423,
With the last query that I posted, it will make a list of the most recent topics which have been updated, unfortunately it will take the time/data/link/message id information from the first of the recent messages from each of those topics, meaning that you get the correct recent topics but they are in the wrong order and they have the wrong information. Effectively it needs to sort them by message id before it sorts them with the GROUP BY, but as far as I can see, GROUP BY always has more precedence than ORDER BY.... In short I am a SQL n00b. ;)
I tried to fix it, but I think that I'll have to find another way to do it. ;)
That's what I did, even if it could be done better.
IƬve just used the ssi_examples code.
./Forum/Themes/default/Boardindex.template.php
At the very top
you have:
<?php
// Version: 2.0 Beta 3 Public; BoardIndex
function template_main()
I've replaced with
<?php
// Version: 2.0 Beta 3 Public; BoardIndex
require_once($boarddir . '/SSI.php');
function template_main()
Info Center area
Find:
<td class="titlebg" colspan="2">', $txt['recent_posts'], '</td>
Replace with
<td class="titlebg" colspan="2">Recent Topics</td>
Then find:
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table cellpadding="0" cellspacing="0" width="100%" border="0">';
/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
And I've replaced with
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table cellpadding="0" cellspacing="0" width="100%" border="0">';
$posts = ssi_recentTopics($settings['number_recent_posts'], null, 'return');
/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($posts as $post)
It folllows the admin setting for the number of recent posts, but it displays the last recent topics.
That seems to have the correct functionality but I have managed to create another db_query which works. Its basically just a hack from the ssi_recentTopics function, but it seems to work perfectly. I might package it when I get some free time.
Replace that entire db query, from beginning to end with this query:
$request = $smcFunc['db_query']('', '
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS isRead,
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
WHERE t.id_last_msg >= {int:min_message_id}
AND ' . $user_info['query_wanna_see_board'] . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY t.id_last_msg DESC
LIMIT ' . $latestPostOptions['number_posts'],
array(
'current_member' => $user_info['id'],
'min_message_id' => $modSettings['maxMsgID'] - 35 * min($latestPostOptions['number_posts'], 5),
'is_approved' => 1,
)
);
Okay, I have finished and uploaded the mod to the mod site. Its called "Recent Topics On Board Index", you will have to wait until its approved though. I've been keeping the mod approval team busy, this is number 3 at the moment that isn't approved yet. ;)
If anyone asks, metallica48423 made me do it! :P
BTW, it works with both versions of SMF. ;)
THANK YOU LHVWB :D
I really appreciate it, it's something my members have been asking for!
Tatore, your method looks like it might work but I plan to use the SSI.php on my main site. I discovered heavy loads to that could cause issues so I'd rather not call it on my busy forum as well as the site. I cannot recall where I heard that from actually, they could have been lieing.
Thank you for your help :D
Yes, perfectly understood. ;)
I've just reported how do I use the SSI functions, and toke the occasion to try it with smf2b3.
I don't really know if it may represent a trouble with a busy forum, not with mine, but I've about 1.550 users, and use in the meantime the same fuction to generate thumbs from the gallery. All of this with about a final 15/18 queries on the main page.
I'll wait for LHVWB 's mod, if it should be less heavy for the entire site :)
Yeah. I have to use it on my webpages too, so I dont want to wear the file out ;).
Thank you all for the help, it's much appreciated :D.
Here is a link to the approved mod:
http://custom.simplemachines.org/mods/index.php?mod=1314