MyBB Community Forums

Full Version: Direct initialization of this file is not allowed. Please make sure IN_MYBB is def..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I've been customizing my forum for a few days now and installed every necessary plugin on day 1: no issue since then.

However, about 1 hour ago, the following message started showing itself on the top of the forum:
Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.

I tried deactivating every single plugins and adding define("IN_MYBB", 1); inside each plugin, it's still there.
https://the-haven.fr

Would greatly appreciate any help, thank you.

EDIT: Message appears mostly everywhere, even in the ACP

I tried deactivating, deinstalling and completely deleting the few plugins I have; nothing, it's still there.
What's the result of running File Verification? You can access it at admin/index.php?module=tools-file_verification
(2023-08-30, 05:20 AM)Laird Wrote: [ -> ]What's the result of running File Verification? You can access it at admin/index.php?module=tools-file_verification

[Image: yvQkiXX.png]
(if image doesn't show up: https://i.imgur.com/yvQkiXX.png )
I triple checked all these files and temporarily modifying these to check if they any file was guilty didn't help; none seems to be at the root of the issue
I don't really know what to do.
What are the contents of your inc/plugins/ directory?
grep says lots of MyBB files have the "Direct initialization" statement in them. Including your admin/modules/styles/theme.php
What mods have you made to make it show up on the file verification list?

also

inc/datahandlers/users.php

I also note global.php has been modified, which requires inc/datahandlers/users.php

Somewhere, I'd guess there's a typo creating a syntax error. Is your error.log enabled? and what are the contents?
Thanks for your responses.

(2023-08-30, 11:02 AM)Laird Wrote: [ -> ]What are the contents of your inc/plugins/ directory?

There are two custom plugins in it, but I already tried deleting every plugin to see if the message went gone; still there..
content: https://i.imgur.com/KlFaHyp.png

(2023-08-30, 11:11 AM)HLFadmin Wrote: [ -> ]grep says lots of MyBB files have the "Direct initialization" statement in them. Including your admin/modules/styles/theme.php
What mods have you made to make it show up on the file verification list?

also

inc/datahandlers/users.php

I also note global.php has been modified, which requires inc/datahandlers/users.php

Somewhere, I'd guess there's a typo creating a syntax error. Is your error.log enabled? and what are the contents?

Worst thing is that I never opened/edited this theme.php file, but I just replaced it with the default one.
I just replaced the users.php file with the default one aswell; message is still there. I checked global.php and there's only 2 added lines but nothing else, I also tried replacing it with default one just in case.


Okay. So I was writing this message while following your tips HLFadmin, and I didn't know the existence of the error log. I found it, checked the most recent error message and found the guilty: /public_html/inc/init.php -- I checked the file, added define("IN_MYBB", 1); in the init.php file and checked my forum back: the message finally disappeared but another error took place; there was a bad setting in one of my custom plugins. I corrected it, removed the line I just added in init.php and everything seems good.

Huge thanks for your help, much appreciated. Smile
(2023-08-30, 01:08 PM)Wyvh Wrote: [ -> ]there was a bad setting in one of my custom plugins. I corrected it, removed the line I just added in init.php and everything seems good.

I'm curious to know what this bad setting was, and how/why it was causing the unwanted message to display at the top of your board. If it's not too much trouble, and doesn't reveal anything proprietary that you prefer be kept private, can you please share the details?
(2023-08-30, 11:36 PM)Laird Wrote: [ -> ]
(2023-08-30, 01:08 PM)Wyvh Wrote: [ -> ]there was a bad setting in one of my custom plugins. I corrected it, removed the line I just added in init.php and everything seems good.

I'm curious to know what this bad setting was, and how/why it was causing the unwanted message to display at the top of your board. If it's not too much trouble, and doesn't reveal anything proprietary that you prefer be kept private, can you please share the details?

There was an additional { or } in the file!
(2023-08-31, 07:35 PM)Wyvh Wrote: [ -> ]There was an additional { or } in the file!

OK, but how was that causing the unwanted message?
(2023-08-31, 08:55 PM)Laird Wrote: [ -> ]
(2023-08-31, 07:35 PM)Wyvh Wrote: [ -> ]There was an additional { or } in the file!

OK, but how was that causing the unwanted message?

That's a good question.