Jump to content

Making hook to cancel action


Dubz31337

Recommended Posts

I'm not sure if this is the correct board to post in or not, but here it goes.

 

 

I'm developing an addon for WHMCS (my first one in fact) and I have a couple questions about the hooks for it.

 

First off, is there a way to have the hook cancel the action that it's for? For instance, let's say I make a hook for an administrator editing a client. I create my function add the hook for "ClientEdit". My question is, if I want to run a test to see if the administrator is allowed to do this, how would I abort the edit if they aren't allowed? Even if I call a die(); the settings are still saved. I know I could probably "hide" the client form the administrators' view, but that won't stop them from going into the URL and changing the ID to a client they cannot see.

This is just an example, I need to be able to abort edits for various things and simply denying the permission isn't going to work. I'd explain more but I'd rather not spoil the addon for someone else to make on their own.

 

Secondly, is there a way to grab the $vars variable, commonly found in the output function? I know I can grab the settings from the database and rebuild it, however I also need to get the language screens, found in $vars['_lang'], into the array, but I'm not sure as to how I should call it properly (to support multiple languages).

 

 

Thanks in advanced! Any help would be appreciated.

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