MyBB Community Forums

Full Version: [Warning message] Undefined variable $new_class after upgrade
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Our provider just got updated to PHP 8.2.12 and I got some warnings that wasn't there before, so in order to try fix them I just upgraded from 1.8.35 to 1.8.37, but it doesn't fixed anything:

[Image: My-BB-Warnings-for-PHP-8-2-12.png]

I looked around the forum and I found something about the first one [$unreadreports] in this post and then I found it in the template and renamed it for the new name definition as suggested.

But, for the others related to $new_class I couldn't find anything.
I found it declared at these templates:
- forumdisplay_thread
- search_results_threads_thread
- usercp_latest_subscribed_threads
- usercp_latest_threads_threads

But, I have no idea about what happened to it since it's now causing warnings. Does anybody can help me with that?
Have a look at your index template for an outdated variable or erroneous code. Line 468 is trying to pull the 'index' template.
could you show your index template
and a list of plugins you use?

the templates you listed above contain this $new_class but index template doesn't in original
the warnings results on index.php and points on index template
Sorry by my delay...

(2024-03-24, 09:06 PM)bv64 Wrote: [ -> ]could you show your index template
and a list of plugins you use?
Currently active only Register Time (1.1)

(2024-03-19, 07:44 PM)MattyWjeisz Wrote: [ -> ]Have a look at your index template for an outdated variable or erroneous code. Line 468 is trying to pull the 'index' template.
(2024-03-24, 09:06 PM)bv64 Wrote: [ -> ]the templates you listed above contain this $new_class but index template doesn't in original the warnings results on index.php and points on index template
Thank you guys for the tip. I took a look at the Index template and the variable was there. I removed them once they doesn't exists anymore.
I think this should fix the warnings. By now our forum layout is a mess after we get the domain updated to https. That's another issue. Smile

I just checked and there are still these two messages pending:

Warning [2] Undefined array key "logoutkey" - Line: 25 - File: global.php(1070)
This one I found it in two templates:
1) in the script for footer template
<script>
	if (connected == 0)
	{ jQuery("#mobile_member").html("<a href='member.php?action=login'>Login</a> - <a href='member.php?action=register'>Register</a>"); }
	if (connected == 1)
	{ document.getElementById("mobile_member").innerHTML = '<a title="Inbox" href="private.php">Inbox</a> - <a title="User CP" href="usercp.php">User CP</a> - <a title="Log Out" href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}">Logout</a>'; }
</script>
2) in the header_welcomeblock_member template
<template name="header_welcomeblock_member" version="1812"><![CDATA[<li><a href="member.php?action=profile&uid={$mybb->user['uid']}">{$mybb->user['username']} <img src="{$mybb->user['avatar']}" style="float:right;width:25px;height:25px;border-radius:100%;margin-left:5px;"></a>
	<ul>
		<li><a href="private.php">Inbox</a></li>
		<li><a href="usercp.php">User CP</a></li>
		{$admincplink}
		{$modcplink}
		<li><a href="member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}">Logout</a></li>
	</ul>
</li>
<script>
	var connected = 1;
</script>]]>
</template>

They seems to be relevant, so I guess there something we need to change to fix that. Probably it should be another variable name?!

I used the Emerald theme to customise the forum after migrating from 1.6 to 1.8, but these are original code.


Warning [2] Undefined property: MyLanguage::$forum_announcements - Line: 47 - File: index.php(468)
This one is coming from the Index group template and is used in Index:
 :
 :
<div class="forum" style="float: left;">{$forums}{$boardstats}</div>
<br class="clear" />
{$footer}
{$lang->forum_announcements}
</body>
</html>
So, since it was something customised in the past I just removed it. Although we can find the $l['forum_announcements'] in inc/languages/english/admin/forum_announcements.lang.php.