Jump to content

Questions about API and email templates


Plant

Recommended Posts

Hi everyone,

 

I am writing a Drupal module to integrate the support aspects of WHMCS with Drupal, and I've run into two problems:

 

1 - I would need to add and get attachments to support tickets via the API. I could not find any API functions for this - do you know of any way to do this?

 

2 - I want to URL to view the ticket (on the Drupal site) to be:

 

http://example.com/whmcs/view-ticket/{$id}/{$c}

 

where {$id} is the ticket id (not the 6-digit tid) and {$c} is the hash of the ticket. This link should be included in the email template when a ticket has been opened. These two values (id and hash) are not available in the template - is there any way to use them in the email?

 

Any help would be greatly appreciated!

Link to comment
Share on other sites

OK, I found a solution (sort of) to problem number 2:

 

In your email template, place this:

 

{php}

$link = mysql_connect('localhost', 'db_user', 'db_password');

mysql_select_db('database_name');

 

$query = 'SELECT id, c FROM tbltickets WHERE tid=' . $this->_tpl_vars['ticket_id'];

$result = mysql_query($query);

$line = mysql_fetch_array($result, MYSQL_ASSOC);

$real_id = $line['id'];

$c = $line['c'];

 

echo "http://example.com/?q=whmcs/view-ticket/$real_id/$c";

{/php}

 

I personally don't like this approach, and there must be some smarter place to put it than straight into the template. Is there a preprocess function somewhere? I'd be grateful if anyone has a cleaner solution.

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