News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Info Center Manager

Started by PeakFox, October 25, 2022, 12:55:23 AM

Previous topic - Next topic

PeakFox

Link to the mod

Info Center Manager

This modification allows you to configure the following aspects of the "Info Center" display:
  • The "Users Online" section can now be hidden, while still showing the "Recent Posts" section
  • In the "Recent Posts" section, the display can now be restricted to the latest post per topic only. This prevents posts in very active topics from "flooding" the "Recent Posts" section and permits recent posts from other topics to be shown as well.

The mod has its own configuration page in the mod settings section of the admin panel.

Current localizations:
  • English
  • German
  • Spanish (thanks to -Rock Lee-)

Version history:
  • 2022-10-24: 1.0b3 (translation to Spanish)
  • 2022-10-24: 1.0b2 (for SMF 2.1.2)

Released under GPL-3.0-or-later.

-Rock Lee-

It took me some time but I was able to translate it completely :P I'll leave it attached.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

PeakFox

Quote from: -Rock Lee- on November 04, 2022, 09:39:56 PMIt took me some time but I was able to translate it completely :P I'll leave it attached.
Muchas gracias!  :)

Update 1.0b3 with Spanish translation now available.

Rick53

Will there be an option in one of the next versions to also hide the forum statistics?
I couldn't find any modification that does this.

PeakFox

Quote from: Rick53 on February 28, 2023, 11:01:31 AMWill there be an option in one of the next versions to also hide the forum statistics?
I couldn't find any modification that does this.
Thanks for the suggestion. I'll see what I can do.

Rick53

Quote from: PeakFox on March 01, 2023, 02:08:49 PM
Quote from: Rick53 on February 28, 2023, 11:01:31 AMWill there be an option in one of the next versions to also hide the forum statistics?
I couldn't find any modification that does this.
Thanks for the suggestion. I'll see what I can do.

Another suggestion:
Also hide the calendar in action center.

I don't want to deactivate the calendar completely, because I use TinyPortal to display appointments. It should only no longer be visible in the InfoCenter.

ThomasWi

I checked "Info Center Manager" in a fresh SMF docker setup.
In SMF 2.1.4 it does not work because the Settings are not available in "Modification Settings".
And in SMF 2.1.2 (last official supported version) my browser only shows an error message as soon as I tick "Show only latest reply per topic in "Recent Posts" section":
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/html/Sources/Class-InfoCenterMgr.php:107 Stack trace: #0 /var/www/html/Sources/Class-InfoCenterMgr.php(107): count(NULL) #1 /var/www/html/Sources/Subs.php(5759): PeakFox\InfoCenterMgr::markReadHook() #2 /var/www/html/Sources/BoardIndex.php(137): call_integration_hook('integrate_mark_...') #3 /var/www/html/index.php(191): BoardIndex() #4 {main} thrown in /var/www/html/Sources/Class-InfoCenterMgr.php on line 107

Hope that helps.

Diego Andrés

Installed on PHP 8.0+ and PHP 8.1+, it works fine.

Quote from: ThomasWi on February 06, 2024, 04:37:21 PMFatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/html/Sources/Class-InfoCenterMgr.php:107 Stack trace: #0 /var/www/html/Sources/Class-InfoCenterMgr.php(107): count(NULL) #1 /var/www/html/Sources/Subs.php(5759): PeakFox\InfoCenterMgr::markReadHook() #2 /var/www/html/Sources/BoardIndex.php(137): call_integration_hook('integrate_mark_...') #3 /var/www/html/index.php(191): BoardIndex() #4 {main} thrown in /var/www/html/Sources/Class-InfoCenterMgr.php on line 107

This is caused by the MOD not checking if the recent posts setting is set.
To fix, do the following in Sources/Class-InfoCenterMgr.php

Code (Search) Select
if (empty($modSettings['icm_limit_recent_posts']))
return;

Code (Replace) Select
if (empty($modSettings['icm_limit_recent_posts']) || empty($context['latest_posts']))
return;

SMF Tricks - Free & Premium Responsive Themes for SMF.

jasland



In the "Recent Posts" section, the display can now be restricted to the latest post per topic only. This prevents posts in very active topics from "flooding" the "Recent Posts" section and permits recent posts from other topics to be shown as well.

The problem with this is that it slows down the forum every time you click on the forum tab, would anyone know how to solve it?

greetings

ninjamida

QuoteThe problem with this is that it slows down the forum every time you click on the forum tab, would anyone know how to solve it?

Yes, I ran into this issue on Lemmings Forums after upgrading to SMF 2.1.4 and installing this addon. The solution is to make some changes to the query Class-InfoCenterMgr.php. You could either do this in the modification ZIP before you install it (probably cleaner this way), or do it directly in the file structure of your forum.

Any issues with or questions about my input here, please send a PM, as chances are I won't be monitoring this topic. (Fully get the value of having those discussions publicly, but I more mean - post your response here, then send me a PM so I know to take a look.)



Line 111:
    $query_limit = $number_recent_posts * 100;
You can try adjusting this value. Lower values (eg. * 10 instead of * 100) will perform better, but too low might end up with situations where the Recent Posts list doesn't display as many entries as it should (especially if your forum tends to have lots of replies in a small number of topics). Conversely, higher values will help avoid that issue at the cost of worse performance.



Line 125 - change from:
      WHERE m.id_msg >= 0' .to:
      WHERE m.id_msg >= {int:likely_max_msg}' .
AND

Line 135-136 - inbetween these two lines:
      array(
        'recycle_board' => $modSettings['recycle_board'],
add this line:
        'likely_max_msg' => max(0, $modSettings['maxMsgID'] - $query_limit),
These two lines limit how many messages in the database, will even be considered by the Recent Posts code. SMF's default code for the Recent Posts function does this, but for some reason, this mod's code does not. Essentially, by adding this back in, we get a huge improvement in performance.

Advertisement: