Jump to content

Run command


esje

Recommended Posts

Hi there,

 

How can I get WHMCS to run a terminal command after someone has signed up for my service? I need to parse username/password, "createseedbox username password", I have looked at hooks and looking for someone to educate me on how to do this.

 

Thanks

Link to comment
Share on other sites

If you are not currently using a provision module, you could create your own and in the CreateAccount function execute the command.

http://docs.whmcs.com/Provisioning_Module_Developer_Docs

 

e.g.

function modulename_CreateAccount($params) {
 exec('createseedbox '.escapeshellarg($params['username']) . ' ' . escapeshellarg($params['password']));
}

 

Or if you are using an existing provision module, then you would want to use the AfterModuleCreate hook.

http://docs.whmcs.com/Hooks:Products/Services#AfterModuleCreate

 

That would look something like this, but you may also want to add an if statement and only run this based on the module or product type.

function create_seedbox($vars) {
 exec('createseedbox '.escapeshellarg($vars['params']['username']) . ' ' . escapeshellarg($vars['params']['password']));
}

add_hook("AfterModuleCreate",1,"create_seedbox");

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