MyBB Community Forums
Data from class hook - Printable Version

+- MyBB Community Forums (
+-- Forum: Extensions (
+--- Forum: Plugins (
+---- Forum: Plugin Development (
+---- Thread: Data from class hook (/thread-234884.html)

Data from class hook - SvePu - 2022-02-08


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

RE: Data from class hook - Matt - 2022-02-08

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

RE: Data from class hook - Mostafa.Shiraali - 2022-02-08

$plugins->add_hook("datahandler_user_delete_start", "dhudels");
function dhudels($obj)

RE: Data from class hook - SvePu - 2022-02-08

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!