weba Posted March 6, 2021 Share Posted March 6, 2021 Hi, I want to do something simple but I only find complex solutions, must be looking in the wrong direction 😉 I want to add a button to the admin clientservice page. And when button is pressed I want to execute a custom function on that selected service. Is there some sample code for this ? Help would be appriciated! Michel.  0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 6, 2021 Share Posted March 6, 2021 Hi Michel, 4 hours ago, weba said: I want to do something simple but I only find complex solutions, must be looking in the wrong direction 😉 I suspect there wouldn't be a "simple" solution for this... you would likely have to use a hook to inject JS into the page.. which I assume are the complex solutions that you've already seen. 0 Quote Link to comment Share on other sites More sharing options...
weba Posted March 6, 2021 Author Share Posted March 6, 2021 (edited) I was afraid of this answer 😉 .... javascript is not my thing 😞 thanks anyway! Edited March 6, 2021 by weba 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted March 6, 2021 Share Posted March 6, 2021 A button in the same area as the Create, suspend, update stats, etc?  Have you looked at _AdminCustomButtonArray() function as described in https://developers.whmcs.com/provisioning-modules/custom-functions/ ?  So for example: function mymodule_AdminCustomButtonArray() { $buttonarray = array( "Cool Action" => "CoolFuntion", ); return $buttonarray; } function mymodule_CoolFuntion($params) { // Do some really awesome sauce stuff if (1 + 1 = 5) return "success"; //math is awesome else return "Error: Math is still right, space time has not been warped"; } Just remember when returning the button array, it calls for the function name minus the module prefix bits and the return has to be success or error message. Above presumes you can change the module's code and such of course.  If you can't, then yeah javascript, hooks, etc are your route. Or am I missing something? 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.