Hi everyone,
We've been developing our module for our own VPS Control panel, but I having a little bit of issues (To WHMCS guys, please make a more detailed documentation!)
Here's the situation:
Configuration Function:
function WNCloud_ConfigOptions() {
return array (
// Choose Node button
"node" => array(
"FriendlyName" => "Node",
"Type" => "dropdown",
"Options" => "nodo-02",
"Description" => "Decide on which node create the VPS",
"Default" => "nodo-02",
),
// Choose Template button
"template" => array(
"FriendlyName" => "Server Template",
"Type" => "dropdown",
"Options" => getTemplates(),
"Description" => "Define which template should be installed by default",
"Default" => "800",
),
);
}
Crate Account Function:
function WNCloud_CreateAccount(array $params) {
global $db;
try {
$oid = incrementalHash();
$status = 'SETUP_WAIT';
$p = '0';
$sql = $db->prepare('INSERT INTO daemon (order_id, template_id, user, status, pass, root_pw) VALUES (:oid, :t, :user, :status, :pass, :pw)');
$sql->bindParam(':oid', $oid);
$sql->bindParam(':t', $params['configoption2']);
$sql->bindParam(':user', $params['clientsdetails']['email']);
$sql->bindParam(':status', $status);
$sql->bindParam(':pass', $p);
$sql->bindParam(':pw', $params['customfields']['password']);
$sql->execute();
} catch (Exception $e) {
logModuleCall(
'WNCloud',
__FUNCTION__,
$params,
$e->getMessage(),
$e->getTraceAsString()
);
return $e->getMessage();
}
return 'success';
}
Other functions just like incrementalHash() and getTemplates() are working just fine! but the creation function just loops over and over when I click on the "Create" button from within WHMCS. Am I using the $params array wrong?
Regards