2019-06-12, 02:27 PM
Actual Situation:
The subject of lastpost in forumdisplay is cut down to a fixed value of 25 characters with three trailing dots (full stops).
Neither a typographic ellipsis character is chosen.
This is hard-coded in function_forumlist.php / Line 312-315 / up to version 1.8.21
Improvement:
Use an own setting to define the max length of the subject string to be cut down.
Optionally allow the three dots to be an individual string or left empty.
Settings could make availabe two variables, for example:
1) $mybb->settings['lastpostsubjectlength']
Any numeric value [0-9]*
Set to 0 to deacitvate cut down.
2) $mybb->settings['lastpostsubjectellipsis']
Any varchar, e.g. "...", any html-code (img) or just left empty.
Implementation:
Insert settings into the database to group of Forum Display Options (7):
Replace the mentioned PHP code in function_forumlist.php with the following:
That's it!
If this enhancement will not follow a future implementation, other users can take it to improve their design even though.
Cheers!
[ExiTuS]
The subject of lastpost in forumdisplay is cut down to a fixed value of 25 characters with three trailing dots (full stops).
Neither a typographic ellipsis character is chosen.
This is hard-coded in function_forumlist.php / Line 312-315 / up to version 1.8.21
if(my_strlen($lastpost_subject) > 25)
{
$lastpost_subject = my_substr($lastpost_subject, 0, 25)."...";
}
Improvement:
Use an own setting to define the max length of the subject string to be cut down.
Optionally allow the three dots to be an individual string or left empty.
Settings could make availabe two variables, for example:
1) $mybb->settings['lastpostsubjectlength']
Any numeric value [0-9]*
Set to 0 to deacitvate cut down.
2) $mybb->settings['lastpostsubjectellipsis']
Any varchar, e.g. "...", any html-code (img) or just left empty.
Implementation:
Insert settings into the database to group of Forum Display Options (7):
INSERT INTO mybb_settings
(sid, name, title, description, optionscode, value, disporder, gid, isdefault)
VALUES
(9991, 'lastpostsubjectlength', '[ETS] Max length of subject in last post until cut down.', 'If the subject text in last post is exceeding this value, it is cut down and replaced by dots at the end of line. Set to 0 to disable', 'numeric\nmin=0', '25', 91, 7, 1);
INSERT INTO mybb_settings
(sid, name, title, description, optionscode, value, disporder, gid, isdefault)
VALUES
(9992, 'lastpostsubjectellipsis', '[ETS] Ellipsis for cut down subjects in last post.', 'Replacement string at the end of subject line cut down.', 'text', '...', 92, 7, 1);
(sid + disporder are exemplary)Replace the mentioned PHP code in function_forumlist.php with the following:
if ($mybb->settings['lastpostsubjectlength'] > 0)
{
if(my_strlen($lastpost_subject) > $mybb->settings['lastpostsubjectlength'])
{
$lastpost_subject = my_substr($lastpost_subject, 0, $mybb->settings['lastpostsubjectlength']).$mybb->settings['lastpostsubjectellipsis'];
}
}
That's it!
If this enhancement will not follow a future implementation, other users can take it to improve their design even though.
Cheers!
[ExiTuS]