Jump to content

hook not firing?


Recommended Posts

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 by steph.hope
Link to comment
Share on other sites

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 😑

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated