MyBB Community Forums
[Rejected] Irregular / useless variable "new_class" in forumdisplay.php - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Development (https://community.mybb.com/forum-161.html)
+--- Forum: MyBB 1.8 Development (https://community.mybb.com/forum-165.html)
+---- Forum: 1.8 Bugs and Issues (https://community.mybb.com/forum-157.html)
+----- Forum: Rejected (https://community.mybb.com/forum-184.html)
+----- Thread: [Rejected] Irregular / useless variable "new_class" in forumdisplay.php (/thread-230766.html)



Irregular / useless variable "new_class" in forumdisplay.php - [ExiTuS] - 2021-01-06

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]


RE: Irregular / useless variable "new_class" in forumdisplay.php - Laird - 2021-01-06

(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.


RE: Irregular / useless variable "new_class" in forumdisplay.php - [ExiTuS] - 2021-01-06

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]