Jump to content

Server Module -> Pass information back to WHMCS


fwaggle

Recommended Posts

Hi all,

 

I originally created a support ticket (truthfully each and every time I've dealt with WHMCS I've been half asleep, I wasn't even aware there was a forum), but I thought I'd post here because more eyes might help.

 

I've written a server module, to automatically provision new accounts on a proprietary control panel we developed in house. Once I figured out the API format (could really use some more documentation to be honest) it was rather trivial to write, and it works great except for a couple of little gripes.

 

I have no idea how to cause it to emit an email, save using php's mail() function from inside the module. I can create a template, but I can't seem to cause WHMCS to send one out, which is probably just as well because...

 

I also can't figure out how to pass certain information back to WHMCS from the module. There's things (such as the port number) which are assigned automatically by the server who's panel I connect to. The server is also selected depending on what the user's preferred location, which is set via a custom field in the product. To be specific, I need to send the user an IP, a port, and two passwords - how the heck do I pass this information back to WHMCS? Ideally I'd like to be able to check the server I connected to and automatically add their account to that server, but I can't figure out how to do any of this stuff.

 

The support ticket response was:

 

You would need to use product custom fields to pass an overrideable value.

Product Custom fields are passed to the server module functions

 

This gave me something to think on, and I looked around quite a bit, but I can't find any way to override a custom field - I even tried redefining my _create() function to have $params passed by reference, no go! Absolutely nothing I do inside the module makes any difference inside WHMCS after the module's done running.

 

So what I do at the moment is the module_create() function connects to a server on a best guess based on the user's preferred location. If they pick "any", it randomly picks one. The module gives the password to the server and tells it to provision. The XML response contains the IP, port, the password supplied as well as the additional password (randomly generated), which the module then arranges into an email, sends and returns success.

 

I'd really like to have the email be from a template, logged, and have the service automatically assigned to the correct server. Is this possible? Anyone got any tips for accomplishing this?

 

Apologies for the wall of text. :)

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks 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