Forum Statistics - Last Post - subdivision - smf 2.0.17

Started by pobo424, January 28, 2021, 06:25:20 AM

Previous topic - Next topic

pobo424

Hello everyone at the beginning wanted to say hi, just getting started with smf forum, hope to learn a lot. I from Poland.

The structure of departments to make them look nice I installed the "Tidy Child Boards"


0-1 Main Department
    1-1- subdivision
    1-1-1 - subdivision
    1-1-2 - subdivision
     e.t.c
0-2 Main Department
    2-1- subdivision
    2-1-1 - subdivision
    2-1-1-1 - subdivision
    2-1-2 - subdivision
      e.t.c

on the main page, after writing a message in the division, etc., there were no messages on the same line as the main section, I installed the "Count Child Child Boards Posts" plugin, I set its value to 5, but not all of them are displayed

At the very bottom of the forum are


FORUM STATS
44 posts in 27 threads by 6 users.
Newest user: xxx
Last posted: "W Miejskiej ...." (Yesterday at 18:52:03)
LATEST POSTS ON THE FORUM FOR MORE STATISTICS

but here the last thread / reply written in the whole forum does not appear, only the last thread / reply written in the main section does not take into account the sub-sections, how to change it? , in the file BOARDINDEX.TEMPLATE.PHP I localized the fragment

