Admincp Hook problems
#1
I am attempting very unsuccessfully to hook into the user module of the admincp.

I can't get this function to work:


function myipn_admin_user_action_handler(&$action)
{
	$action['myipn'] = array('active' => 'myipn', 'file' => 'myipn.php');

}

Now I see that NO ONE has yet to hook into the admincp so far. I looked and even Tikitiki's PMADMIN doesn't actually hook with a page.

I have /admin/modules/user/myipn.php but it doesn't hook from that function. However I did edit manually the user/module_meta.php and then it worked. But using the hook admin_user_action_handler has not done anything but give me grief.

Any assistance to why I can't hook would be helpful.

I think there should be more tutorials or at least a blank plugin as an example of how to use the new admincp. So far...no one has successfully created an admincp page under the modules directory. I have to assume since the hooks are there that is what we should do. I don't believe all the admincp functions are suppose to be in the inc/plugins/ file. It should be easier to seperate the plugin file from the admincp file.

If I get the new admincp all figured out I will write a tutorial for others to help get more plugins made.
Here is the module_meta.php function btw I can't hook into:

function user_action_handler($action)
{
	global $page, $lang, $plugins;
	
	$page->active_module = "user";

	$actions = array(
		'group_promotions' => array('active' => 'group_promotions', 'file' => 'group_promotions.php'),
		'admin_permissions' => array('active' => 'admin_permissions', 'file' => 'admin_permissions.php'),
		'titles' => array('active' => 'titles', 'file' => 'titles.php'),
		'banning' => array('active' => 'banning', 'file' => 'banning.php'),
		'groups' => array('active' => 'groups', 'file' => 'groups.php'),
		'mass_mail' => array('active' => 'mass_mail', 'file' => 'mass_mail.php'),
		'users' => array('active' => 'users', 'file' => 'users.php')
	);
	
	$plugins->run_hooks_by_ref("admin_user_action_handler", $action);
	
	if(isset($actions[$action]))
	{
		$page->active_action = $actions[$action]['active'];
		return $actions[$action]['file'];
	}
	else
	{
		$page->active_action = "users";
		return "users.php";
	}
}

Unreal...found problem. The hook is bad.

$plugins->run_hooks_by_ref("admin_tools_action_handler", $action);

Should be:

$plugins->run_hooks_by_ref("admin_tools_action_handler", $actions);

I will report bug now.

I just wasted a couple hours because of a bug with mybb. Sad
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)