Jump to content

Custom client area button


quicklyweb

Recommended Posts

Can't seem to get below code to show a button on product details. I read the documentation and below code should add a button to client area. But it doesn't. What am i missing?

 

 

function ACMETECH_ClientAreaCustomButtonArray() {

$buttonarray = array(

"Reboot Server" => "reboot",

);

return $buttonarray;

}

Link to comment
Share on other sites

Okay i missed a little part in documentation now i can execute soap requests in functions. I get blank page when i press reboot button in below code

 


$ServersAPI = new SoapClient('https://acmetech.com/Api/Api.svc?wsdl');

               $acmetechServerID = $params['customfields']['Label'];

               $APIUsername = 'username';

               $APIPassword = 'password';

               $params->authInfo->Username = $APIUsername;

	$params->authInfo->Password = $APIPassword;

	$params->serviceId = $acmetechServerID;


function acmetech_CreateAccount($params) {



   # ** The variables listed below are passed into all module functions **



   $serviceid = $params["serviceid"]; # Unique ID of the product/service in the WHMCS Database

   $pid = $params["pid"]; # Product/Service ID

   $producttype = $params["producttype"]; # Product Type: hostingaccount, reselleraccount, server or other

   $domain = $params["domain"];

   $username = $params["username"];

   $password = $params["password"];

   $clientsdetails = $params["clientsdetails"]; # Array of clients details - firstname, lastname, email, country, etc...

   $customfields = $params["customfields"]; # Array of custom field values for the product

   $configoptions = $params["configoptions"]; # Array of configurable option values for the product



   # Product module option settings from ConfigOptions array above

   $configoption1 = $params["configoption1"];

   $configoption2 = $params["configoption2"];

   $configoption3 = $params["configoption3"];

   $configoption4 = $params["configoption4"];



   # Additional variables if the product/service is linked to a server

   $server = $params["server"]; # True if linked to a server

   $serverid = $params["serverid"];

   $serverip = $params["serverip"];

   $serverusername = $params["serverusername"];

   $serverpassword = $params["serverpassword"];

   $serveraccesshash = $params["serveraccesshash"];

   $serversecure = $params["serversecure"]; # If set, SSL Mode is enabled in the server config



# Code to perform action goes here...



if ($successful) {

	$result = "success";

} else {

	$result = "Error Message Goes Here...";

}

return $result;

}


function acmetech_ClientAreaCustomButtonArray() {
$buttonarray = array(
"Reboot Server" => "reboot",
);
return $buttonarray;
}



function acmetech_ClientArea($params) {

$code = '<form action="clientarea.php?action=productdetails" method="post">
<input type="hidden" name="id" value="'.$params['serviceid'].'" />
<input type="hidden" name="modop" value="custom" />
<input type="hidden" name="a" value="reboot" />
<input type="submit" value="Reboot" />
</form>';
$code .= 'Server ID : '.$params['customfields']['Label'];



return $code;

}



function rapidswitch_AdminLink($params) {

$code = '<form action=\"http://'.$params["serverip"].'/controlpanel" method="post" target="_blank">

<input type="hidden" name="user" value="'.$params["serverusername"].'" />

<input type="hidden" name="pass" value="'.$params["serverpassword"].'" />

<input type="submit" value="Login to Control Panel" />

</form>';
return $code;

}

if ($_POST["cmdPowerCycle"] == "reboot") {

		$result = $ServersAPI->PowerCycleServer($params)->PowerCycleServerResult;



	}

function rapidswitch_LoginLink($params) {

echo "<a href=\"http://".$params["serverip"]."/controlpanel?gotousername=".$params["username"]."\" target=\"_blank\" style=\"color:#cc0000\">login to control panel</a>";

}



function rapidswitch_AdminCustomButtonArray() {

# This function can define additional functions your module supports, the example here is a reboot button and then the reboot function is defined below

   $buttonarray = array(

 "Reboot Server" => "reboot",

);

return $buttonarray;

}



function rapidswitch_reboot($params) {


       $code = $ServersAPI->PowerCycleServer($params)->PowerCycleServerResult;
return $code;



   if ($successful) {

	$result = "success";

} else {

	$result = "Error Message Goes Here...";

}

return $result;

}



?>

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