SimplePortal
Support => English Support => Topic started by: LP on December 15, 2009, 05:57:09 PM
-
Hello,
I am using SP 2.3.1 with SMF 2 RC1.2.
I use a "Recent Topics" block on my forum. I have noticed that when one topic is a "hot" topic and gets many posts in a short period of time, the number of topics shown in the Recent Topics block starts decreasing.
I run a sports forum and when there is a big game happening, there are many users posting in the current game topic. By the time the game is halfway over, the game topic is the only topic (maybe one or two more) listed in the Recent Topics block, even though it has its properties set to include the 30 most recent topics. I have also seen the number of topic decrease if a lot of topics have been created and then deleted (for instance, when testing a feedbot and deleting the topics it creates).
Do you have any suggestions for me as to how I might fix this issue so that there are always the correct number of topics shown in the block?
Thanks!
LP
-
I have been unable to replicate that issue with SMF 2 RC1.2 and SP 2.3.1, although I would recommend that you upgrade to SMF 2 RC2.
Could you please post a link to your website? (you can send it to me via PM if you don't want to publically post it.)
-
I would send you a PM, but I am apparently not allowed to send PMs. Maybe I will reach the limit with this post or the next.
I will at some point upgrade to SMF 2 RC2. Unfortunately it is not a simple upgrade and will cost me a good bit of time to make sure my numerous customizations are successfully transferred. I am actually considering waiting until the official release of SMF 2 to do any further upgrades.
-
Nope, 10 posts does not appear to be enough.
-
I am less concerned about the deleted topics issue than the "hot" topics issue. Please keep in mind that I am using a "Recent Posts/Topics" block using the options "Display: Topics" and "Display type: Compact".
-
Well, I sent a PM but it does not show in my "Sent Items" area, so I am not sure if it was actually sent or not. Please let me know if you did not receive a PM from me Nathaniel.
Thanks.
-
I received the PM, although as you say, the issue doesn't appear on your site at the moment.
Do you have any mods that edit the SSI.php files functions? SimplePortal uses the SSI.php functions to pull the data for the topics for that block, any edits could be causing this issue.
-
I received the PM, although as you say, the issue doesn't appear on your site at the moment.
Do you have any mods that edit the SSI.php files functions? SimplePortal uses the SSI.php functions to pull the data for the topics for that block, any edits could be causing this issue.
I am not aware of any that might edit the SSI.php file. I'll compare a SSI file from a new install to my SSI file and see if there are any differences.
-
OK, there are some additions to SSI.php, functions added at the end. I can't see any way they would affect the recent topics block. The functions are: ssi_chatOnline, ssi_customPage, and ssi_recentPages. I'll add that code at the end of this post.
Other than that, the only modifications to SSI.php are those made by SP:
require_once($sourcedir . '/Subs-Portal.php');
and // Load some SP stuff.
sportal_init();
The problem occurred again today, there was a game this afternoon and another event of interest this evening. When the game thread this afternoon reached about 100 posts or so the number of recent topics started shrinking. By the end of the game the number of topics displayed was 14, while the setting was still 32.
Here are the other additions to SSI.php:
function ssi_chatOnline($output_method = 'echo')
{
global $smcFunc, $scripturl, $txt;
$users = array();
$userIDs = chatOnlineUsers();
$users['links'] = array();
if (count($userIDs) > 0){
if (count($userIDs) == 1){
$result = $smcFunc['db_query']('', '
SELECT mem.ID_MEMBER, mem.real_name, mem.ID_GROUP, mg.online_color, mg.ID_GROUP
FROM {db_prefix}members AS mem
LEFT JOIN {db_prefix}membergroups AS mg ON
(mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.ID_MEMBER = {int:the_id}' ,
array(
'the_id' => $userIDs[0],
)
);
}else{
$result = $smcFunc['db_query']('', '
SELECT mem.ID_MEMBER, mem.real_name, mem.ID_GROUP, mg.online_color, mg.ID_GROUP
FROM {db_prefix}members AS mem
LEFT JOIN {db_prefix}membergroups AS mg ON
(mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.ID_MEMBER IN ({array_int:the_ids})',
array(
'the_ids' => $userIDs,
)
);
}
while ($row =$smcFunc['db_fetch_assoc']($result))
{
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'];
if($row['online_color'] != ""){
$link.= '" style="color: ' . $row['online_color'];
}
$link.= '">' . $row['real_name'] . '</a>';
array_push($users['links'], $link);
}
$smcFunc['db_free_result']($result);
}
if ($output_method != 'echo')
return $users;
else{
if (count($users['links']) == 0 )
echo $txt['chat_no_user'];
elseif (count($users['links']) == 1 )
echo '1' . $txt['chat_aUser']. ':<br />', implode($users['links']);
else
echo count($users['links']). $txt['chat_users']. ':<br />', implode(', ', $users['links']);
}
}
// Show a Custom Page outside of the forum.
function ssi_customPage($id, $output_method = 'echo')
{
global $sourcedir, $context, $txt;
// Require the Custom Pages file that contains the function we need.
require_once($sourcedir . '/Subs-CustomPages.php');
// Load the page.
$page = loadPage($id);
// If $page returned false then the page doesn't exist.
if($page === false)
$page = array(
'id' => 'error',
'title' => $txt['cp_error'],
'body' => $context['user']['is_admin'] ? $txt['cp_error3'] : $txt['cp_error2'],
'perms' => 'everybody',
'views' => false,
);
// If they are not aloud to view the page then make a new array with data telling them that.
elseif(!allowedToViewPage($page['perms']))
$page = array(
'id' => 'denied',
'title' => $txt['cp_denied'],
'body' => $txt['cp_denied2'],
'perms' => 'everybody',
'views' => false,
);
// Otherwise parse any bbc.
elseif($page['code'] == 'bbcode')
$page['body'] = parse_bbc($page['body'], 1, $page['id']);
// Are we printing this?
if($output_method == 'echo')
echo '
<table class="ssi_table" width="100%" border="0">
<tr><td width="100%"><b>', $page['title'], '</b>', $page['views'] === false ? '' : '<span class="smalltext" style="padding-left: 8px;">(' . sprintf($txt['cp_viewed'], $page['views']) . ')</span>', '</tr>
<tr><td>', $page['body'], '</td></tr>
</table>';
// Otherwise return the array.
else
return $page;
}
// Show recently added pages
function ssi_recentPages($limit = 5, $output_method = 'echo')
{
global $context, $txt, $smcFunc, $scripturl, $sourcedir;
// Require the Custom Pages file that contains the functions we need.
require_once($sourcedir . '/Subs-CustomPages.php');
// Grab all the pages
$request = $smcFunc['db_query']('', '
SELECT id_page, page_title, page_body, page_perms, page_views, page_format, page_time
FROM {db_prefix}pages
ORDER BY page_time DESC',
array()
);
// Now start looping through everything
$i = 0;
$ret = array();
while($page = $smcFunc['db_fetch_assoc']($request))
{
// Are we aloud to view this page?
if(allowedToViewPage($page['page_perms']))
{
// Add the page to the array
$ret[] = array(
'id' => $page['id_page'],
'title' => $page['page_title'],
'body' => $page['page_body'],
'perms' => $page['page_perms'],
'views' => $page['page_views'],
'format' => $page['page_format'],
'time_created' => $page['page_time'],
);
$i++;
}
// Limit the number we show
if($i >= $limit) break;
}
$smcFunc['db_free_result']($request);
// Echoing it?
if($output_method == 'echo')
{
echo '
<table class="ssi_table">
<tr>
<th align="left">', $txt['cp_page'], '</th>
<th align="left">', $txt['cp_views'], '</th>
</tr>';
if(count($ret))
foreach($ret as $page)
echo '
<tr>
<td><a href="', $scripturl, '?action=page;sa=', $page['id'], '">', $page['title'], '</a></td>
<td align="right">', $page['views'], '</td>
</tr>';
else
echo '
<tr><td colspan="2">', $txt['cp_no_pages'], '</td></tr>';
echo '
</table>';
}
else
return $ret;
}
-
I have been able to reproduce this on a test site. I posted 30 new topics and then set the number of recent topics to show in the "recent topics" block at 30. So topics 1-30 were all showing in the block.
I then started replying to topic #30 repeatedly. When I posted reply #146 topics began disappearing from the bottom of the list at the rate of 1 topic per post. So now after 166 replies to the same thread, the number of topics displayed is down to 10.
Nathaniel, I will pm you a link to my test forum so you can see what is happening.
-
After some testing of my own, I can confirm that this issue does occur. It would appear to be an issue with SMF code for the 'ssi_recentTopics' function. Essentially, that SMF function will only check the last 175 posts to see if they should be listed. You can override that functionality with the edit below.
WHERE t.id_last_msg >= {int:min_message_id}
WHERE 1=1
-
Thank you for the help, Nathaniel, I appreciate it very much. The change has been effective.
I wonder, though, if it will have a negative impact on forum performance to be considering all posts instead of the most recent 175. Maybe there is a way that I can adjust the number of posts to be considered instead of just opening it up to all posts? Maybe the effect will be negligible, I'm not sure.
-
Well, SMF does it for a reason, to avoid looking through large numbers of messages.
Try a higher number, like this:
WHERE t.id_last_msg >= 500
-
Well, SMF does it for a reason, to avoid looking through large numbers of messages.
Try a higher number, like this:
WHERE t.id_last_msg >= 500
That doesn't seem to work. The number used should be a message ID (id_msg from "messages" table), so this essentially limits the messages to those that have an id_msg > 500 (~500,000 messages on my site). On my test site, this results in no messages being displayed at all as there are less than 500 messages total.
I changed mine to this and it seems to work:
WHERE t.id_last_msg >= ({int:min_message_id} - 500)
Thanks for your help!
:applause:
-
Oh, whoops. Glad that you got it working. :)
-
Helpful tip