MyBB Community Forums

Full Version: Data from class hook
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey,

is it possible to get data from a class hook like:
$plugins->run_hooks('datahandler_user_delete_start', $this);

If yes -> HOW?! - I'm looking for the delete_uids from this hook Smile
When you use the hook, the callback will accept a parameter, where you'd be able to access that property:

function my_plugin_datahandler_user_delete_start($datahandler)
{
	// can access $datahandler->delete_uids
}
$plugins->add_hook("datahandler_user_delete_start", "dhudels");
function dhudels($obj)
{
var_dump($obj);
}
Thank you both for replying

I've tried to manage it like this:
$plugins->add_hook('datahandler_user_delete_start', 'myfunction_user');
function myfunction_user($data)
{
    foreach ($data->delete_uids as $key => $uid)
    {
        /**    */
    }
}

The hook has to be defined in AdminCP or not?

Oh lord..I was a little bit tired yesterday.

Finally I figured it out...the needed hook was on wrong position.

Thank you all for suggestions!