MyBB Community Forums

Full Version: Irregular / useless variable "new_class" in forumdisplay.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Irregular and useless definition of variable "$new_class".

Files
- forumdisplay.php
- search.php
- usercp.php

There are irregular definitions with no CSS style defined for this class ins Standard theme.

# grep "new_class" *.php
forumdisplay.php:	$new_class = ' class="subject_new"';
forumdisplay.php:	$new_class = ' class="subject_old"';
forumdisplay.php:	$new_class = "subject_new";
forumdisplay.php:	$new_class = "subject_old";
search.php:		$new_class = "subject_new";
search.php:		$new_class = 'subject_old';
usercp.php:		$new_class = "subject_new";
usercp.php:		$new_class = "subject_old";
usercp.php:		$new_class = "subject_new";
usercp.php:		$new_class = "subject_old";
usercp.php:		$new_class = "subject_new";
usercp.php:		$new_class = "subject_old";

Templates
Variable {$new_class} is used in several templates in different ways:
- forumdisplay_announcements_announcement
- forumdisplay_thread
- search_results_threads_thread
- usercp_latest_subscribed_threads
- usercp_latest_threads_threads
- usercp_subscriptions_thread

Template examples:
<a href="{$announcement['announcementlink']}"{$new_class}>{$announcement['subject']}</a>
<span>{$prefix} {$gotounread}{$thread['threadprefix']}<span class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">...
<td class="{$bgcolor}">{$gotounread}{$thread['displayprefix']}<a href="{$thread['threadlink']}" class="{$new_class}">...

There is no CSS style definition in Standard theme for ".subject_new" and ".subject_old" at all, so its useless or a potential option for styling!?
Either this definition can be dropped from PHP code. Otherwise some code cosmetics can make this variable regular.

[ExiTuS]
(2021-01-06, 01:36 AM)[ExiTuS] Wrote: [ -> ]There is no CSS style definition in Standard theme for ".subject_new"

How about this?

(2021-01-06, 01:36 AM)[ExiTuS] Wrote: [ -> ]and ".subject_old" at all

Yep, I guess .subject_old is just for custom theme developers to style in contrast to .subject_new if they want/need to.
My fault. Laird, you're right - this class is actually available in Standard theme.
Great fund! Thanks to sort out with your quick reply.

Nevertheless it might be beneficial to make the rest of the code more regular.

[ExiTuS]