XF 2.2 Get userId in callback on user_delete_clean_init event

nevi

Member
Hi!

I need to recalculate some data for deleted user in my addon. In callback of user_delete_clean_init i got params (\XF\Service\User\DeleteCleanUp $deleteService, array &$deletes)
How to get user id from $deleteService? $deleteService->userId is protected, and i have error:
An exception occurred: [Error] Cannot access protected property XF\Service\User\DeleteCleanUp::$userId in src/addons/Prokoni/Events/Listener.php

Little help?

Thanks!
 
If you're just deleting data, append to the $deletes array:

PHP:
$deletes['xf_your_table'] = 'user_id = ?'; // will delete rows from `xf_your_table` with a clause on the `user_id` column

If you need to do something more complicated you can use the class extension system to extend the delete clean-up service.
 
If you're just deleting data, append to the $deletes array:

PHP:
$deletes['xf_your_table'] = 'user_id = ?'; // will delete rows from `xf_your_table` with a clause on the `user_id` column

If you need to do something more complicated you can use the class extension system to extend the delete clean-up service.
Hi! Thanks!
Yes, i need more complicated. What is "class extension system" any docs, or example? Thanks

BR


UPD:
I found a video example of extension -
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
It works )
 
Last edited:
Top Bottom