mshannaq Posted February 14 Share Posted February 14 Hello , Iam devloping a provisioning module and I need to add a client area command for 'reboot' the server but I need to it to be confirmed from the client before running the reboot (becuase If I add the reboot command into ClientAreaCustomButtonArray it will work fine and reboot the server but without confirmation) command, I do the following but the module did not run the reboot command: in module file I added function gatehubopenstackwcservers_ClientAreaCustomButtonArray() { $buttonarray = array( "Reboot Server" => "confirmReboot", ); return $buttonarray; } function gatehubopenstackwcservers_confirmReboot($params) { $serviceId = $params['serviceid']; $userId = $params['userid']; // Display a confirmation form using WHMCS template functions return array( 'templatefile' => 'templates/confirmation_reboot_server', // Assuming a custom template file 'vars' => array( 'serviceId' => $serviceId, 'userId' => $userId ) ); } function gatehubopenstackwcservers_reboot($params) { $server_state = rebootServer($params['serviceid'], $params); if (isset($server_state['error'])) { logActivity("error rebooting server service ID: {$params['serviceid']}, {$server_state['error']}", $params['userid']); $result = $server_state['error']; } else { $result = "success"; logActivity("server rebooted service ID: {$params['serviceid']}", $params['userid']); } return $result; } in my module 'templates/confirmation_reboot_server.tpl' I added: <form action="clientarea.php?action=productdetails" method="post"> <input type="hidden" name="id" value="{$serviceId}" /> <input type="hidden" name="modop" value="custom" /> <input type="hidden" name="a" value="reboot" /> <input type="hidden" name="userid" value="{$userId}"> <p>Are you sure you want to reboot the server with service ID {$serviceId}?</p> <button type="submit">Yes, Reboot Server</button> </form> When I logged in as client and goto service and try to reboot , the confirmation form show and ask me to confirm , when I confirm nothing happed and it just redirect me to the product page and show the product info , without real running of `gatehubopenstackwcservers_reboot()` function. Any help appreciated 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.