Firstly apologies for my explanation and terminology, this is a relatively new area for me.
I've built an extension which uses three hooks:
- user_register_end
- user_edit_end
- user_delete_account_end
The first two are working correctly however the last one doesn't appear to be. The hook is referenced in Solspace User in file mod.user.php as is the user_register_end
one.
Here are the two hook initiations:
//Register user hook (working)
if (ee()->extensions->active_hook('user_register_end') === TRUE)
{
$edata = ee()->extensions->universal_call('user_register_end', $this, $member_id);
if (ee()->extensions->end_script === TRUE) return;
}
//Delete user hook (not working)
if (ee()->extensions->active_hook('user_delete_account_end') === TRUE)
{
$edata = ee()->extensions->universal_call('user_delete_account_end', $this);
if (ee()->extensions->end_script === TRUE) return;
}
And here is my code for both hooks:
//Hook array used to populate the extensions table
$hooks = array(
'user_register_end' => 'new_client_check',
'user_edit_end' => 'upd_client_check',
'user_delete_account_end' => 'del_client_check'
);
function upd_client_check($member_id, $user_object, $cfields) {
//Function code
}
function del_client_check($member_data) {
return('working');
die;
}
During my tests I've been printing out comments or data and killing the function so it stops right away and this has been working fine so far. Now though when I delete a member I'm just shown the successful delete message so the hook isn't being noticed.
I can confirm that all the hooks and methods are in the database correctly.
Can anyone help at all? And if you need to me explain in more detail I'll try my best.
Edit I am using this extension with the Solspace User delete form.
Thank you.
return
beforedie
, which means your PHP script will seereturn
then stop, and never see thedie
command. Tryecho 'working'; die();
or even simplydie('working');