Aqib2001 Posted April 7, 2018 Share Posted April 7, 2018 Hi, i wanted to modify login to cPanel button to add a remote login url in it I had edited loginbuttons.tpl but it's not work Kindly Help me Link to comment Share on other sites More sharing options...
brian! Posted April 8, 2018 Share Posted April 8, 2018 6 hours ago, Aqib2001 said: Hi, i wanted to modify login to cPanel button to add a remote login url in it I had edited loginbuttons.tpl but it's not work can you give a screenshot of where you are seeing this link/button - is it the sidebar? 1 Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 8, 2018 Author Share Posted April 8, 2018 14 hours ago, brian! said: can you give a screenshot of where you are seeing this link/button - is it the sidebar? Yes, i wanted to change the login button present in the sidebar. Now, i am using hook but it cause error on other pages "Oops! Something went wrong and we couldn't process your request. Please go back to the previous page and try again." Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 8, 2018 Author Share Posted April 8, 2018 See this screenshot. I am receiving this error on other pages when i added hook to change the login to cPanel. I wanted add a remote login function instead of singlesignon. Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 8, 2018 Author Share Posted April 8, 2018 14 hours ago, brian! said: can you give a screenshot of where you are seeing this link/button - is it the sidebar? Thanks @brian! for helping me. I found the topic helpful that you posted. Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 8, 2018 Author Share Posted April 8, 2018 If, i wanted to add a code of a remote login in cPanel that what should i do for that? Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 8, 2018 Author Share Posted April 8, 2018 Sorry, In Login to cPanel button present in the sidebar of product details Link to comment Share on other sites More sharing options...
brian! Posted April 9, 2018 Share Posted April 9, 2018 19 hours ago, Aqib2001 said: If, i wanted to add a code of a remote login in cPanel that what should i do for that? if you want to change the URL link for cPanel in the sidebar, just change the ->setUri('http://'.$domain.'/cpanel'); line in the hook... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $service = Menu::context('service'); $domain = $service->domain; $servertype = $service->product->servertype; # Not cPanel, no links added if ($servertype!="cpanel"){ return; } if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') ->getChild('Login to cPanel') ->setUri('http://'.$domain.'/cpanel'); $primarySidebar->getChild('Service Details Actions') ->getChild('Login to Webmail') ->setUri('http://'.$domain.'/webmail'); } }); Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 10, 2018 Author Share Posted April 10, 2018 23 hours ago, brian! said: if you want to change the URL link for cPanel in the sidebar, just change the ->setUri('http://'.$domain.'/cpanel'); line in the hook... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $service = Menu::context('service'); $domain = $service->domain; $servertype = $service->product->servertype; # Not cPanel, no links added if ($servertype!="cpanel"){ return; } if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') ->getChild('Login to cPanel') ->setUri('http://'.$domain.'/cpanel'); $primarySidebar->getChild('Service Details Actions') ->getChild('Login to Webmail') ->setUri('http://'.$domain.'/webmail'); } }); Actually i wanted to add a form code and i wanted to set login to cpanel button as a form submit button. So, whenever user click on login to cPanel button he got automatically login. My Reseller Hosting Provider Do not support singlesignon but i have remote login form. Link to comment Share on other sites More sharing options...
brian! Posted April 11, 2018 Share Posted April 11, 2018 20 hours ago, Aqib2001 said: Actually i wanted to add a form code and i wanted to set login to cpanel button as a form submit button. So, whenever user click on login to cPanel button he got automatically login. did you want to add the form to an existing page, e.g productdetails - or to a sidebar ? Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 11, 2018 Author Share Posted April 11, 2018 8 hours ago, brian! said: did you want to add the form to an existing page, e.g productdetails - or to a sidebar ? Yes, i wanted to add a form in the sidebar and i want to replace login to cPanel button present in the sidebar with the submit button of form code. Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 11, 2018 Author Share Posted April 11, 2018 As form can get username and password from product rather than url. Link to comment Share on other sites More sharing options...
brian! Posted April 13, 2018 Share Posted April 13, 2018 On 4/11/2018 at 23:03, Aqib2001 said: Yes, i wanted to add a form in the sidebar and i want to replace login to cPanel button present in the sidebar with the submit button of form code. you may have to add the buttons to a new sidebar and remove the cpanel/webmail links from the existing one, but it's certainly possible to do it. Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 13, 2018 Author Share Posted April 13, 2018 34 minutes ago, brian! said: you may have to add the buttons to a new sidebar and remove the cpanel/webmail links from the existing one, but it's certainly possible to do it. Can you guide me please? Link to comment Share on other sites More sharing options...
brian! Posted April 14, 2018 Share Posted April 14, 2018 17 hours ago, Aqib2001 said: Can you guide me please? copy the attached file to /includes/hooks/ and when a product uses a cPanel server, it should remove the two links from the actions sidebar and create a new sidebar with a form... it should display using the current language choice... you might need to tweak the code for your own needs - especially if you need to tweak the paths. sidebarform.php Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 14, 2018 Author Share Posted April 14, 2018 6 minutes ago, brian! said: copy the attached file to /includes/hooks/ and when a product uses a cPanel server, it should remove the two links from the actions sidebar and create a new sidebar with a form... it should display using the current language choice... you might need to tweak the code for your own needs - especially if you need to tweak the paths. sidebarform.php Ok, thank you so much Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 22, 2018 Author Share Posted April 22, 2018 On 4/14/2018 at 4:22 PM, brian! said: copy the attached file to /includes/hooks/ and when a product uses a cPanel server, it should remove the two links from the actions sidebar and create a new sidebar with a form... it should display using the current language choice... you might need to tweak the code for your own needs - especially if you need to tweak the paths. sidebarform.php I tried this but it's not working Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 22, 2018 Author Share Posted April 22, 2018 Update: It's Working. I am using html instead of php. Sorry, it's working. Link to comment Share on other sites More sharing options...
brian! Posted April 23, 2018 Share Posted April 23, 2018 17 hours ago, Aqib2001 said: Update: It's Working. I am using html instead of php. Sorry, it's working. yes - all hooks have to be .php otherwise they won't work. Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 23, 2018 Author Share Posted April 23, 2018 5 hours ago, brian! said: yes - all hooks have to be .php otherwise they won't work. Ok, thanks Link to comment Share on other sites More sharing options...
Recommended Posts