MyBB Community Forums

Full Version: More info regarding hooks in debug page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Currently the debug page displays on what hook queries were run (global_start, postbit, etc) but not what actual plugin hooks are run on that hook.

Ideally, it should tell me exactly what hook ran that query, but as a quick fix I applied the following:
	function explain_query($string, $qtime)
	{
		global $plugins;

		$debug_extra = '';
		if($plugins->current_hook)
		{
			$debug_extra = "<div style=\"float_right\">(Plugin Hook: {$plugins->current_hook})</div>";
			$debug_extra .= "<div style=\"float_right\">(Hooks: ";
			foreach($plugins->hooks[$plugins->current_hook] as $plugin_hook)
			{
				$comma = '';
				$debug_extra .= implode(', ', array_keys($plugin_hook)).$comma;
				$comma = ', ';
				break;
			}
			$debug_extra .= ")</div>";
		}

Now I can know what plugins ran on that hook.
I can definitely see this coming in useful personally.
Nice addition.