Jump to content

return values on hook get overwritten by next hook


Recommended Posts

Hello,

With the ClientAreaPageProductsServices Hook for a module, you can modify and return the values off the hook to be used on the template of the page.

But i have noticed if you have another module hook doing the same, which ever one was run first will get overwritten by the 2nd values.

It seems like the default values get provided to each hook. So if you have one module using the hook and returning the modified values, it works fine.

But when you have two modules with the same hook being used. because the default values get provided to both, no matter if one modified the values. Only the final module running the hook will have their modifications passed onto the template.

Is there a way to fix this? So modifications made by all module hooks for that function will be provided to the template?

Link to comment
Share on other sites

4 hours ago, PixelPaul said:

But when you have two modules with the same hook being used. because the default values get provided to both, no matter if one modified the values. Only the final module running the hook will have their modifications passed onto the template.

you might want to look at priorities, e.g the order in which hooks using the same hook point are called.

https://developers.whmcs.com/hooks/priority/

Link to comment
Share on other sites

the ordering does not changes the problem, it just orders the module hooks.

the last one still gets the variables which have not been modified by previous modules, and provides the final variables.

the WHMCS hooks system is very flawed

Edited by PixelPaul
Link to comment
Share on other sites

  • 1 month later...

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