The topics from the sections are also not displayed on the main page

  $stats_index_cond2 = (!empty($context['latest_post']) ? '<i class="fas fa-clock"></i>    <span>'.$txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong>  ( ' . $context['latest_post']['time'] . ' )<br /></span>' : '');

maybe someone will help,
list of add-ons I have on the forum


shadav

which version of smf are you using?

what theme are you using, does this do this in the default theme?

please post in the theme's support thread so that they can fix the issue


pobo424

I have a question if I click "Latest forum posts" on the main page in the statistics (Recent.template.php) is redirected to a new page where all posts appear, even those from the subdivisions there is a "posts" object.

I was able to view the last post reset ($ context ['posts']) ['link'], returning to the home page (BoardIndex.template) I have no reference to $ context ['posts']

how to modify this line and how to pass the posts object to BoardIndex.template

$stats_index_cond2 = (!empty($context['latest_post']) ? '<i class="fas fa-clock"></i>    <span>'.$txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong>  ( ' . $context['latest_post']['time'] . ' )<br /></span>' : '');


Thanks for the help
best regards

Kindred

I'm sorry, but you are talking around things, mixing code terms with english in odd combinations that don't actually make sense.

Without using code... please explain what you are trying to do in plain english...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

pobo424

At the end of the main page there are statistics in them the last post, the last post is not displayed there, I do not take into account the sub-sections and sub-sub-sections.
Similarly, on the side of the sections on the right, the correct recent posts from are not displayed sub-sections and sub-sub-sections,I can see posts from the first sub-section

I'd like to know where to change my queries

Kindred

OK. thank you for the explanation.

You are completely correct regarding the posts in the board list for child boards.
This is intentional in the code, because the "recent posts" is one of the most server intensive queries in the system ad querying ALL subboards (aka child boards) for recent information on the main page of the forum could, potentially slow down the system (depending on how active your forum is).

You can add the count for the FIRST LEVEL of child board
/index.php?action=admin;area=manageboards;sa=settings
Count child's posts in parent's totals

if you absolutely MUST have the totals counted all the way down, then
https://custom.simplemachines.org/mods/index.php?mod=4210


Recent posts on the main index should show all recent posts....
However, it does not show recent posts for boards & childboards in categories which are collapsed or for boards which have been set to "ignore".

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

shadav

for the last post on the boards list you will need to install a mod
https://custom.simplemachines.org/mods/index.php?mod=4210

by default smf does not count the posts of subboards (child boards) within boards

as for the latest post in the Info center (the bit at the bottom of the index)

again I ask.. does this do this in the default theme?
If no then please post in the theme's support thread so that they can fix the issue
If yes then something you installed messed up something somewhere and you should try uninstalling some mods and see which one it was
a list of mods on your site may help us to narrow it down for you (maybe)

[edit kindred beat me to it, lol was searching the themes support thread to see if this had been asked before, couldn't find it, so assuming this is a mod related issue]

pobo424

Quote from: pobo424 on February 03, 2021, 12:19:39 PM
version - 2.0.17
themes - https://custom.simplemachines.org/themes/index.php?lemma=2921

???
I write.
It is possible to modify the website so that everything displays well, without compromising on performance

Kindred

for everything there is a cost.

if you design your system so that it has layers and layers of boards, there will be a cost to retrieve the data from those deeper layers.

-- for every "recent post" listed, the system must check
   -- a- does the user belong to a group which can see this board
   -- b- has the user already read this message
   -- c- has the user collapsed the category that the board (or the parent board, or the parent of the parent board) is part of?
   -- d- has the user marked this board as "ignore"
   -- e- has the user marked this thread as "ignore"
   -- f- has the user marked the author of that post as "ignore"

Those are a lot of queries that require Searches and JOINs on multiple LARGE tables - then the system has to parse the data further for output.

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

pobo424

Quote from: Kindred on February 09, 2021, 02:14:45 PM
for everything there is a cost.

if you design your system so that it has layers and layers of boards, there will be a cost to retrieve the data from those deeper layers.

-- for every "recent post" listed, the system must check
   -- a- does the user belong to a group which can see this board
   -- b- has the user already read this message
   -- c- has the user collapsed the category that the board (or the parent board, or the parent of the parent board) is part of?
   -- d- has the user marked this board as "ignore"
   -- e- has the user marked this thread as "ignore"
   -- f- has the user marked the author of that post as "ignore"

Those are a lot of queries that require Searches and JOINs on multiple LARGE tables - then the system has to parse the data further for output.


what the cost of changes ?
I will only start from the forum but the people who tested it wrote that it must be and I agree with them, it's strange that you can't see the posts, etc.

Matthias

A lot of queries come together very quickly. There are also queries for group membership, permissions etc..
Quote from: Kindred on February 09, 2021, 02:14:45 PM
   -- e- has the user marked this thread as "ignore"

As far as I know, this is not a standard smf function or am I wrong...
Quality first

pobo424

this is not the case, but this is how the forum should work, so I ask how to make such a modification, what to change, I don't know php, I know c #

Matthias

Quality first

pobo424

how to change the query so that all messages are displayed:

$result_boards = $smcFunc['db_query']('boardindex_fetch_boards', '
      SELECT' . ($boardIndexOptions['include_categories'] ? '
         c.id [nofollow]_cat, c.name [nofollow] AS cat_name, cat_order,' : '') . '
         b.img_new, b.img_new_type, b.img_old, b.img_old_type, b.img_redirect, b.img_redirect_type,
         b.id [nofollow]_board, b.name [nofollow] AS board_name, b.description,
         CASE WHEN b.redirect != {string:blank_string} THEN 1 ELSE 0 END AS is_redirect,
         b.num_posts, b.num_topics, b.unapproved_posts, b.unapproved_topics, b.id [nofollow]_parent,
         IFNULL(m.poster_time, 0) AS poster_time, IFNULL(mem.member_name, m.poster_name) AS poster_name,
         m.subject, m.id [nofollow]_topic, IFNULL(mem.real_name, m.poster_name) AS real_name,
         ' . ($user_info['is_guest'] ? ' 1 AS is_read, 0 AS new_from,' : '
         (IFNULL(lb.id_msg, 0) >= b.id [nofollow]_msg_updated) AS is_read, IFNULL(lb.id_msg, -1) + 1 AS new_from,' . ($boardIndexOptions['include_categories'] ? '
         c.can_collapse, IFNULL(cc.id_member, 0) AS is_collapsed,' : '')) . '
         IFNULL(mem.id_member, 0) AS id_member, m.id [nofollow]_msg,
         IFNULL(mods_mem.id_member, 0) AS id_moderator, mods_mem.real_name AS mod_real_name
      FROM {db_prefix}boards AS b' . ($boardIndexOptions['include_categories'] ? '
         LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id [nofollow]_cat)' : '') . '
         LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = b.id [nofollow]_last_msg)
         LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id [nofollow]_member)' . ($user_info['is_guest'] ? '' : '
         LEFT JOIN {db_prefix}log_boards AS lb ON (lb.id_board = b.id [nofollow]_board AND lb.id [nofollow]_member = {int:current_member})' . ($boardIndexOptions['include_categories'] ? '
         LEFT JOIN {db_prefix}collapsed_categories AS cc ON (cc.id_cat = c.id [nofollow]_cat AND cc.id [nofollow]_member = {int:current_member})' : '')) . '
         LEFT JOIN {db_prefix}moderators AS mods ON (mods.id_board = b.id [nofollow]_board)
         LEFT JOIN {db_prefix}members AS mods_mem ON (mods_mem.id_member = mods.id [nofollow]_member)
      WHERE {query_see_board}' . (empty($boardIndexOptions['countChildPosts']) ? (empty($boardIndexOptions['base_level']) ? '' : '
         AND b.child_level >= {int:child_level}') : '
         AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + $modSettings['boardindex_max_depth'])),
      array(
         'current_member' => $user_info['id'],
         'child_level' => $boardIndexOptions['base_level'],
         'blank_string' => '',
      )

shadav

did you install the mod that both kindred and I suggested?

This will show the latest posts of child (sub boards)

as for the info center....
I just downloaded the theme that you said you use and the code that you originally posted is not found in that theme's BoardIndex.template.php so I don't know where that code came from
unless you are using an older version of the theme or you added some modification

What modifications have you installed?

pobo424

I install mods, picture in attachments, last mod I install https://custom.simplemachines.org/mods/index.php?mod=3009, but when I turn it on and go to the home page, I get http 500 error


shadav

there was no picture attached...
removed the mod from your post
please do not upload mods without the mod creators consent...

sorry can't say anything about that mod I haven't used it....
I know the one that kindred and I both linked to works

since it is giving you a 500 error, I'd suggest uninstalling it and trying the other one

back to the issue of your info centers latest posts not showing

what all mods have you installed because the code that you originally posted
$stats_index_cond2 = (!empty($context['latest_post']) ? '<i class="fas fa-clock"></i>    <span>'.$txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong>  ( ' . $context['latest_post']['time'] . ' )<br /></span>' : '');

this is not found in the sunrise theme so either you are using an older version of the theme or you installed a mod that added this in

pobo424

/www/xxx/Themes/SunRise20 file BoardIndex.template.php line 403

Advertisement: