Advertisement:

Author Topic: Forum Statistics - Last Post - subdivision - smf 2.0.17  (Read 907 times)

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Forum Statistics - Last Post - subdivision - smf 2.0.17
« on: January 28, 2021, 06:25:20 AM »
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

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #1 on: February 03, 2021, 06:11:48 AM »
maybe someone will help ??

Offline shadav

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,265
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #2 on: February 03, 2021, 10:35:19 AM »
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

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #4 on: February 09, 2021, 01:48:10 AM »
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

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 60,203
  • Gender: Male
    • Kindred-999 on GitHub
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #5 on: February 09, 2021, 09:04:06 AM »
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...
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."

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #6 on: February 09, 2021, 09:28:52 AM »
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

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 60,203
  • Gender: Male
    • Kindred-999 on GitHub
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #7 on: February 09, 2021, 09:55:33 AM »
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".

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."

Offline shadav

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,265
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #8 on: February 09, 2021, 09:59:36 AM »
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]

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #9 on: February 09, 2021, 02:02:50 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

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 60,203
  • Gender: Male
    • Kindred-999 on GitHub
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #10 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.

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."

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #11 on: February 09, 2021, 03:03:05 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.

Offline Matthias

  • Jr. Member
  • **
  • Posts: 163
  • Gender: Male
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #12 on: February 09, 2021, 03:08:31 PM »
A lot of queries come together very quickly. There are also queries for group membership, permissions etc..
   -- 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

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #13 on: February 09, 2021, 03:10:48 PM »
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 #

Offline Matthias

  • Jr. Member
  • **
  • Posts: 163
  • Gender: Male
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #14 on: February 09, 2021, 03:19:00 PM »
Quality first

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #15 on: February 12, 2021, 01:18:27 AM »
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_cat, c.name 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_board, b.name 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_parent,
         IFNULL(m.poster_time, 0) AS poster_time, IFNULL(mem.member_name, m.poster_name) AS poster_name,
         m.subject, m.id_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_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_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_cat)' : '') . '
         LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = b.id_last_msg)
         LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . ($user_info['is_guest'] ? '' : '
         LEFT JOIN {db_prefix}log_boards AS lb ON (lb.id_board = b.id_board AND lb.id_member = {int:current_member})' . ($boardIndexOptions['include_categories'] ? '
         LEFT JOIN {db_prefix}collapsed_categories AS cc ON (cc.id_cat = c.id_cat AND cc.id_member = {int:current_member})' : '')) . '
         LEFT JOIN {db_prefix}moderators AS mods ON (mods.id_board = b.id_board)
         LEFT JOIN {db_prefix}members AS mods_mem ON (mods_mem.id_member = mods.id_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' => '',
      )

Offline shadav

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,265
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #16 on: February 12, 2021, 09:11:51 AM »
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?

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #17 on: February 14, 2021, 11:01:47 AM »
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

« Last Edit: February 14, 2021, 11:03:31 AM by shadav »

Offline shadav

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,265
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #18 on: February 14, 2021, 11:11:15 AM »
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
Code: [Select]
$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

Offline pobo424

  • Semi-Newbie
  • *
  • Posts: 13
Re: Forum Statistics - Last Post - subdivision - smf 2.0.17
« Reply #19 on: February 15, 2021, 07:13:57 AM »
/www/xxx/Themes/SunRise20 file BoardIndex.template.php line 403