The Post Text Limit parameter in mod_kunenalatest has no effect at any useful value. Text is only truncated when the limit is set below ~10 characters, which is not useful in practice.
Steps to reproduce:
- Add a mod_kunenalatest module with Module Output = Latest Topics
- Set Post Text → Show
- Set Post Text Limit to e.g. 150
- View the module — post text is displayed untruncated regardless of post length
Root cause:
KunenaParser::stripBBCode() passes the limit to NBBC's SetLimit(), which calls Parse(). Inside Parse(), there is a short-circuit optimisation (BBCode.php):
Code:
if (\strlen($string) < $this->output_limit) {
$this->output_limit = 0; // limit disabled
}
$string is the raw BBCode, not the stripped plain text. Since BBCode tags add characters, the raw input is always longer than the plain text output. For any post whose raw BBCode is shorter than the configured limit, NBBC concludes "the string is already short enough" and silently disables the limit. At a typical limit of 100–200 chars, most posts' raw BBCode falls under the threshold and is never truncated.
A second fuzzy-precision check (limit_precision = 0.15) can also disable the limit even when the first check passes.
Fix: In KunenaParser::stripBBCode(), either disable the NBBC limit mechanism entirely and apply truncation to the plain text result after parsing, or call $bbcode->setLimitPrecision(0) and base the short-circuit check on an estimated plain text length rather than strlen() of the raw input.