Jump to content

Action Hook - TicketOpen, how to get client name?


Strik

Recommended Posts

Hello,

 

I still use version 4 of WHMCS and created hook called TicetOpen.

Here is my code:

 

<?php

function SendSMS_NewTicket($vars)
{
$userid = $vars['userid'];
   $message = $vars['message'];
   $priority = $vars['priority'];
$subject = $vars['subject'];
$username = '';
   $lastname = $vars['lastname'];
   $password = '';
   $destination = '';
   $source = 'Transfer';    
   $text = "$subject";

   $content =  'action=sendsms'.
               '&user='.rawurlencode($username).
               '&password='.rawurlencode($password).
               '&to='.rawurlencode($destination).
               '&from='.rawurlencode($source).
               '&text='.rawurlencode($text);

   $smsglobal_response = file_get_contents('http://www.smsglobal.com.au/http-api.php?'.$content);
}

add_hook("TicketOpen",1,"SendSMS_NewTicket"," ");

?>

 

I want to receive SMS if customer created ticket, all goes good, but I can't get customer First and Last name. This should be easy to get in new versions, but I cannot do this in WHMCS 4. Can anybody suggest mysql query or any way to get Client full Name?

 

Thanks

Link to comment
Share on other sites

v4 is a little before my time, but I doubt WHMCS database structure has changed much between 4 and 5... if so, it should be something along the lines of..

 

SELECT CONCAT(firstname,' ',lastname) FROM tblclients WHERE id=$userid

that's if you wanted the full name - but if you were wanting them separately, then you wouldn't need the concat and could just select both firstname and lastname in the query.

Link to comment
Share on other sites

Best answer is going to be one you don't want to hear. Update your older than dirt software.

v4 is incredibly out of date and relies on EOL versions of PHP

Your addons will likely have to be reworked, ut come on, you're exposing your server and billing client (you know, your bread and butter) to massive vulnerabilities here

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