MyBB Community Forums

Full Version: OUGC Block By Thread Prefix
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2023-10-04, 10:28 PM)Crazycat Wrote: [ -> ]Check your server logs. There is probably a php error not showed in the ACP.

Thanks Crazycat, I checked the logs and found 1 error which was when I had uploaded the files and then went to the plugins in the ACP (and it was blank)

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function create_function() in /var/www/vhosts/example.com/httpdocs/inc/plugins/ougc_blockbyprefix.php:36\nStack trace:\n#0 /var/www/vhosts/example.com/httpdocs/admin/modules/config/plugins.php(526): require_once()\n#1 /var/www/vhosts/example.com/httpdocs/admin/index.php(830): require('...')\n#2 {main}\n thrown in /var/www/vhosts/example.com/httpdocs/inc/plugins/ougc_blockbyprefix.php on line 36'

This is on my test site which is running php 8.0.30 and MyBB 1.8.36
No themes, just some plugins (checking their compatibility with PHP 8)
The create_function() function in PHP is causing an error because it has been completely removed with PHP 8.0.
(2023-10-05, 08:40 AM)bv64 Wrote: [ -> ]The create_function() function in PHP is causing an error because it has been completely removed with PHP 8.0.

Great spot, thank you!

So in the file it only has the function once (on line 36)

$plugins->add_hook('admin_config_thread_prefixes_begin', create_function('', '
global $plugins;
$plugins->add_hook(\'admin_formcontainer_end\', \'ougc_blockbyprefix_container\');
'));


So, I guess that I need to find the way to replace "create_function" and then try again  Shy

Do you think that this would replace it?

$plugins->add_hook('admin_config_thread_prefixes_begin', function() use ($plugins) {
    $plugins->add_hook('admin_formcontainer_end', 'ougc_blockbyprefix_container');
});

Or could it break other parts of the forum?

Well tried that lol (why I thought it might work I don't know) 

Got the same blank Plugin area in ACP and this was in the server logs

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: Illegal offset type in /var/www/vhosts/example.com/httpdocs/inc/class_plugins.php:99\nStack trace:\n#0 /var/www/vhosts/example.com/httpdocs/inc/plugins/ougc_blockbyprefix.php(38): pluginSystem->add_hook()\n#1 /var/www/vhosts/example.com/httpdocs/admin/modules/config/plugins.php(526): require_once('...')\n#2 /var/www/vhosts/example.com/httpdocs/admin/index.php(830): require('...')\n#3 {main}\n thrown in /var/www/vhosts/example.com/httpdocs/inc/class_plugins.php on line 99'

Will have to try something else  Confused
we had worked on OUGC Awards with the same issue, but it was only the tip of the iceberg

you can look here: https://community.mybb.com/thread-237734.html
(2023-10-05, 01:27 PM)bv64 Wrote: [ -> ]we had worked on OUGC Awards with the same issue, but it was only the tip of the iceberg

you can look here: https://community.mybb.com/thread-237734.html

Oh my, I see what you mean  Dodgy

I just tried this 

$plugins->add_hook('admin_config_thread_prefixes_begin', new class($plugins) {
    private $plugins;

    public function __construct($plugins) {
        $this->plugins = $plugins;
    }

    public function attachHooks() {
        $this->plugins->add_hook('admin_formcontainer_end', 'ougc_blockbyprefix_container');
    }
});


But got the same blank plugin page and the same error on the server  Sad

Might be easier to go a different method and dump this plugin!
yes, it will surely be a lot of work

Omar wants to update his plugins for php8 when he has the time...
I have took long for updating some plugins, so long that the few I already updated seem to now require new quick fixes.

let me see what I can do in the upcoming weeks.

The approach would be around the following (to create functions for all of the instances) :
https://community.mybb.com/thread-237734...pid1383888
Pages: 1 2