WHMCS Module v2
From SolusVM
| PLEASE READ - This version is no longer maintained. Please see WHMCS_Module_v3 |
Contents |
Overview
This module is a total rebuild of our first version. The module is non encoded so it can be modified with ease. The module allows you to create, destroy, suspend, unsuspend, upgrade, downgrade, reboot, boot and shutdown. virtual servers direct from WHMCS.
The module supports SSL mode as default with or without a valid certificate on the SolusVM master.
Installation
Download
You can download the latest module version from your client area.
Upload
Once you have downloaded the <module>.zip file to your computer you need to extract the files using your favorite zip extraction program.
Now you should be presented with a folder called modules. You need to upload this folder to the root of your WHMCS installation.
The folder structure should be as listed below:
WHMCSroot/modules/servers/solusvmpro/
solusvmpro.php
Configuration
Creating API Users in SolusVM
To create an API user in SolusVM click Configuration >> API Users >> Create API User.
You will be presented with some fields like the image below:
The ID & Key are auto generated and cannot be changed, all you need to add is the IP address of your WHMCS installation and set it to active.
Adding a Master to WHMCS
Before you can configure your products to use the SolusVM module you need to add a master server to WHMCS.
In WHMCS select Setup >> Servers >> Add new server
Fill in the form as illustrated in the images below.
Now click Save Changes to add the master to WHMCS.
Creating a Product
In WHMCS select Setup >> Products/Services
Now click Create a New Product and fill in the form as illustrated in the image below.
Click Continue.
Now fill in all your product details. After that you need to click on Module Setting and select Solusvm from the dropdown menu.
Once the module has loaded you will be presented with the follow options as illustrated in the image below.
NOTE: When there isn't listed anything in the select boxes, select the virtualization type and click on the save button. After that you will see the select boxes filled.
First of all you need to select the master server you created in section 3.3 #Adding a Master to WHMCS then click Save Changes to load all the templates, plans and servers directly from the SolusVM master.
Once the page has reloaded you can set all the options you need for this product.
Options Explained
Module User Type : If you are an admin or reseller (Currently only Admin supported)
Default Node : The node the virtual server will be built on if no overide is given
Master Server : The master server this package is assigned to
Default Plan : Then plan on the master the package is assigned to
Virtualization Type : Choose either OpenVZ, Xen-PV or Xen-HVM
Default Operating System : The operating system that is used if not defined in configurable options.
Username Prefix : This is the unique prefix that defines the username for each client. Set this the same in all plans. i.e: vmuser
IP Addresses : The amount of ip addresses for this package
Click Save Changes then select the Custom Fields tab.
This is the important part! You need to create 3 custom fields:
Field Name: vserverid , Field Type: Text Box and tick Admin Only. Field Name: consoleusername , Field Type: Text Box and tick Admin Only. Field Name: consolepassword , Field Type: Text Box and tick Admin Only.
Make sure it looks like this image below.
The vserverid custom field will hold the unique vserverid that is used within SolusVM.
When you have set the custom fields, click Save Changes.
Thats it! the basic configuration is complete.
Optional Configuration
Client Operating System Chooser
This handy little feature lets you add a dropdown list of operating systems on the products order form allowing the client to choose the operating system they want without having to rebuild there vps after its been setup with the default template.
To set this up you need to create a configurable option group for each virtualization type:
You then need to add a new configurable option to the new group. You must call the option name one of the following:
Operating System (OpenVZ)
Operating System (Xen)
Operating System (Xen HVM)
Select Field Type: Dropdown and tick Show on Order Form.
In Field Options you need to define your templates with a friendly name and filename.
Example: "fedora-9-x86|Fedora 9 32 Bit,centos-5.0-x86|CentOS 5 32 Bit, debian-5.0-x86|Debian 5 32 Bit"
The first part is the filename i.e fedora-9-x86 and the second part is the friendly name i.e Fedora 9 32 Bit. Both parts must be seperated with a |
The filename must match the filename of the template or ISO as shown in SolusVM i.e fedora-9-x86.tar.gz needs to be listed as fedora-9-x86 or windows-7-x86.iso must be windows-7-x86, so the rule is just remove the .tar.gz or .iso when listing them in WHMCS.
Heres an image of what the options should look like.
Thats it, just click Save Changes and follow this procedure for each virtualization type you need.
Global Options
You can override several different options of the module by setting parameters in the master server access hash field.
Custom Port The port the module will connect to the master on.
<port>VALUE</port>
Debug This will give you debug output to screen when you run a module function. Only switch this on when you are testing, allways turn it off when you have finished with it.
<debug>on/off</debug>
Username Prefix Enter a default username prefix for the client login to solusvm. i.e: vmuser , When a client has multiple vps they will be created under the same account.
<username-prefix>VALUE</username-prefix>
Default OpenVZ Node This will overide the server any OpenVZ vps are created on. VALUE must be the name of the server as listed in SolusVM.
<default-openvz-node>VALUE</default-openvz-node>
Default Xen Node This will overide the server any Xen vps are created on. VALUE must be the name of the server as listed in SolusVM.
<default-xen-node>VALUE</default-xen-node>
Default Xen HVM Node This will overide the server any Xen HVM vps are created on. VALUE must be the name of the server as listed in SolusVM.
<default-hvm-node>VALUE</default-hvm-node>
Admin Login Link
function solusvmpro_AdminLink($params) { $code = '<form action="https://'.$params["serverip"].':5656/admincp/login.php" method="post" target="_blank"> <input type="hidden" name="username" value="USERNAME HERE" /> <input type="hidden" name="password" value="PASSWORD HERE" /> <input type="submit" name="Submit" value="Login" /> </form>'; return $code; }
Improved Hostname Format Checking
This will handle issues such as a hostname of a single word or a hostname with only two words (i.e. "hostname" or "host.name"). This may not be an issue for most but if you plan to run a cPanel install on the VPS it will require a proper hostname. You can't create a VPS directly with a poor hostname via SolusVM but you can via WHMCS+SolusVM Module.
Replace THIS in /modules/servers/solusvmpro/solusvmpro.php:
## Sort the hostname if (!empty($params[domain])) { $currentHost = $params[domain] { strlen($params[domain]) - 1} ; if (!strcmp($currentHost, ".")) { $newHost = substr($params[domain], 0, -1); mysql_real_escape_string($newHost); mysql_query("UPDATE tblhosting SET `domain` = '$newHost' WHERE `id` = '$serviceid'"); } else { $newHost = $params[domain]; } } else { $newHost = "vps.server.com"; }
With THIS:
## Sort the hostname if (!empty($params[domain])) { $currentHost = $params[domain] { strlen($params[domain]) - 1} ; if (!strcmp($currentHost, ".")) { $newHost = substr($params[domain], 0, -1); } else { $newHost = $params[domain]; } } else { $newHost = "vps.server.com"; } if (substr($newHost, 0, 1) == ".") $newHost = substr($newHost, 1); switch (substr_count($newHost, ".")) { case 0: $newHost = "vps.".$newHost.".com"; break; case 1: $newHost = "vps.".$newHost; break; } if ($newHost != $params[domain]) { mysql_real_escape_string($newHost); mysql_query("UPDATE tblhosting SET `domain` = '$newHost' WHERE `id` = '$serviceid'"); }
Troubleshooting
Slow Loading
If you are experiencing slow load times in WHMCS while working in "Products/Services", be sure that the WHMCS web server is not blocking the port your SolusVM web server is running on (5353 by default).









