- Posts: 1247
- Thank you received: 187
Kunena 7.0.8 Released
The Kunena team has announce the arrival of Kunena 7.0.8 [K 7.0.8] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x./6.1.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0
Question Module mod_kunenastats_v6.2.1_2026-04-25.zip returns an error when activated.
2 weeks 6 days ago - 2 weeks 6 days ago #235183
by Leen
With kind regards
Leen
HHello ,
Module mod_kunenastats_v6.2.1_2026-04-25.zip gives an error when activated.
If the problems persist, please contact the website administrator and report the error below.
0 Call to a member function bootComponent() on null
So the question is why ?
With the help of ChatGpt I found this solution
modify in : mod_kunenastats\src\ModuleKunenaStats.php
Add at the top:
and replace this:
by:
then the module will probably work,
but the message will appear again
Deprecated: Creation of dynamic property Kunena\Module\KunenaStats\Site\ModuleKunenaStats::$stats_link is deprecated in C:
I am still working on this, so I will post the solution a bit later
Module mod_kunenastats_v6.2.1_2026-04-25.zip gives an error when activated.
If the problems persist, please contact the website administrator and report the error below.
0 Call to a member function bootComponent() on null
So the question is why ?
With the help of ChatGpt I found this solution
modify in : mod_kunenastats\src\ModuleKunenaStats.php
Add at the top:
Code:
use Joomla\CMS\Factory;
and replace this:
Code:
// Boot Kunena component for use of Kunena registered function in non com_kunena page if (!$this->application->bootComponent('com_kunena')) { return; }
by:
Code:
// Boot Kunena component for use of Kunena registered functions $app = Factory::getApplication(); if (!$app->bootComponent('com_kunena')) { return; }
but the message will appear again
Deprecated: Creation of dynamic property Kunena\Module\KunenaStats\Site\ModuleKunenaStats::$stats_link is deprecated in C:
I am still working on this, so I will post the solution a bit later
With kind regards
Leen
Last edit: 2 weeks 6 days ago by Leen.
The following user(s) said Thank You: xillibit
Please Log in or Create an account to join the conversation.
2 weeks 6 days ago #235184
by Leen
With kind regards
Leen
Replied by Leen on topic Module mod_kunenastats_v6.2.1_2026-04-25.zip returns an error when activated.
This is ChatGPT's solution
Clean up the entire ModuleKunenaStats.php file for PHP 8.5, Joomla 6, and Kunena 7
Yes. Based on the file you provided, I would clean it up like this. I keep the existing Kunena functionality intact as much as possible, but address the points that could cause problems with PHP 8.5, Joomla 6, and the current object/property handling.
Key changes:
Factory::getApplication() instead of $this->application.
All properties used are explicitly declared → no dynamic-property warnings.
PHP 8.5-compatible type declarations where safe to do so.
preg_replace() is checked for null.
The existing Kunena API calls are retained.
No use of #[AllowDynamicProperties]; that would only hide the problem.
The operation of the module remains the same. Replace the entire content of modules/mod_kunenastats/src/ModuleKunenaStats.php
with
Then the mod works fine
Clean up the entire ModuleKunenaStats.php file for PHP 8.5, Joomla 6, and Kunena 7
Yes. Based on the file you provided, I would clean it up like this. I keep the existing Kunena functionality intact as much as possible, but address the points that could cause problems with PHP 8.5, Joomla 6, and the current object/property handling.
Key changes:
Factory::getApplication() instead of $this->application.
All properties used are explicitly declared → no dynamic-property warnings.
PHP 8.5-compatible type declarations where safe to do so.
preg_replace() is checked for null.
The existing Kunena API calls are retained.
No use of #[AllowDynamicProperties]; that would only hide the problem.
The operation of the module remains the same. Replace the entire content of modules/mod_kunenastats/src/ModuleKunenaStats.php
with
Code:
<?php
/**
* Kunena Statistics Module
*
* @package Kunena.mod_kunenastats
*
* @Copyright (C) 2008 - 2025 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
*/
namespace Kunena\Module\KunenaStats\Site;
defined('_JEXEC') or die();
use Joomla\CMS\Factory;
use Joomla\CMS\Helper\ModuleHelper;
use Joomla\CMS\Language\Text;
use Kunena\Forum\Libraries\Factory\KunenaFactory;
use Kunena\Forum\Libraries\Forum\KunenaStatistics;
use Kunena\Forum\Libraries\Module\KunenaModule;
use Kunena\Forum\Libraries\Route\KunenaRoute;
/**
* Class ModuleKunenaStats
*/
class ModuleKunenaStats extends KunenaModule
{
/**
* CSS file used by the module.
*
* @var string
*/
protected static $css = '/modules/mod_kunenastats/tmpl/css/kunenastats.css';
/**
* Kunena API object.
*
* @var mixed
*/
protected $api = null;
/**
* Statistics type.
*
* @var string|null
*/
protected $type = null;
/**
* Number of items to display.
*
* @var int
*/
protected $items = 0;
/**
* Statistics result.
*
* @var mixed
*/
protected $stats = null;
/**
* Statistics link.
*
* @var string
*/
protected $stats_link = '';
/**
* Latest member link.
*
* @var string
*/
protected $latestMemberLink = '';
/**
* User list link.
*
* @var string
*/
protected $userlist = '';
/**
* Table title header.
*
* @var string
*/
protected $titleHeader = '';
/**
* Table value header.
*
* @var string
*/
protected $valueHeader = '';
/**
* Number of items shown at the top.
*
* @var int
*/
protected $top = 0;
/**
* Display the module.
*
* @return void
*/
protected function _display(): void
{
$this->type = (string) $this->params->get('type', 'general');
$this->items = (int) $this->params->get('items', 5);
$this->stats_link = $this->_getStatsLink(
Text::_('MOD_KUNENASTATS_LINK'),
Text::_('MOD_KUNENASTATS_LINK')
);
/*
* Boot Kunena component.
*
* Do not use $this->application here. In Joomla 6 this property
* is not guaranteed to be available from KunenaModule.
*/
$app = Factory::getApplication();
if (!$app->bootComponent('com_kunena')) {
return;
}
$this->stats = $this->getStats();
require ModuleHelper::getLayoutPath('mod_kunenastats');
}
/**
* Get the requested statistics.
*
* @return mixed
*/
protected function getStats()
{
$stats = KunenaStatistics::getInstance();
switch ($this->type)
{
case 'topics':
$this->titleHeader = Text::_('MOD_KUNENASTATS_TOPTOPICS');
$this->valueHeader = Text::_('MOD_KUNENASTATS_HITS');
$items = $stats->loadTopTopics($this->items);
break;
case 'posters':
$this->titleHeader = Text::_('MOD_KUNENASTATS_TOPPOSTERS');
$this->valueHeader = Text::_('MOD_KUNENASTATS_POSTS');
$items = $stats->loadTopPosters($this->items);
break;
case 'profiles':
$this->titleHeader = Text::_('MOD_KUNENASTATS_TOPPROFILES');
$this->valueHeader = Text::_('MOD_KUNENASTATS_HITS');
$items = $stats->loadTopProfiles($this->items);
break;
case 'polls':
$this->titleHeader = Text::_('MOD_KUNENASTATS_TOPPOLLS');
$this->valueHeader = Text::_('MOD_KUNENASTATS_VOTES');
$items = $stats->loadTopPolls($this->items);
break;
case 'thanks':
$this->titleHeader = Text::_('MOD_KUNENASTATS_TOPTHANKS');
$this->valueHeader = Text::_('MOD_KUNENASTATS_THANKS');
$items = $stats->loadTopThankyous($this->items);
break;
case 'general':
default:
$this->type = 'general';
$stats->loadGeneral(true);
/*
* Get the latest member profile.
*/
$user = KunenaFactory::getUser((int) $stats->lastUserId);
if ($user) {
$this->latestMemberLink = $user->getLink();
} else {
$this->latestMemberLink = '';
}
$this->userlist = $this->_getUserListLink(
'',
$this->formatLargeNumber($stats->memberCount, 4)
);
$items = $stats;
break;
}
return $items;
}
/**
* Shorten the visible text of a link.
*
* @param string $link Link HTML.
* @param int $len Maximum text length.
*
* @return string
*/
public function shortenLink(string $link, int $len): string
{
$result = preg_replace(
'/>;([^<]{' . $len . '})[^<]*</u',
'>\1...<',
$link
);
return $result ?? $link;
}
/**
* Format a large number.
*
* Numbers below 10,000 are displayed unchanged.
* Numbers above 10,000 are rounded to the requested
* number of significant digits.
*
* @param int|float $number Number to format.
* @param int $precision Significant digits for output.
*
* @return int|float|string
*/
public function formatLargeNumber($number, int $precision = 3)
{
$output = '';
/*
* Prevent invalid calculations when an invalid precision
* is supplied.
*/
if ($precision < 1) {
$precision = 1;
}
/*
* Do we need to reduce the number of significant digits?
*/
if ($number >= 10000)
{
$number = round(
$number,
-1 * (int) (log10($number) + 1) + $precision
);
}
if ($number < 10000)
{
$output = $number;
}
elseif ($number >= 1000000)
{
$output = ($number / 1000000) . Text::_('COM_KUNENA_MILLION');
}
else
{
$output = ($number / 1000) . Text::_('COM_KUNENA_THOUSAND');
}
return $output;
}
/**
* Create a link to the Kunena user list.
*
* @param string $action User-list action.
* @param string $name Link text.
* @param string|null $title Link title.
* @param string $rel Link rel attribute.
*
* @return string
*/
protected function _getUserListLink(
string $action,
string $name,
?string $title = null,
string $rel = 'nofollow'
): string
{
$profile = KunenaFactory::getProfile();
$link = $profile->getUserListURL($action, true);
return sprintf(
'<a href="%s" title="%s" rel="%s">%s</a>',
$link,
$title ?? '',
$rel,
$name
);
}
/**
* Create a link to the Kunena statistics page.
*
* @param string $name Link text.
* @param string|null $title Link title.
* @param string $rel Link rel attribute.
*
* @return string
*/
protected function _getStatsLink(
string $name,
?string $title = null,
string $rel = 'follow'
): string
{
$link = KunenaRoute::_('index.php?option=com_kunena&view=stats');
return sprintf(
'<a href="%s" title="%s" rel="%s">%s</a>',
$link,
$title ?? '',
$rel,
$name
);
}
}
Then the mod works fine
With kind regards
Leen
Please Log in or Create an account to join the conversation.
2 weeks 6 days ago #235185
by xillibit
I don't provide support by PM, because this can be useful for someone else.
Replied by xillibit on topic Module mod_kunenastats_v6.2.1_2026-04-25.zip returns an error when activated.
Hello,
Thanks for the report i have fixed it, lightly differently
Thanks for the report i have fixed it, lightly differently
I don't provide support by PM, because this can be useful for someone else.
Please Log in or Create an account to join the conversation.
Time to create page: 0.234 seconds