MyBB Community Forums
User & Groups Module - Blank Page? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: User & Groups Module - Blank Page? (/thread-211829.html)



User & Groups Module - Blank Page? - Lewis L - 2017-07-19

I'm trying to create a new user module in the Users & Groups tab, for some reason the page is completely white. There's nothing inside the <body>, the title of the page is empty as well.

I've checked Apache & PHP error logs and they both don't say anything about this page. I'm currently using these two hooks in the inc/plugin/ file.

  $plugins->add_hook('admin_user_menu', create_function('&$args', '$args[] = array(\'id\' => \'ranks\', \'title\' => \'Manage Ranks\', \'link\' => \'index.php?module=user-ranks\');'));
    $plugins->add_hook('admin_user_action_handler', create_function('&$args', '$args[\'ranks\'] = array(\'active\' => \'ranks\', \'file\' => \'ranks.php\');'));

Is there perhaps a hook I'm missing?


RE: User & Groups Module - Blank Page? - fizz - 2017-07-19

Could you paste the rest of the code?


RE: User & Groups Module - Blank Page? - Euan T - 2017-07-19

Don't use create_function() - it has been deprecated in PHP 7.1 and will be removed in 7.2. Instead, use a proper function:

$plugins->add_hook('admin_user_menu', 'myplugin_admin_user_menu');
function myplugin_admin_user_menu(&$sub_menu)
{
	$sub_menu[] = array(
		'id' => 'ranks',
		'title' => 'Manage Ranks',
		'link' => 'index.php?module=user-ranks',
	);
}

$plugins->add_hook('admin_user_action_handler', 'myplugin_admin_user_action_handler'); 
function myplugin_admin_user_action_handler(&$actions)
{
	$actions['ranks'] = array(
		'active' => 'ranks',
		'file' => 'ranks.php',
	);
}

That should also give some better error logs if there is a problem.