Jump to content

Extra variables in action hook


Recommended Posts

You can use SQL queries and/or the API to pull the data you need. For example, if you want to get the clients first name, last name, and email address, you would use something like this.


function do_something_cool($vars) {

   $invoiceid = $vars['invoiceid'];
   $_query = "SELECT c.firstname, c.lastname, c.email FROM tblclients c, tblinvoices i WHERE i.userid = c.id AND i.id='$invoiceid'";
   $data = full_query($_query);
   $result = mysql_fetch_array($data);

   $firstname = $result[0];
   $lastname = $result[1];
   $email = $result[2];

add_hook("InvoiceCreated", 1, "do_something_cool");

Link to comment
Share on other sites

Thank you. The API didn't work for me but the SQL did. But now I'm facing another problem. I can't include an api class. I get a blank page.


Some code examples of what you're doing would be helpful. You have to be careful with actionhooks. If theres an error in them some things in WHMCS will not function properly.

Link to comment
Share on other sites


 $sms = new mollie();


In the activity log I get only test1. Not test2. Same problem if I use require() and put logActivity() in front of it. So my conclusion is that the action hook does work, but there goes something wrong with the include/require.


If I use require().. the problem starts there. If I use include() the problem start when I want to use the class. :roll:So it has to be the class. I put the class in the includes directory.

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.

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