TinyPortal

Development => Support => Topic started by: Kokoro on July 10, 2022, 02:54:25 PM

Title: Recent Topics not showing
Post by: Kokoro on July 10, 2022, 02:54:25 PM
Link to my forum: https://www.AnimeRPGs dot com/
SMF version: 2.1.2
TP version: 2.2.2
Default Forum Language: English
Theme name and version: Default (with Curve Color Changer v. 1.3 MOD)
Browser Name and Version: Firefox 102.0.1 (64-bit)
Mods installed: Activity Bar (2.0.1), Avatars Display Integration (1.5.3), Curve2 Color Changer (1.3), Dice Roller BBcode (2.0), Login Menu Button (2.0), Members Online Today (1.0), More Spiders (1.3.1), Post as Another Member (1.6), SMF 2.1.2 Update (1.0), SMF Gallery Lite (7.1), SMFPacks Social Login (2.3.2), Similar Topics (1.2.2), Yet Another Spoiler Mod (1.2)
Related Error messages: N/A

Problem:  I am using the Recent Topics block to display the latest topic in a specified board.  However, nothing appears on in the block.  Attached are my settings.  Thank you!
Title: Re: Recent Topics not showing
Post by: Kokoro on July 10, 2022, 03:02:59 PM
Okay, I think I found a bug.  While doing some testing, I started from displaying 5 replies.  Then 4, then 3.  All works fine.  But when I selected 2 posts, only one showed, and then when I selected 1 post, zero showed.
Title: Re: Recent Topics not showing
Post by: @rjen on July 10, 2022, 03:07:35 PM
Will need to check that: the block uses standard ssi_recenttopics to pull the data. It may be related to that SMF functionality..,
Title: Re: Recent Topics not showing
Post by: Kokoro on July 10, 2022, 03:52:49 PM
There does seem to be a bug with the Recent posts on the SMF side as well.  The layout changes when I crank the number of posts to one.  The post author and date disappears.

(But it looks like that's by design)
Title: Re: Recent Topics not showing
Post by: @rjen on July 11, 2022, 02:24:48 AM
Yeah, I think I know the reason.

The standard SMF function: ssi_recentTopics has 'limited' for performance reasons.
This means it will ony select a certain block of recent posts from the tables, and then it starts filtering by board.
This means that if you specify a board which is not very active or a small number of recent topics the selection may not find any relevant topics in the 'read'

This code in is SSI.php

Code: [Select]
'min_message_id' => $modSettings['maxMsgID'] - (!empty($context['min_message_topics']) ? $context['min_message_topics'] : 35) * min($num_recent, 5),

what is means is that the query selects the newest messages using 35 x 1 = 35 messages.
If you selected board does not have any posts in the last 35 messages the query reports no results...

You can fix this by changing the query ccode in SSI.php
This code will always read the 350 latest messages. If you still have issues you can increase the number 100 to a larger value. Mind you this query will also run on the board index, don't go too wild......

Code: [Select]
'min_message_id' => $modSettings['maxMsgID'] - (!empty($context['min_message_topics']) ? $context['min_message_topics'] : 35) * 100,

Addition: I see that in SMF2.1 this variable is introduced: $context['min_message_topics']. I cannot see if this is being set anywhere though
Title: Re: Recent Topics not showing
Post by: @rjen on July 11, 2022, 03:15:22 AM
There does seem to be a bug with the Recent posts on the SMF side as well.  The layout changes when I crank the number of posts to one.  The post author and date disappears.

(But it looks like that's by design)

I think you are right: pretty sure the SMF team will not accept that as a bug...
Title: Re: Recent Topics not showing
Post by: @rjen on July 11, 2022, 04:31:36 AM
Actually the new parameter now allows us to fix this from TP code.

Place attached file in your /Themes/default folder and it should fix it for you
Title: Re: Recent Topics not showing
Post by: Kokoro on July 11, 2022, 04:56:11 AM
Thank you!  That fixed the problem!  :)
Title: Re: Recent Topics not showing
Post by: @rjen on July 11, 2022, 05:00:47 AM
Thank you!  That fixed the problem!  :)

Did you use the new TP file?
Title: Re: Recent Topics not showing
Post by: Kokoro on July 11, 2022, 05:09:10 AM
Yes.  Just uploaded it and refreshed my page.  Works beautifully!
Title: Re: Recent Topics not showing
Post by: @rjen on July 11, 2022, 05:36:16 AM
Yes.  Just uploaded it and refreshed my page.  Works beautifully!

cool, will include this fix in TP2.2.3 then