steph.hope Posted May 6, 2021 Share Posted May 6, 2021 (edited) I'm trying to create a new hook on ContactDetailsValidation, but I can't get it to fire. I turned on hook debug mode and I can see the following: 06/05/2021 16:37 Hooks Debug: Hook File Loaded: [...]/includes/hooks/contactdetailsvalidation.php 06/05/2021 16:37 Hooks Debug: Hook Defined for Point: ContactDetailsValidation - Priority: 1 - Function Name: (anonymous function) 06/05/2021 16:37 Hooks Debug: Attempting to load hook file: [...]/includes/hooks/contactdetailsvalidation.php I've tried editing a Contact and creating a new one, and the hook didn't appear to fire in either case. All the hook is meant to do at this point is log something so I can see if it's working... Nothing is logged. I've gone back to the docs and copied from there into a new file, so I can't figure out what's wrong. I already have a hook on the similar ClientDetailsValidation, and it's working fine, along with all my other hooks. Any ideas? Edited May 6, 2021 by steph.hope 0 Quote Link to comment Share on other sites More sharing options...
steph.hope Posted May 6, 2021 Author Share Posted May 6, 2021 Ugh, looks like it only fires when the Contact is updated in the client area. Which seems wrong to me, since the Client hook works in admin area. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 6, 2021 Share Posted May 6, 2021 have you tried using ContactEdit and//or ContactAdd to see if they trigger in the admin area at the applicable times? 0 Quote Link to comment Share on other sites More sharing options...
steph.hope Posted May 6, 2021 Author Share Posted May 6, 2021 Both the ContactEdit and ContactAdd hooks work fine from the admin area, as well as when adding contacts via the API. I want to use the ContactDetailsValidation hook if possible because it returns the errors to the display and via the API. I'm don't think I can achieve the same thing with Edit/Add. I guess I'll try making a support request and see what their rationale is for why this is exactly the way it should be working 😑 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 7, 2021 Share Posted May 7, 2021 11 hours ago, steph.hope said: I guess I'll try making a support request and see what their rationale is for why this is exactly the way it should be working 😑 apologies Steph, didn't remember that the validation hook returns an error message - if it helps, it's part of clientfunctions.php, so it's probably expected behaviour that it only triggers in the client area and not the admin area. ClientDetailsValidation is written to work in both (as set out in the docs), it looks like the same is not true of the contacts equivalent - though Support should be able to confirm that. 0 Quote Link to comment Share on other sites More sharing options...
steph.hope Posted May 9, 2021 Author Share Posted May 9, 2021 It really is a bug! They've opened #CORE-16628, so hopefully eventually there'll be a fix. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.