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

Recent

Welcome to TinyPortal. Please login or sign up.

October 06, 2024, 08:55:01 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,395
  • Total Topics: 21,244
  • Online today: 162
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 61
  • Total: 62
  • @rjen

Recent Topics Blocks

Started by Kokoro, February 10, 2023, 12:03:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Kokoro


Link to my forum: https://www.animerpgs.com/
SMF version: 2.1.3
TP version: 2.2.2
Default Forum Language: English
Theme name and version: Windows XP
Browser Name and Version: FireFox 109.0.1 (64-bit
Mods installed: Activity Bar (2.0.1), Avatars Display Integration (1.5.4), Board Sorting Method (1.0.1), Dice Roller BBcode (2.0), Discord Web Hooks (2.0.1), Discord Who's Online (1.0.1), Forum Width Setting (1.2), Login Menu Button (2.0), Members Online Today (1.0), Mod Version Checker (1.1), More Spiders (1.3.1), Post as Another Member (1.6), Recent Forum Topics Boardindex (1.2), SMF Post Prefix (4.1.0), SMFPacks Social Login (2.3.2), Similar Topics (1.2.2), Yet Another Spoiler Mod (1.2)
Related Error messages: N/A

Question with functionality.  I was under the impression that the Recent Topics block displayed all the recent topics IN THAT BOARD (if included) for the number of posts to include (say 5, it would list the most five recent topics in a specified board (say 75.0)

I've noticed that this is not the case though.  Would it be possible to make this functionality?

Thank you.

@rjen

Well it does do that, but the recent topics functionality in SMF has a limit to the total number of topics it reads. The can result in the function showing less topics is you specify a less popular board and there are a lot of newer posts in other boards.

We included in fix for this in the latest TinyPortal version 2.3.0

Suggest you upgrade to that version...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Kokoro

Thank you!  I didn't even notice that there was an updated version!  You guys are awesome!

@rjen

No probs. Just to be sure (I briefly checked your site), make sure that the authorisations are correct: I you choose a board that is not accessible to guests, guests will also not see any recent topics in the block...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

I just looked up te change, and since this is a bit difficult to grasp I created attached overview.

The 'challenge' is that we use the standard SMF recentposts function
This is in SSI.php of your forum


// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $smcFunc['db_query']('substring', '
SELECT
t.id_topic, b.id_board, b.name AS board_name
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
LEFT JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE t.id_last_msg >= {int:min_message_id}' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '' . (empty($include_boards) ? '' : '
AND b.id_board IN ({array_int:include_boards})') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND ml.approved = {int:is_approved}' : '') . '
ORDER BY t.id_last_msg DESC
LIMIT ' . $num_recent,
array(
'include_boards' => empty($include_boards) ? '' : $include_boards,
'exclude_boards' => empty($exclude_boards) ? '' : $exclude_boards,
'min_message_id' => $modSettings['maxMsgID'] - (!empty($context['min_message_topics']) ? $context['min_message_topics'] : 35) * min($num_recent, 5),
'is_approved' => 1,
)
);


Now this function does some 'clever' things to reduce systemload.

1. It will NOT read all messages in the database
2. It uses the number of recent topics you want to see to determine How many of messages it reads.
As a result: the larger the number of topics you specify in the block, the larger the selection from the messages table will be.

Now SMF by default looks for an X number of messages times the number of topics you wish to show. This X number determines how far 'back'  the selection goes.

This results in the query only accessing a small section of your messages and not all...

Check attached image to indicate the % of the message table that is being searched, depening on the size of your forum (Column: 'total posts'), the number of recent topics you define in your block (column: RecentNum).

The column: 'messages read' shows how many messages are considered, the column 'percentage' indicates the percentage of all messages that is considered.

What does this mean:
if you choose a single board that has not been posted in for a long time, the messages in that board may not be selected and the block will show NO recent topics for that board.
Running Latest TP on SMF2.1 at: www.fjr-club.nl